From 1f1b750d815824123a12b6c08a69e3dbc6703ca2 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 29 May 2024 19:33:25 -0400 Subject: [PATCH 001/162] ICD: mark attribues as provisional (#33617) --- .../zcl/data-model/chip/icd-management-cluster.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml index 7015adadc2e5e1..0269b8f0f3dcad 100644 --- a/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml @@ -36,7 +36,7 @@ limitations under the License. - + @@ -103,9 +103,9 @@ limitations under the License. ClientsSupportedPerFabric - UserActiveModeTriggerHint - UserActiveModeTriggerInstruction - OperatingMode + UserActiveModeTriggerHint + UserActiveModeTriggerInstruction + OperatingMode Register a client to the end device From 90c5cd45d633be1d4f11fa87ac1bd1295fbb40bb Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 29 May 2024 19:44:04 -0400 Subject: [PATCH 002/162] Post merge review updates for CommandHandler updates (#33658) * Several updates: comments and remove inline * Restyle * Move TryAddResponseData into the cpp instead of the header * Add override, virtual was a copy and paste * Name argument * Argument renaming and comment update * Move EncoderToTLV into DataModel as it looks like a more generic place, maybe we end up re-using it * Restyle * Update copyright year * Renames based on review comments * More renames of args * Fix compile * Slight comment update * More comment update after self-review * More comment update after self-review * Some renaming * Restyle * One more rename: EncodableType * EncodeTo should be const --- src/app/CommandHandler.cpp | 20 +++++ src/app/CommandHandler.h | 115 +++++++--------------------- src/app/data-model/BUILD.gn | 1 + src/app/data-model/EncodableToTLV.h | 62 +++++++++++++++ 4 files changed, 111 insertions(+), 87 deletions(-) create mode 100644 src/app/data-model/EncodableToTLV.h diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 6077e0934721f7..309685491a8d82 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -113,6 +113,26 @@ Status CommandHandler::OnInvokeCommandRequest(CommandHandlerExchangeInterface & return status; } +CHIP_ERROR CommandHandler::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) +{ + ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId, + aResponseCommandId }; + + InvokeResponseParameters prepareParams(aRequestCommandPath); + prepareParams.SetStartOrEndDataStruct(false); + + { + ScopedChange internalCallToAddResponse(mInternalCallToAddResponseData, true); + ReturnErrorOnFailure(PrepareInvokeResponseCommand(responseCommandPath, prepareParams)); + } + + TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); + VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(aEncodable.EncodeTo(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields))); + return FinishCommand(/* aEndDataStruct = */ false); +} + CHIP_ERROR CommandHandler::ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage) { CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index b06064c46a69be..ae41ec1fe350fb 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -56,32 +57,6 @@ namespace chip { namespace app { -/// Defines an abstract class of something that can be encoded -/// into a TLV with a given data tag -class EncoderToTLV -{ -public: - virtual ~EncoderToTLV() = default; - - virtual CHIP_ERROR Encode(TLV::TLVWriter &, TLV::Tag tag) = 0; -}; - -/// An `EncoderToTLV` the uses `DataModel::Encode` to encode things. -/// -/// Generally useful to encode things like ::Commands::::Type -/// structures. -template -class DataModelEncoderToTLV : public EncoderToTLV -{ -public: - DataModelEncoderToTLV(const T & value) : mValue(value) {} - - virtual CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) { return DataModel::Encode(writer, tag, mValue); } - -private: - const T & mValue; -}; - class CommandHandler { public: @@ -267,7 +242,7 @@ class CommandHandler * Adds the given command status and returns any failures in adding statuses (e.g. out * of buffer space) to the caller */ - CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, + CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aRequestCommandPath, const Protocols::InteractionModel::Status aStatus, const char * context = nullptr); /** @@ -277,9 +252,9 @@ class CommandHandler void AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, const char * context = nullptr); - CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus); + CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus); - CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus); + CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus); /** * This adds a new CommandDataIB element into InvokeResponses for the associated @@ -350,37 +325,34 @@ class CommandHandler * @param [in] aRequestCommandPath the concrete path of the command we are * responding to. * @param [in] aData the data for the response. - * - * NOTE: this is a convenience function for `AddResponseDataViaEncoder` */ template - inline CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) + CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) { - DataModelEncoderToTLV encoder(aData); - return AddResponseDataViaEncoder(aRequestCommandPath, CommandData::GetCommandId(), encoder); + DataModel::EncodableType encoder(aData); + return AddResponseData(aRequestCommandPath, CommandData::GetCommandId(), encoder); } /** - * API for adding a data response. The encoded is generally expected to encode - * a ClusterName::Commands::CommandName::Type struct, but any - * object should work. + * API for adding a data response. The `aEncodable` is generally expected to encode + * a ClusterName::Commands::CommandName::Type struct, however any object should work. * * @param [in] aRequestCommandPath the concrete path of the command we are * responding to. - * @param [in] commandId the command whose content is being encoded. - * @param [in] encoder - an encoder that places the command data structure for `commandId` - * into a TLV Writer. + * @param [in] aResponseCommandId the command whose content is being encoded. + * @param [in] aEncodable - an encodable that places the command data structure + * for `aResponseCommandId` into a TLV Writer. * * Most applications are likely to use `AddResponseData` as a more convenient * one-call that auto-sets command ID and creates the underlying encoders. */ - CHIP_ERROR AddResponseDataViaEncoder(const ConcreteCommandPath & aRequestCommandPath, CommandId commandId, - EncoderToTLV & encoder) + CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) { // Return early when response should not be sent out. VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); return TryAddingResponse( - [&]() -> CHIP_ERROR { return TryAddResponseDataViaEncoder(aRequestCommandPath, commandId, encoder); }); + [&]() -> CHIP_ERROR { return TryAddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); }); } /** @@ -398,21 +370,22 @@ class CommandHandler * @param [in] aData the data for the response. */ template - inline void AddResponse(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) + void AddResponse(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) { - DataModelEncoderToTLV encoder(aData); - return AddResponseViaEncoder(aRequestCommandPath, CommandData::GetCommandId(), encoder); + DataModel::EncodableType encodable(aData); + return AddResponse(aRequestCommandPath, CommandData::GetCommandId(), encodable); } /** - * API for adding a response with a given encoder of TLV data. + * API for adding a response with a given encodable of TLV data. * - * The encoder would generally encode a ClusterName::Commands::CommandName::Type with + * The encodable would generally encode a ClusterName::Commands::CommandName::Type with * the corresponding `GetCommandId` call. */ - void AddResponseViaEncoder(const ConcreteCommandPath & aRequestCommandPath, CommandId commandId, EncoderToTLV & encoder) + void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) { - if (AddResponseDataViaEncoder(aRequestCommandPath, commandId, encoder) != CHIP_NO_ERROR) + if (AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable) != CHIP_NO_ERROR) { AddStatus(aRequestCommandPath, Protocols::InteractionModel::Status::Failure); } @@ -666,49 +639,17 @@ class CommandHandler CHIP_ERROR AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); - /** - * Non-templated function called before DataModel::Encode when attempting to add a response, - * which does all the work needed before encoding the actual type-dependent data into the buffer. - * - * **Important:** If this function fails, the TLV buffer may be left in an inconsistent state. - * Callers should create snapshots as necessary before invoking this function and implement - * rollback mechanisms if needed. - * - * **Usage:** This function is intended to be called exclusively by TryAddResponseData. It was - * factored out to optimize code size. - * - * @param aRequestCommandPath The concrete path of the command being responded to. - * @param aResponseCommandPath The concrete path of the command response. - */ - CHIP_ERROR TryAddResponseDataPreEncode(const ConcreteCommandPath & aRequestCommandPath, - const ConcreteCommandPath & aResponseCommandPath) - { - InvokeResponseParameters prepareParams(aRequestCommandPath); - prepareParams.SetStartOrEndDataStruct(false); - - ScopedChange internalCallToAddResponse(mInternalCallToAddResponseData, true); - return PrepareInvokeResponseCommand(aResponseCommandPath, prepareParams); - } - /** * If this function fails, it may leave our TLV buffer in an inconsistent state. * Callers should snapshot as needed before calling this function, and roll back * as needed afterward. * - * @param [in] aRequestCommandPath the concrete path of the command we are - * responding to. - * @param [in] aData the data for the response. + * @param [in] aRequestCommandPath the concrete path of the command we are responding to + * @param [in] aResponseCommandId the id of the command to encode + * @param [in] aEncodable the data to encode for the given aResponseCommandId */ - CHIP_ERROR TryAddResponseDataViaEncoder(const ConcreteCommandPath & aRequestCommandPath, CommandId commandId, - EncoderToTLV & encoder) - { - ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId, commandId }; - ReturnErrorOnFailure(TryAddResponseDataPreEncode(aRequestCommandPath, responseCommandPath)); - TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); - VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(encoder.Encode(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields))); - return FinishCommand(/* aEndDataStruct = */ false); - } + CHIP_ERROR TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable); void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder); diff --git a/src/app/data-model/BUILD.gn b/src/app/data-model/BUILD.gn index 6f38c056282e68..d61b30a68d9611 100644 --- a/src/app/data-model/BUILD.gn +++ b/src/app/data-model/BUILD.gn @@ -18,6 +18,7 @@ source_set("data-model") { "BasicTypes.h", "DecodableList.h", "Decode.h", + "EncodableToTLV.h", "Encode.h", "FabricScoped.h", "FabricScopedPreEncodedValue.cpp", diff --git a/src/app/data-model/EncodableToTLV.h b/src/app/data-model/EncodableToTLV.h new file mode 100644 index 00000000000000..d8b039141c226d --- /dev/null +++ b/src/app/data-model/EncodableToTLV.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 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 + +namespace chip { +namespace app { +namespace DataModel { + +/// Defines an abstract class of something that can be encoded +/// into a TLV with a given data tag +class EncodableToTLV +{ +public: + virtual ~EncodableToTLV() = default; + + virtual CHIP_ERROR EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const = 0; +}; + +/// An `EncodableToTLV` that uses `DataModel::Encode` to encode things in one call. +/// +/// Applicable to any type for which `chip::app::DataModel::Encode` works. In +/// particular, types like ::Commands::::Type +/// can be used as a type here. +template +class EncodableType : public EncodableToTLV +{ +public: + /// Encodes the given value via `DataModel::Encode` when the underlying + /// encode is called. + /// + /// LIFETIME NOTE: uses a reference to value, so value must live longer than + /// this object. + EncodableType(const T & value) : mValue(value) {} + + CHIP_ERROR EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const override { return DataModel::Encode(writer, tag, mValue); } + +private: + const T & mValue; +}; + +} // namespace DataModel +} // namespace app +} // namespace chip From be60b122b5c39799fd1024aca91a9d430a033e81 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 29 May 2024 19:57:29 -0400 Subject: [PATCH 003/162] Python documentation: Add a bit more detail on how to run locally (#33644) --- docs/testing/python.md | 62 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/docs/testing/python.md b/docs/testing/python.md index 1f946a38333ecd..51f734ace3ab15 100644 --- a/docs/testing/python.md +++ b/docs/testing/python.md @@ -480,16 +480,64 @@ second_ctrl = fa.new_fabric_admin.NewController(nodeId=node_id) # Running tests locally -You can run the python script as-is for local testing against an already-running -DUT +## Setup -`./scripts/tests/run_python_test.py` is a convenient script to fire up an -example DUT on the host, with factory reset support +The scripts require the python wheel to be compiled and installed before +running. To compile and install the wheel, do the following: -`./scripts/tests/run_python_test.py --factoryreset --app --app-args "whatever" --script --script-args "whatever"` +First activate the matter environment using either + +``` +. ./scripts/bootstrap.sh +``` + +or + +``` +. ./scripts/activate.sh +``` + +bootstrap.sh should be used for for the first setup, activate.sh may be used for +subsequent setups as it is faster. + +Next build the python wheels and create / activate a venv (called `py` here, but +any name may be used) + +``` +./scripts/build_python.sh -i py +source py/bin/activate +``` + +## Running tests -Note that devices must be commissioned by the python test harness to run tests. -chip-tool and the python test harness DO NOT share a fabric. +- Note that devices must be commissioned by the python test harness to run + tests. chip-tool and the python test harness DO NOT share a fabric. + +Once the wheel is installed, you can run the python script as a normal python +file for local testing against an already-running DUT. This can be an example +app on the host computer (running in a different terminal), or a separate device +that will be commissioned either over BLE or WiFi. + +For example, to run the TC-ACE-1.2 tests against an un-commissioned DUT: + +``` +python3 src/python_testing/TC_ACE_1_2.py --commissioning-method on-network --qr-code MT:-24J0AFN00KA0648G00 +``` + +Some tests require additional arguments (ex. PIXITs or configuration variables +for the CI). These arguments can be passed as sets of key-value pairs using the +`---arg` command line arguments. For example + +``` +--int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff +``` + +## Local host app testing + +`./scripts/tests/run_python_test.py` is a convenient script that starts an +example DUT on the host and includes factory reset support + +`./scripts/tests/run_python_test.py --factoryreset --app --app-args "whatever" --script --script-args "whatever"` # Running tests in CI From 896f802e689fbb31744d50134a6a8b2a3d67fb52 Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Thu, 30 May 2024 13:51:23 +1200 Subject: [PATCH 004/162] Linux: link with libatomic (#33628) Use of atomic builtins (__atomic_*) can require -latomic depending on what gets inlined (or not) on a particular platform. --- build/config/compiler/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 63b5eef6003b1b..1e634152a61d49 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -356,6 +356,7 @@ config("runtime_default") { } if (current_os == "linux" || current_os == "tizen" || current_os == "webos") { libs = [ + "atomic", "dl", "pthread", "rt", From c419e2f528358642a29bd5701957a519f52b07e4 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Thu, 30 May 2024 13:48:19 +0200 Subject: [PATCH 005/162] Fix issue related to teardown of some App Tests (#33654) * Fix issue related to teardown of some App Tests * Update comment Co-authored-by: Boris Zbarsky --------- Co-authored-by: Boris Zbarsky --- src/app/tests/AppTestContext.cpp | 12 ++++++++++++ src/app/tests/BUILD.gn | 14 ++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/app/tests/AppTestContext.cpp b/src/app/tests/AppTestContext.cpp index eca7a2db76c83b..ff1154dafbb306 100644 --- a/src/app/tests/AppTestContext.cpp +++ b/src/app/tests/AppTestContext.cpp @@ -49,6 +49,18 @@ void AppContext::SetUpTestSuite() void AppContext::TearDownTestSuite() { + // Some test suites finish with unprocessed work left in the platform manager event queue. + // This can particularly be a problem when this unprocessed work involves reporting engine runs, + // since those can take a while and cause later tests to not reach their queued work before + // their timeouts hit. This is only an issue in setups where all unit tests are compiled into + // a single file (e.g. nRF CI (Zephyr native_posix)). + // + // Work around this issue by doing a DrainAndServiceIO() here to attempt to flush out any queued-up work. + // + // TODO: Solve the underlying issue where test suites leave unprocessed work. Or is this actually + // the right solution? + LoopbackMessagingContext::DrainAndServiceIO(); + chip::DeviceLayer::PlatformMgr().Shutdown(); LoopbackMessagingContext::TearDownTestSuite(); } diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index df6737a713e6e4..28408773e15edf 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -123,6 +123,7 @@ chip_test_suite_using_nltest("tests") { output_name = "libAppTests" test_sources = [ + "TestAclAttribute.cpp", "TestAclEvent.cpp", "TestAttributeAccessInterfaceCache.cpp", "TestAttributePathExpandIterator.cpp", @@ -151,6 +152,7 @@ chip_test_suite_using_nltest("tests") { "TestPendingResponseTrackerImpl.cpp", "TestPowerSourceCluster.cpp", "TestReadInteraction.cpp", + "TestReportScheduler.cpp", "TestReportingEngine.cpp", "TestStatusIB.cpp", "TestStatusResponseMessage.cpp", @@ -164,8 +166,6 @@ chip_test_suite_using_nltest("tests") { test_sources += [ "TestFailSafeContext.cpp" ] } - test_sources += [ "TestAclAttribute.cpp" ] - # DefaultICDClientStorage assumes that raw AES key is used by the application if (chip_crypto != "psa") { test_sources += [ "TestDefaultICDClientStorage.cpp" ] @@ -189,16 +189,6 @@ chip_test_suite_using_nltest("tests") { test_sources += [ "TestEventLogging.cpp" ] } - # The platform manager is not properly clearing queues in test teardown, which results in - # DrainIO calls not being able to run in expected time (5seconds) if unprocessed reported engine - # runs are remaining, causing tests to crash in Open IoT SDK and Zephyr tests since they are - # running all tests in one file. We need to figure out how to properly clean the event queues - # before enabling this test for these platforms. - if (chip_device_platform != "nrfconnect" && - chip_device_platform != "openiotsdk") { - test_sources += [ "TestReportScheduler.cpp" ] - } - cflags = [ "-Wconversion" ] public_deps = [ From 201d5faaa16c4bc845fd16b668221765f28dea57 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Thu, 30 May 2024 10:46:29 -0400 Subject: [PATCH 006/162] Update DM XML scraper script (#33452) * scraper updates re-write this msg * Restyled by isort --------- Co-authored-by: Restyled.io --- scripts/spec_xml/generate_spec_xml.py | 103 +++++++++++++++++++------- 1 file changed, 77 insertions(+), 26 deletions(-) diff --git a/scripts/spec_xml/generate_spec_xml.py b/scripts/spec_xml/generate_spec_xml.py index b947b997665251..ecdd47e6a6904f 100755 --- a/scripts/spec_xml/generate_spec_xml.py +++ b/scripts/spec_xml/generate_spec_xml.py @@ -20,6 +20,8 @@ import re import subprocess import sys +import xml.etree.ElementTree as ElementTree +from pathlib import Path import click @@ -36,6 +38,20 @@ def get_xml_path(filename, output_dir): return os.path.abspath(os.path.join(output_dir, xml)) +def make_asciidoc(target: str, include_in_progress: bool, spec_dir: str, dry_run: bool) -> str: + cmd = ['make', 'PRINT_FILENAMES=1'] + if include_in_progress: + cmd.append('INCLUDE_IN_PROGRESS=1') + cmd.append(target) + if dry_run: + print(cmd) + return '' + else: + ret = subprocess.check_output(cmd, cwd=spec_dir).decode('UTF-8').rstrip() + print(ret) + return ret + + @click.command() @click.option( '--scraper', @@ -56,16 +72,21 @@ def get_xml_path(filename, output_dir): default=False, is_flag=True, help='Flag for dry run') -def main(scraper, spec_root, output_dir, dry_run): +@click.option( + '--include-in-progress', + default=True, + type=bool, + help='Include in-progress items from spec') +def main(scraper, spec_root, output_dir, dry_run, include_in_progress): # Clusters need to be scraped first because the cluster directory is passed to the device type directory - scrape_clusters(scraper, spec_root, output_dir, dry_run) - scrape_device_types(scraper, spec_root, output_dir, dry_run) + scrape_clusters(scraper, spec_root, output_dir, dry_run, include_in_progress) + scrape_device_types(scraper, spec_root, output_dir, dry_run, include_in_progress) if not dry_run: dump_versions(scraper, spec_root, output_dir) dump_cluster_ids(output_dir) -def scrape_clusters(scraper, spec_root, output_dir, dry_run): +def scrape_clusters(scraper, spec_root, output_dir, dry_run, include_in_progress): src_dir = os.path.abspath(os.path.join(spec_root, 'src')) sdm_clusters_dir = os.path.abspath( os.path.join(src_dir, 'service_device_management')) @@ -74,22 +95,25 @@ def scrape_clusters(scraper, spec_root, output_dir, dry_run): media_clusters_dir = os.path.abspath( os.path.join(app_clusters_dir, 'media')) clusters_output_dir = os.path.abspath(os.path.join(output_dir, 'clusters')) - dm_clusters_list = ['ACL-Cluster.adoc', 'Binding-Cluster.adoc', 'bridge-clusters.adoc', - 'Descriptor-Cluster.adoc', 'Group-Key-Management-Cluster.adoc', 'ICDManagement.adoc', - 'Label-Cluster.adoc'] - sdm_exclude_list = ['AdminAssistedCommissioningFlows.adoc', 'BulkDataExchange.adoc', 'CommissioningFlows.adoc', - 'DeviceCommissioningFlows.adoc', 'DistributedComplianceLedger.adoc', 'OTAFileFormat.adoc'] - app_exclude_list = ['appliances.adoc', 'closures.adoc', 'general.adoc', - 'hvac.adoc', 'lighting.adoc', 'meas_and_sense.adoc', 'robots.adoc'] - media_exclude_list = ['media.adoc', 'VideoPlayerArchitecture.adoc'] if not os.path.exists(clusters_output_dir): os.makedirs(clusters_output_dir) + print('Generating main spec to get file include list - this make take a few minutes') + main_out = make_asciidoc('pdf', include_in_progress, spec_root, dry_run) + print('Generating cluster spec to get file include list - this make take a few minutes') + cluster_out = make_asciidoc('pdf-appclusters-book', include_in_progress, spec_root, dry_run) + def scrape_cluster(filename: str) -> None: + base = Path(filename).stem + if base not in main_out and base not in cluster_out: + print(f'skipping file: {base} as it is not compiled into the asciidoc') + return xml_path = get_xml_path(filename, clusters_output_dir) cmd = [scraper, 'cluster', '-i', filename, '-o', - xml_path, '-nd', '--define', 'in-progress'] + xml_path, '-nd'] + if include_in_progress: + cmd.extend(['--define', 'in-progress']) if dry_run: print(cmd) else: @@ -97,19 +121,38 @@ def scrape_cluster(filename: str) -> None: def scrape_all_clusters(dir: str, exclude_list: list[str] = []) -> None: for filename in glob.glob(f'{dir}/*.adoc'): - if os.path.basename(filename) in exclude_list: - continue scrape_cluster(filename) - scrape_all_clusters(sdm_clusters_dir, sdm_exclude_list) - scrape_all_clusters(app_clusters_dir, app_exclude_list) - scrape_all_clusters(media_clusters_dir, media_exclude_list) - for f in dm_clusters_list: - filename = f'{dm_clusters_dir}/{f}' - scrape_cluster(filename) - - -def scrape_device_types(scraper, spec_root, output_dir, dry_run): + scrape_all_clusters(dm_clusters_dir) + scrape_all_clusters(sdm_clusters_dir) + scrape_all_clusters(app_clusters_dir) + scrape_all_clusters(media_clusters_dir) + + for xml_path in glob.glob(f'{clusters_output_dir}/*.xml'): + tree = ElementTree.parse(f'{xml_path}') + root = tree.getroot() + cluster = next(root.iter('cluster')) + # If there's no cluster ID table, this isn't a cluster + try: + next(cluster.iter('clusterIds')) + except StopIteration: + # If there's no cluster ID table, this isn't a cluster just some kind of intro adoc + print(f'Removing file {xml_path} as it does not include any cluster definitions') + os.remove(xml_path) + continue + # For now, we're going to manually remove the word "Cluster" from the cluster name field + # to make the diff easier. The update to 1.2.4 of the scraper added this. + # TODO: submit a separate PR with JUST this change revered and remove this code. + with open(xml_path, 'rb') as input: + xml_str = input.read() + + original_name = bytes(cluster.attrib['name'], 'utf-8') + replacement_name = bytes(cluster.attrib['name'].removesuffix(" Cluster"), 'utf-8') + with open(xml_path, 'wb') as output: + output.write(xml_str.replace(original_name, replacement_name)) + + +def scrape_device_types(scraper, spec_root, output_dir, dry_run, include_in_progress): device_type_dir = os.path.abspath( os.path.join(spec_root, 'src', 'device_types')) device_types_output_dir = os.path.abspath( @@ -119,9 +162,16 @@ def scrape_device_types(scraper, spec_root, output_dir, dry_run): if not os.path.exists(device_types_output_dir): os.makedirs(device_types_output_dir) + print('Generating device type library to get file include list - this make take a few minutes') + device_type_output = make_asciidoc('pdf-devicelibrary-book', include_in_progress, spec_root, dry_run) + def scrape_device_type(filename: str) -> None: + base = Path(filename).stem + if base not in device_type_output: + print(f'skipping file: {filename} as it is not compiled into the asciidoc') + return xml_path = get_xml_path(filename, device_types_output_dir) - cmd = [scraper, 'devicetype', '-c', clusters_output_dir, + cmd = [scraper, 'devicetype', '-c', '-cls', clusters_output_dir, '-nd', '-i', filename, '-o', xml_path] if dry_run: print(cmd) @@ -187,7 +237,8 @@ def dump_cluster_ids(output_dir): json_file = os.path.join(clusters_output_dir, 'cluster_ids.json') with open(json_file, "w") as outfile: - json.dump(json_dict, outfile, indent=2) + json.dump(json_dict, outfile, indent=4) + outfile.write('\n') if __name__ == '__main__': From a76d1624cb222749592c8cd56550ec95c5ab2b9b Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Thu, 30 May 2024 09:18:22 -0700 Subject: [PATCH 007/162] [Darwin] MTRDeviceConnectivityMonitor stopMonitoring crash fix (#33666) * [Darwin] MTRDeviceConnectivityMonitor stopMonitoring crash fix * Update src/darwin/Framework/CHIP/MTRDevice.mm Co-authored-by: Boris Zbarsky --------- Co-authored-by: Boris Zbarsky --- src/darwin/Framework/CHIP/MTRDevice.mm | 44 ++++++++++--------- .../CHIP/MTRDeviceConnectivityMonitor.mm | 9 +++- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 4e916d14b101c8..98af8fb4ab16c2 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -395,8 +395,8 @@ @implementation MTRDevice { NSMutableSet * _persistedClusters; // When we last failed to subscribe to the device (either via - // _setupSubscription or via the auto-resubscribe behavior of the - // ReadClient). Nil if we have had no such failures. + // _setupSubscriptionWithReason or via the auto-resubscribe behavior + // of the ReadClient). Nil if we have had no such failures. NSDate * _Nullable _lastSubscriptionFailureTime; MTRDeviceConnectivityMonitor * _connectivityMonitor; @@ -745,10 +745,10 @@ - (void)setDelegate:(id)delegate queue:(dispatch_queue_t)queu if ([self _deviceUsesThread]) { [self _scheduleSubscriptionPoolWork:^{ std::lock_guard lock(self->_lock); - [self _setupSubscription]; + [self _setupSubscriptionWithReason:@"delegate is set and scheduled subscription is happening"]; } inNanoseconds:0 description:@"MTRDevice setDelegate first subscription"]; } else { - [self _setupSubscription]; + [self _setupSubscriptionWithReason:@"delegate is set and subscription is needed"]; } } } @@ -788,14 +788,14 @@ - (void)nodeMayBeAdvertisingOperational MTR_LOG("%@ saw new operational advertisement", self); - [self _triggerResubscribeWithReason:"operational advertisement seen" + [self _triggerResubscribeWithReason:@"operational advertisement seen" nodeLikelyReachable:YES]; } // Trigger a resubscribe as needed. nodeLikelyReachable should be YES if we // have reason to suspect the node is now reachable, NO if we have no idea // whether it might be. -- (void)_triggerResubscribeWithReason:(const char *)reason nodeLikelyReachable:(BOOL)nodeLikelyReachable +- (void)_triggerResubscribeWithReason:(NSString *)reason nodeLikelyReachable:(BOOL)nodeLikelyReachable { assertChipStackLockedByCurrentThread(); @@ -814,7 +814,7 @@ - (void)_triggerResubscribeWithReason:(const char *)reason nodeLikelyReachable:( // establish a CASE session. And at that point, our subscription will // trigger the state change as needed. if (self.reattemptingSubscription) { - [self _reattemptSubscriptionNowIfNeeded]; + [self _reattemptSubscriptionNowIfNeededWithReason:reason]; } else { readClientToResubscribe = self->_currentReadClient; subscriptionCallback = self->_currentSubscriptionCallback; @@ -829,7 +829,7 @@ - (void)_triggerResubscribeWithReason:(const char *)reason nodeLikelyReachable:( // here (e.g. still booting up), but should try again reasonably quickly. subscriptionCallback->ResetResubscriptionBackoff(); } - readClientToResubscribe->TriggerResubscribeIfScheduled(reason); + readClientToResubscribe->TriggerResubscribeIfScheduled(reason.UTF8String); } } @@ -893,7 +893,7 @@ - (void)_readThroughSkipped // ReadClient in there. If the dispatch fails, that's fine; it means our // controller has shut down, so nothing to be done. [_deviceController asyncDispatchToMatterQueue:^{ - [self _triggerResubscribeWithReason:"read-through skipped while not subscribed" nodeLikelyReachable:NO]; + [self _triggerResubscribeWithReason:@"read-through skipped while not subscribed" nodeLikelyReachable:NO]; } errorHandler:nil]; } @@ -1160,7 +1160,7 @@ - (void)_handleResubscriptionNeededWithDelay:(NSNumber *)resubscriptionDelayMs // this block is run -- if other triggering events had happened, this would become a no-op. auto resubscriptionBlock = ^{ [self->_deviceController asyncDispatchToMatterQueue:^{ - [self _triggerResubscribeWithReason:"ResubscriptionNeeded timer fired" nodeLikelyReachable:NO]; + [self _triggerResubscribeWithReason:@"ResubscriptionNeeded timer fired" nodeLikelyReachable:NO]; } errorHandler:^(NSError * _Nonnull error) { // If controller is not running, clear work item from the subscription queue MTR_LOG_ERROR("%@ could not dispatch to matter queue for resubscription - error %@", self, error); @@ -1235,17 +1235,17 @@ - (void)_handleSubscriptionReset:(NSNumber * _Nullable)retryDelay // If we started subscription or session establishment but failed, remove item from the subscription pool so we can re-queue. [self _clearSubscriptionPoolWork]; - // Call _reattemptSubscriptionNowIfNeeded when timer fires - if subscription is + // Call _reattemptSubscriptionNowIfNeededWithReason when timer fires - if subscription is // in a better state at that time this will be a no-op. auto resubscriptionBlock = ^{ os_unfair_lock_lock(&self->_lock); - [self _reattemptSubscriptionNowIfNeeded]; + [self _reattemptSubscriptionNowIfNeededWithReason:@"got subscription reset"]; os_unfair_lock_unlock(&self->_lock); }; int64_t resubscriptionDelayNs = static_cast(secondsToWait * NSEC_PER_SEC); if ([self _deviceUsesThread]) { - // For Thread-enabled devices, schedule the _reattemptSubscriptionNowIfNeeded call to run in the subscription pool + // For Thread-enabled devices, schedule the _reattemptSubscriptionNowIfNeededWithReason call to run in the subscription pool [self _scheduleSubscriptionPoolWork:resubscriptionBlock inNanoseconds:resubscriptionDelayNs description:@"MTRDevice resubscription"]; } else { // For non-Thread-enabled devices, just call the resubscription block after the specified time @@ -1253,7 +1253,7 @@ - (void)_handleSubscriptionReset:(NSNumber * _Nullable)retryDelay } } -- (void)_reattemptSubscriptionNowIfNeeded +- (void)_reattemptSubscriptionNowIfNeededWithReason:(NSString *)reason { os_unfair_lock_assert_owner(&self->_lock); if (!self.reattemptingSubscription) { @@ -1262,7 +1262,7 @@ - (void)_reattemptSubscriptionNowIfNeeded MTR_LOG("%@ reattempting subscription", self); self.reattemptingSubscription = NO; - [self _setupSubscription]; + [self _setupSubscriptionWithReason:reason]; } - (void)_handleUnsolicitedMessageFromPublisher @@ -1284,8 +1284,8 @@ - (void)_handleUnsolicitedMessageFromPublisher // reestablishment, this starts the attempt right away // TODO: This doesn't really make sense. If we _don't_ have a live // ReadClient how did we get this notification and if we _do_ have an active - // ReadClient, this call or _setupSubscription would be no-ops. - [self _reattemptSubscriptionNowIfNeeded]; + // ReadClient, this call or _setupSubscriptionWithReason would be no-ops. + [self _reattemptSubscriptionNowIfNeededWithReason:@"got unsolicited message from publisher"]; } - (void)_markDeviceAsUnreachableIfNeverSubscribed @@ -1941,7 +1941,7 @@ - (void)_setupConnectivityMonitoring self->_connectivityMonitor = [[MTRDeviceConnectivityMonitor alloc] initWithCompressedFabricID:compressedFabricID nodeID:self.nodeID]; [self->_connectivityMonitor startMonitoringWithHandler:^{ [self->_deviceController asyncDispatchToMatterQueue:^{ - [self _triggerResubscribeWithReason:"device connectivity changed" nodeLikelyReachable:YES]; + [self _triggerResubscribeWithReason:@"device connectivity changed" nodeLikelyReachable:YES]; } errorHandler:nil]; } queue:self.queue]; @@ -1959,12 +1959,12 @@ - (void)_stopConnectivityMonitoring } // assume lock is held -- (void)_setupSubscription +- (void)_setupSubscriptionWithReason:(NSString *)reason { os_unfair_lock_assert_owner(&self->_lock); if (![self _subscriptionsAllowed]) { - MTR_LOG("_setupSubscription: Subscriptions not allowed. Do not set up subscription"); + MTR_LOG("%@ _setupSubscription: Subscriptions not allowed. Do not set up subscription", self); return; } @@ -1986,6 +1986,8 @@ - (void)_setupSubscription [self _changeInternalState:MTRInternalDeviceStateSubscribing]; + MTR_LOG("%@ setting up subscription with reason: %@", self, reason); + // Set up a timer to mark as not reachable if it takes too long to set up a subscription MTRWeakReference * weakSelf = [MTRWeakReference weakReferenceWithObject:self]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, static_cast(kSecondsToWaitBeforeMarkingUnreachableAfterSettingUpSubscription) * static_cast(NSEC_PER_SEC)), self.queue, ^{ @@ -3512,7 +3514,7 @@ - (void)_deviceMayBeReachable MTR_LOG("%@ _deviceMayBeReachable called", self); - [self _triggerResubscribeWithReason:"SPI client indicated the device may now be reachable" + [self _triggerResubscribeWithReason:@"SPI client indicated the device may now be reachable" nodeLikelyReachable:YES]; } diff --git a/src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm b/src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm index 3df270be9ce62e..6a9ac601d41b6f 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm @@ -258,7 +258,7 @@ - (void)_stopMonitoring dispatch_after(dispatch_time(DISPATCH_TIME_NOW, kSharedConnectionLingerIntervalSeconds * NSEC_PER_SEC), sSharedResolverQueue, ^{ std::lock_guard lock(sConnectivityMonitorLock); - if (!sConnectivityMonitorCount) { + if (!sConnectivityMonitorCount && sSharedResolverConnection) { MTR_LOG("MTRDeviceConnectivityMonitor: Closing shared resolver connection"); DNSServiceRefDeallocate(sSharedResolverConnection); sSharedResolverConnection = NULL; @@ -271,9 +271,14 @@ - (void)_stopMonitoring - (void)stopMonitoring { + MTR_LOG("%@ stop connectivity monitoring for %@", self, self->_instanceName); + std::lock_guard lock(sConnectivityMonitorLock); + if (!sSharedResolverConnection || !sSharedResolverQueue) { + MTR_LOG("%@ shared resolver connection already stopped - nothing to do", self); + } + // DNSServiceRefDeallocate must be called on the same queue set on the shared connection. dispatch_async(sSharedResolverQueue, ^{ - MTR_LOG("%@ stop connectivity monitoring for %@", self, self->_instanceName); std::lock_guard lock(sConnectivityMonitorLock); [self _stopMonitoring]; }); From 1057dafa3f04af76913ffb7c69b27398e040da30 Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Fri, 31 May 2024 07:47:32 +1200 Subject: [PATCH 008/162] Darwin: Keep MTRCommissionableBrowser around until OnBleScanStopped (#33674) * Darwin: Keep MTRCommissionableBrowser around until OnBleScanStopped Because the BLE platform implementation uses a separate dispatch queue, StopBleScan() does not synchrnously stop any further use of the current BleScannerDelegate. Keep the MTRCommissionableBrowser that contains the delegate alive until OnBleScanStopped to avoid a UAF. * restyle * Retain owner in Stop() instead of Start() * More review comments --- .../CHIP/MTRCommissionableBrowser.mm | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm b/src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm index 2b3e2814ecd220..276fb5e3460682 100644 --- a/src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm +++ b/src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm @@ -61,6 +61,10 @@ @implementation MTRCommissionableBrowserResult #endif // CONFIG_NETWORK_LAYER_BLE { public: +#if CONFIG_NETWORK_LAYER_BLE + id mBleScannerDelegateOwner; +#endif // CONFIG_NETWORK_LAYER_BLE + CHIP_ERROR Start(id delegate, MTRDeviceController * controller, dispatch_queue_t queue) { assertChipStackLockedByCurrentThread(); @@ -90,7 +94,7 @@ CHIP_ERROR Start(id delegate, MTRDeviceControl chip::Inet::InterfaceId::Null(), this); } - CHIP_ERROR Stop() + CHIP_ERROR Stop(id owner) { assertChipStackLockedByCurrentThread(); @@ -109,7 +113,10 @@ CHIP_ERROR Stop() mDiscoveredResults = nil; #if CONFIG_NETWORK_LAYER_BLE - ReturnErrorOnFailure(PlatformMgrImpl().StopBleScan()); + mBleScannerDelegateOwner = owner; // retain the owner until OnBleScanStopped is called + PlatformMgrImpl().StopBleScan(); // doesn't actually fail, and if it did we'd want to carry on regardless +#else + (void) owner; #endif // CONFIG_NETWORK_LAYER_BLE return ChipDnssdStopBrowse(this); @@ -281,6 +288,7 @@ void OnBrowseStop(CHIP_ERROR error) override void OnBleScanAdd(BLE_CONNECTION_OBJECT connObj, const ChipBLEDeviceIdentificationInfo & info) override { assertChipStackLockedByCurrentThread(); + VerifyOrReturn(mDelegate != nil); auto result = [[MTRCommissionableBrowserResult alloc] init]; result.instanceName = [NSString stringWithUTF8String:kBleKey]; @@ -303,6 +311,7 @@ void OnBleScanAdd(BLE_CONNECTION_OBJECT connObj, const ChipBLEDeviceIdentificati void OnBleScanRemove(BLE_CONNECTION_OBJECT connObj) override { assertChipStackLockedByCurrentThread(); + VerifyOrReturn(mDelegate != nil); auto key = [NSString stringWithFormat:@"%@", connObj]; if ([mDiscoveredResults objectForKey:key] == nil) { @@ -319,6 +328,12 @@ void OnBleScanRemove(BLE_CONNECTION_OBJECT connObj) override [mDelegate controller:mController didFindCommissionableDevice:result]; }); } + + void OnBleScanStopped() override + { + mBleScannerDelegateOwner = nil; + } + #endif // CONFIG_NETWORK_LAYER_BLE private: @@ -360,7 +375,7 @@ - (BOOL)start - (BOOL)stop { - VerifyOrReturnValue(CHIP_NO_ERROR == _browser.Stop(), NO); + VerifyOrReturnValue(CHIP_NO_ERROR == _browser.Stop(self), NO); _delegate = nil; _controller = nil; _queue = nil; From 92f8cd05ddb37a5f49590d4dfe6fde5c85a92706 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Thu, 30 May 2024 21:52:05 +0200 Subject: [PATCH 009/162] Make StringToUUID constexpr (#33649) * Implement StringToUUID as constexpr * Change local variable to use one global constexpr * restyle * Typo * Remove strings from tizen and linux platform * refactor * Fix review issue --- src/ble/BLEEndPoint.cpp | 8 +- src/ble/BleLayer.cpp | 30 ++--- src/ble/BleLayer.h | 7 -- src/ble/BleUUID.cpp | 39 ------- src/ble/BleUUID.h | 70 +++++++++++- src/ble/tests/TestBleLayer.cpp | 42 +++---- src/ble/tests/TestBleUUID.cpp | 33 +++--- src/platform/Linux/bluez/BluezConnection.cpp | 8 +- src/platform/Linux/bluez/BluezEndpoint.cpp | 8 +- .../Linux/bluez/ChipDeviceScanner.cpp | 2 +- src/platform/Linux/bluez/Types.h | 12 -- src/platform/Tizen/BLEManagerImpl.cpp | 107 +++++------------- src/platform/Tizen/ChipDeviceScanner.cpp | 9 +- 13 files changed, 149 insertions(+), 226 deletions(-) diff --git a/src/ble/BLEEndPoint.cpp b/src/ble/BLEEndPoint.cpp index 0e69e590df7f49..78e74bdec78b1a 100644 --- a/src/ble/BLEEndPoint.cpp +++ b/src/ble/BLEEndPoint.cpp @@ -389,7 +389,7 @@ void BLEEndPoint::FinalizeClose(uint8_t oldState, uint8_t flags, CHIP_ERROR err) // Indicate close of chipConnection to peripheral via GATT unsubscribe. Keep end point allocated until // unsubscribe completes or times out, so platform doesn't close underlying BLE connection before // we're really sure the unsubscribe request has been sent. - if (!mBle->mPlatformDelegate->UnsubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &mBle->CHIP_BLE_CHAR_2_ID)) + if (!mBle->mPlatformDelegate->UnsubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID)) { ChipLogError(Ble, "BtpEngine unsub failed"); @@ -750,7 +750,7 @@ CHIP_ERROR BLEEndPoint::HandleHandshakeConfirmationReceived() { // Subscribe to characteristic which peripheral will use to send indications. Prompts peripheral to send // BLE transport capabilities indication. - VerifyOrExit(mBle->mPlatformDelegate->SubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &mBle->CHIP_BLE_CHAR_2_ID), + VerifyOrExit(mBle->mPlatformDelegate->SubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID), err = BLE_ERROR_GATT_SUBSCRIBE_FAILED); // We just sent a GATT subscribe request, so make sure to attempt unsubscribe on close. @@ -1313,14 +1313,14 @@ bool BLEEndPoint::SendWrite(PacketBufferHandle && buf) { mConnStateFlags.Set(ConnectionStateFlag::kGattOperationInFlight); - return mBle->mPlatformDelegate->SendWriteRequest(mConnObj, &CHIP_BLE_SVC_ID, &mBle->CHIP_BLE_CHAR_1_ID, std::move(buf)); + return mBle->mPlatformDelegate->SendWriteRequest(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID, std::move(buf)); } bool BLEEndPoint::SendIndication(PacketBufferHandle && buf) { mConnStateFlags.Set(ConnectionStateFlag::kGattOperationInFlight); - return mBle->mPlatformDelegate->SendIndication(mConnObj, &CHIP_BLE_SVC_ID, &mBle->CHIP_BLE_CHAR_2_ID, std::move(buf)); + return mBle->mPlatformDelegate->SendIndication(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID, std::move(buf)); } CHIP_ERROR BLEEndPoint::StartConnectTimer() diff --git a/src/ble/BleLayer.cpp b/src/ble/BleLayer.cpp index de1f8458402efa..3e1473a4a1c2c2 100644 --- a/src/ble/BleLayer.cpp +++ b/src/ble/BleLayer.cpp @@ -138,20 +138,6 @@ class BleEndPointPool // static BleEndPointPool sBLEEndPointPool; -// UUIDs used internally by BleLayer: - -const ChipBleUUID BleLayer::CHIP_BLE_CHAR_1_ID = { { // 18EE2EF5-263D-4559-959F-4F9C429F9D11 - 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, - 0x9F, 0x9D, 0x11 } }; - -const ChipBleUUID BleLayer::CHIP_BLE_CHAR_2_ID = { { // 18EE2EF5-263D-4559-959F-4F9C429F9D12 - 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, - 0x9F, 0x9D, 0x12 } }; - -const ChipBleUUID BleLayer::CHIP_BLE_CHAR_3_ID = { { // 64630238-8772-45F2-B87D-748A83218F04 - 0x64, 0x63, 0x02, 0x38, 0x87, 0x72, 0x45, 0xF2, 0xB8, 0x7D, 0x74, 0x8A, 0x83, - 0x21, 0x8F, 0x04 } }; - // BleTransportCapabilitiesRequestMessage implementation: void BleTransportCapabilitiesRequestMessage::SetSupportedProtocolVersion(uint8_t index, uint8_t version) @@ -486,7 +472,7 @@ bool BleLayer::HandleWriteReceived(BLE_CONNECTION_OBJECT connObj, const ChipBleU PacketBufferHandle && pBuf) { VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_SVC_ID, svcId), false, ChipLogError(Ble, "Write received on unknown svc")); - VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_1_ID, charId), false, ChipLogError(Ble, "Write received on unknown char")); + VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_1_UUID, charId), false, ChipLogError(Ble, "Write received on unknown char")); VerifyOrReturnError(!pBuf.IsNull(), false, ChipLogError(Ble, "Write received null buffer")); // Find matching connection end point. @@ -512,7 +498,7 @@ bool BleLayer::HandleIndicationReceived(BLE_CONNECTION_OBJECT connObj, const Chi PacketBufferHandle && pBuf) { VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_SVC_ID, svcId), false, ChipLogError(Ble, "Indication received on unknown svc")); - VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_ID, charId), false, ChipLogError(Ble, "Indication received on unknown char")); + VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_UUID, charId), false, ChipLogError(Ble, "Indication received on unknown char")); VerifyOrReturnError(!pBuf.IsNull(), false, ChipLogError(Ble, "Indication received null buffer")); // Find matching connection end point. @@ -528,7 +514,7 @@ bool BleLayer::HandleIndicationReceived(BLE_CONNECTION_OBJECT connObj, const Chi bool BleLayer::HandleWriteConfirmation(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) { VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_SVC_ID, svcId), false, ChipLogError(Ble, "Write confirmation on unknown svc")); - VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_1_ID, charId), false, ChipLogError(Ble, "Write confirmation on unknown char")); + VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_1_UUID, charId), false, ChipLogError(Ble, "Write confirmation on unknown char")); HandleAckReceived(connObj); return true; @@ -537,7 +523,7 @@ bool BleLayer::HandleWriteConfirmation(BLE_CONNECTION_OBJECT connObj, const Chip bool BleLayer::HandleIndicationConfirmation(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) { VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_SVC_ID, svcId), false, ChipLogError(Ble, "Indication confirmation on unknown svc")); - VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_ID, charId), false, + VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_UUID, charId), false, ChipLogError(Ble, "Indication confirmation on unknown char")); HandleAckReceived(connObj); @@ -558,7 +544,7 @@ void BleLayer::HandleAckReceived(BLE_CONNECTION_OBJECT connObj) bool BleLayer::HandleSubscribeReceived(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) { VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_SVC_ID, svcId), false, ChipLogError(Ble, "Subscribe received on unknown svc")); - VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_ID, charId) || UUIDsMatch(&CHIP_BLE_CHAR_3_ID, charId), false, + VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_UUID, charId) || UUIDsMatch(&CHIP_BLE_CHAR_3_UUID, charId), false, ChipLogError(Ble, "Subscribe received on unknown char")); // Find end point already associated with BLE connection, if any. @@ -572,7 +558,7 @@ bool BleLayer::HandleSubscribeReceived(BLE_CONNECTION_OBJECT connObj, const Chip bool BleLayer::HandleSubscribeComplete(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) { VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_SVC_ID, svcId), false, ChipLogError(Ble, "Subscribe complete on unknown svc")); - VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_ID, charId) || UUIDsMatch(&CHIP_BLE_CHAR_3_ID, charId), false, + VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_UUID, charId) || UUIDsMatch(&CHIP_BLE_CHAR_3_UUID, charId), false, ChipLogError(Ble, "Subscribe complete on unknown char")); BLEEndPoint * endPoint = sBLEEndPointPool.Find(connObj); @@ -585,7 +571,7 @@ bool BleLayer::HandleSubscribeComplete(BLE_CONNECTION_OBJECT connObj, const Chip bool BleLayer::HandleUnsubscribeReceived(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) { VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_SVC_ID, svcId), false, ChipLogError(Ble, "Unsubscribe received on unknown svc")); - VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_ID, charId) || UUIDsMatch(&CHIP_BLE_CHAR_3_ID, charId), false, + VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_UUID, charId) || UUIDsMatch(&CHIP_BLE_CHAR_3_UUID, charId), false, ChipLogError(Ble, "Unsubscribe received on unknown char")); // Find end point already associated with BLE connection, if any. @@ -599,7 +585,7 @@ bool BleLayer::HandleUnsubscribeReceived(BLE_CONNECTION_OBJECT connObj, const Ch bool BleLayer::HandleUnsubscribeComplete(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) { VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_SVC_ID, svcId), false, ChipLogError(Ble, "Unsubscribe complete on unknown svc")); - VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_ID, charId) || UUIDsMatch(&CHIP_BLE_CHAR_3_ID, charId), false, + VerifyOrReturnError(UUIDsMatch(&CHIP_BLE_CHAR_2_UUID, charId) || UUIDsMatch(&CHIP_BLE_CHAR_3_UUID, charId), false, ChipLogError(Ble, "Unsubscribe complete on unknown char")); // Find end point already associated with BLE connection, if any. diff --git a/src/ble/BleLayer.h b/src/ble/BleLayer.h index e7d619fe13420e..7056a09e5e14d6 100644 --- a/src/ble/BleLayer.h +++ b/src/ble/BleLayer.h @@ -313,13 +313,6 @@ class DLL_EXPORT BleLayer private: // Private data members: - // UUID of CHIP service characteristic used for central writes. - static const ChipBleUUID CHIP_BLE_CHAR_1_ID; - // UUID of CHIP service characteristic used for peripheral indications. - static const ChipBleUUID CHIP_BLE_CHAR_2_ID; - // UUID of CHIP service characteristic used for additional data - static const ChipBleUUID CHIP_BLE_CHAR_3_ID; - BleConnectionDelegate * mConnectionDelegate; BlePlatformDelegate * mPlatformDelegate; BleApplicationDelegate * mApplicationDelegate; diff --git a/src/ble/BleUUID.cpp b/src/ble/BleUUID.cpp index 098595fd721e5c..f42fc982e403d6 100644 --- a/src/ble/BleUUID.cpp +++ b/src/ble/BleUUID.cpp @@ -26,15 +26,6 @@ namespace chip { namespace Ble { -const ChipBleUUID CHIP_BLE_SVC_ID = { { // 0000FFF6-0000-1000-8000-00805F9B34FB - 0x00, 0x00, 0xFF, 0xF6, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, - 0xFB } }; - -inline static uint8_t HexDigitToInt(const char c) -{ - return static_cast(c >= '0' && c <= '9' ? c - '0' : tolower(c) - 'a' + 10); -} - bool UUIDsMatch(const ChipBleUUID * idOne, const ChipBleUUID * idTwo) { if ((idOne == nullptr) || (idTwo == nullptr)) @@ -44,35 +35,5 @@ bool UUIDsMatch(const ChipBleUUID * idOne, const ChipBleUUID * idTwo) return (memcmp(idOne->bytes, idTwo->bytes, 16) == 0); } -// Convert a string like "0000FFF6-0000-1000-8000-00805F9B34FB" to binary UUID -bool StringToUUID(const char * str, ChipBleUUID & uuid) -{ - constexpr size_t NUM_UUID_NIBBLES = sizeof(uuid.bytes) * 2; - size_t nibbleId = 0; - - for (; *str; ++str) - { - if (*str == '-') // skip separators - continue; - - if (!isxdigit(*str)) // invalid character! - return false; - - if (nibbleId >= NUM_UUID_NIBBLES) // too long string! - return false; - - uint8_t & byte = uuid.bytes[nibbleId / 2]; - if (nibbleId % 2 == 0) - byte = static_cast(HexDigitToInt(*str) << 4); - else - byte = static_cast(byte | HexDigitToInt(*str)); - - ++nibbleId; - } - - // All bytes were initialized? - return nibbleId == NUM_UUID_NIBBLES; -} - } /* namespace Ble */ } /* namespace chip */ diff --git a/src/ble/BleUUID.h b/src/ble/BleUUID.h index 315af9e8c76a32..6470cfe36e8494 100644 --- a/src/ble/BleUUID.h +++ b/src/ble/BleUUID.h @@ -22,7 +22,9 @@ #error "Please include instead!" #endif +#include #include +#include namespace chip { namespace Ble { @@ -36,11 +38,73 @@ struct ChipBleUUID uint8_t bytes[16]; }; -// UUID of CHIP BLE service. Exposed for use in scan filter. -extern const ChipBleUUID CHIP_BLE_SVC_ID; +constexpr bool isValidHexChar(char c) +{ + return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); +} + +constexpr uint8_t HexDigitToInt(const char c) +{ + if (c >= '0' && c <= '9') + return static_cast(c - '0'); + else + return static_cast((c >= 'a' ? c - 'a' : c - 'A') + 10); +} bool UUIDsMatch(const ChipBleUUID * idOne, const ChipBleUUID * idTwo); -bool StringToUUID(const char * str, ChipBleUUID & uuid); + +/* + * StringToUUID converts a string representation of a UUID to a binary UUID. + * The string representation must be in the format "0000FFF6-0000-1000-8000-00805F9B34FB". + * The function returns a pair of a boolean indicating whether the conversion was successful + * and the binary UUID. + * + */ +template +constexpr std::pair StringToUUID(const char (&str)[N]) +{ + constexpr size_t UUID_LEN = 16; + constexpr size_t NUM_UUID_NIBBLES = UUID_LEN * 2; + static_assert(N >= NUM_UUID_NIBBLES); + ChipBleUUID uuid{}; + + size_t nibbleId = 0; + for (size_t i = 0; i < N - 1; ++i) + { + if (str[i] == '-') + continue; + if (!isValidHexChar(str[i])) + return { false, {} }; + if (nibbleId >= NUM_UUID_NIBBLES) + return { false, {} }; + uint8_t & byte = uuid.bytes[nibbleId / 2]; + if (nibbleId % 2 == 0) + byte = static_cast(HexDigitToInt(str[i]) << 4); + else + byte = static_cast(byte | HexDigitToInt(str[i])); + ++nibbleId; + } + return { nibbleId == NUM_UUID_NIBBLES, uuid }; +} + +#define StringToUUIDConstexpr(str) \ + []() { \ + constexpr std::pair res = ::chip::Ble::StringToUUID(str); \ + static_assert(res.first, "Argument: \"" #str "\" is not valid hex string"); \ + return res.second; \ + }(); + +// UUID of CHIP BLE service. +inline constexpr char CHIP_BLE_DESC_SHORT_UUID_STR[] = "2902"; +inline constexpr char CHIP_BLE_SERVICE_SHORT_UUID_STR[] = "FFF6"; +inline constexpr char CHIP_BLE_SERVICE_LONG_UUID_STR[] = "0000FFF6-0000-1000-8000-00805F9B34FB"; +inline constexpr char CHIP_BLE_CHAR_1_UUID_STR[] = "18EE2EF5-263D-4559-959F-4F9C429F9D11"; +inline constexpr char CHIP_BLE_CHAR_2_UUID_STR[] = "18EE2EF5-263D-4559-959F-4F9C429F9D12"; +inline constexpr char CHIP_BLE_CHAR_3_UUID_STR[] = "64630238-8772-45F2-B87D-748A83218F04"; +inline constexpr ChipBleUUID CHIP_BLE_SVC_ID = StringToUUIDConstexpr("0000FFF6-0000-1000-8000-00805F9B34FB"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_1_UUID = StringToUUIDConstexpr("18EE2EF5-263D-4559-959F-4F9C429F9D11"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_2_UUID = StringToUUIDConstexpr("18EE2EF5-263D-4559-959F-4F9C429F9D12"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_3_UUID = StringToUUIDConstexpr("64630238-8772-45F2-B87D-748A83218F04"); } /* namespace Ble */ } /* namespace chip */ diff --git a/src/ble/tests/TestBleLayer.cpp b/src/ble/tests/TestBleLayer.cpp index 9b79037acd0ea1..968293d8a72b8f 100644 --- a/src/ble/tests/TestBleLayer.cpp +++ b/src/ble/tests/TestBleLayer.cpp @@ -44,14 +44,6 @@ namespace Ble { namespace { constexpr ChipBleUUID uuidZero{}; -constexpr ChipBleUUID uuidSvc = { { 0x00, 0x00, 0xFF, 0xF6, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, - 0xFB } }; -constexpr ChipBleUUID uuidChar1 = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, 0x9D, - 0x11 } }; -constexpr ChipBleUUID uuidChar2 = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, 0x9D, - 0x12 } }; -constexpr ChipBleUUID uuidChar3 = { { 0x64, 0x63, 0x02, 0x38, 0x87, 0x72, 0x45, 0xF2, 0xB8, 0x7D, 0x74, 0x8A, 0x83, 0x21, 0x8F, - 0x04 } }; }; // namespace @@ -111,14 +103,14 @@ class TestBleLayer : public BleLayer, { constexpr uint8_t capReq[] = { 0x65, 0x6c, 0x54, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x06 }; auto buf = System::PacketBufferHandle::NewWithData(capReq, sizeof(capReq)); - return HandleWriteReceived(connObj, &uuidSvc, &uuidChar1, std::move(buf)); + return HandleWriteReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID, std::move(buf)); } // Processing subscription request after capabilities request should finalize // connection establishment. bool HandleSubscribeReceivedOnChar2(BLE_CONNECTION_OBJECT connObj) { - return HandleSubscribeReceived(connObj, &uuidSvc, &uuidChar2); + return HandleSubscribeReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID); } /// @@ -220,7 +212,7 @@ TEST_F(TestBleLayer, HandleSubscribeReceivedInvalidUUID) { auto connObj = GetConnectionObject(); EXPECT_FALSE(HandleSubscribeReceived(connObj, &uuidZero, &uuidZero)); - EXPECT_FALSE(HandleSubscribeReceived(connObj, &uuidSvc, &uuidChar1)); + EXPECT_FALSE(HandleSubscribeReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID)); } TEST_F(TestBleLayer, HandleSubscribeReceived) @@ -234,7 +226,7 @@ TEST_F(TestBleLayer, HandleSubscribeCompleteInvalidUUID) { auto connObj = GetConnectionObject(); EXPECT_FALSE(HandleSubscribeComplete(connObj, &uuidZero, &uuidZero)); - EXPECT_FALSE(HandleSubscribeComplete(connObj, &uuidSvc, &uuidChar1)); + EXPECT_FALSE(HandleSubscribeComplete(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID)); } TEST_F(TestBleLayer, HandleSubscribeComplete) @@ -243,14 +235,14 @@ TEST_F(TestBleLayer, HandleSubscribeComplete) ASSERT_TRUE(HandleWriteReceivedCapabilitiesRequest(connObj)); ASSERT_TRUE(HandleSubscribeReceivedOnChar2(connObj)); - EXPECT_TRUE(HandleSubscribeComplete(connObj, &uuidSvc, &uuidChar2)); + EXPECT_TRUE(HandleSubscribeComplete(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID)); } TEST_F(TestBleLayer, HandleUnsubscribeReceivedInvalidUUID) { auto connObj = GetConnectionObject(); EXPECT_FALSE(HandleUnsubscribeReceived(connObj, &uuidZero, &uuidZero)); - EXPECT_FALSE(HandleUnsubscribeReceived(connObj, &uuidSvc, &uuidChar1)); + EXPECT_FALSE(HandleUnsubscribeReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID)); } TEST_F(TestBleLayer, HandleUnsubscribeReceived) @@ -259,14 +251,14 @@ TEST_F(TestBleLayer, HandleUnsubscribeReceived) ASSERT_TRUE(HandleWriteReceivedCapabilitiesRequest(connObj)); ASSERT_TRUE(HandleSubscribeReceivedOnChar2(connObj)); - EXPECT_TRUE(HandleUnsubscribeReceived(connObj, &uuidSvc, &uuidChar2)); + EXPECT_TRUE(HandleUnsubscribeReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID)); } TEST_F(TestBleLayer, HandleUnsubscribeCompleteInvalidUUID) { auto connObj = GetConnectionObject(); EXPECT_FALSE(HandleUnsubscribeComplete(connObj, &uuidZero, &uuidZero)); - EXPECT_FALSE(HandleUnsubscribeComplete(connObj, &uuidSvc, &uuidChar1)); + EXPECT_FALSE(HandleUnsubscribeComplete(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID)); } TEST_F(TestBleLayer, HandleUnsubscribeComplete) @@ -275,7 +267,7 @@ TEST_F(TestBleLayer, HandleUnsubscribeComplete) ASSERT_TRUE(HandleWriteReceivedCapabilitiesRequest(connObj)); ASSERT_TRUE(HandleSubscribeReceivedOnChar2(connObj)); - EXPECT_TRUE(HandleUnsubscribeComplete(connObj, &uuidSvc, &uuidChar2)); + EXPECT_TRUE(HandleUnsubscribeComplete(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID)); } TEST_F(TestBleLayer, HandleWriteReceivedInvalidUUID) @@ -285,7 +277,7 @@ TEST_F(TestBleLayer, HandleWriteReceivedInvalidUUID) ASSERT_FALSE(buf.IsNull()); EXPECT_FALSE(HandleWriteReceived(connObj, &uuidZero, &uuidZero, buf.Retain())); - EXPECT_FALSE(HandleWriteReceived(connObj, &uuidSvc, &uuidChar3, std::move(buf))); + EXPECT_FALSE(HandleWriteReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_3_UUID, std::move(buf))); } TEST_F(TestBleLayer, HandleWriteReceived) @@ -300,14 +292,14 @@ TEST_F(TestBleLayer, HandleWriteReceived) auto buf = System::PacketBufferHandle::NewWithData(data, sizeof(data)); ASSERT_FALSE(buf.IsNull()); - EXPECT_TRUE(HandleWriteReceived(connObj, &uuidSvc, &uuidChar1, std::move(buf))); + EXPECT_TRUE(HandleWriteReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID, std::move(buf))); } TEST_F(TestBleLayer, HandleWriteConfirmationInvalidUUID) { auto connObj = GetConnectionObject(); EXPECT_FALSE(HandleWriteConfirmation(connObj, &uuidZero, &uuidZero)); - EXPECT_FALSE(HandleWriteConfirmation(connObj, &uuidSvc, &uuidChar2)); + EXPECT_FALSE(HandleWriteConfirmation(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID)); } TEST_F(TestBleLayer, HandleWriteConfirmationUninitialized) @@ -320,7 +312,7 @@ TEST_F(TestBleLayer, HandleWriteConfirmation) auto connObj = GetConnectionObject(); ASSERT_TRUE(HandleWriteReceivedCapabilitiesRequest(connObj)); - EXPECT_TRUE(HandleWriteConfirmation(connObj, &uuidSvc, &uuidChar1)); + EXPECT_TRUE(HandleWriteConfirmation(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID)); } TEST_F(TestBleLayer, HandleIndicationReceivedInvalidUUID) @@ -330,7 +322,7 @@ TEST_F(TestBleLayer, HandleIndicationReceivedInvalidUUID) ASSERT_FALSE(buf.IsNull()); EXPECT_FALSE(HandleIndicationReceived(connObj, &uuidZero, &uuidZero, buf.Retain())); - EXPECT_FALSE(HandleIndicationReceived(connObj, &uuidSvc, &uuidChar1, std::move(buf))); + EXPECT_FALSE(HandleIndicationReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID, std::move(buf))); } TEST_F(TestBleLayer, HandleIndicationReceived) @@ -345,14 +337,14 @@ TEST_F(TestBleLayer, HandleIndicationReceived) auto buf = System::PacketBufferHandle::NewWithData(data, sizeof(data)); ASSERT_FALSE(buf.IsNull()); - EXPECT_TRUE(HandleIndicationReceived(connObj, &uuidSvc, &uuidChar2, std::move(buf))); + EXPECT_TRUE(HandleIndicationReceived(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID, std::move(buf))); } TEST_F(TestBleLayer, HandleIndicationConfirmationInvalidUUID) { auto connObj = GetConnectionObject(); EXPECT_FALSE(HandleIndicationConfirmation(connObj, &uuidZero, &uuidZero)); - EXPECT_FALSE(HandleIndicationConfirmation(connObj, &uuidSvc, &uuidChar1)); + EXPECT_FALSE(HandleIndicationConfirmation(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID)); } TEST_F(TestBleLayer, HandleIndicationConfirmation) @@ -360,7 +352,7 @@ TEST_F(TestBleLayer, HandleIndicationConfirmation) auto connObj = GetConnectionObject(); ASSERT_TRUE(HandleWriteReceivedCapabilitiesRequest(connObj)); - EXPECT_TRUE(HandleIndicationConfirmation(connObj, &uuidSvc, &uuidChar2)); + EXPECT_TRUE(HandleIndicationConfirmation(connObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID)); } TEST_F(TestBleLayer, HandleConnectionError) diff --git a/src/ble/tests/TestBleUUID.cpp b/src/ble/tests/TestBleUUID.cpp index 4dbc6dd4c0fcdb..445535594fae4b 100644 --- a/src/ble/tests/TestBleUUID.cpp +++ b/src/ble/tests/TestBleUUID.cpp @@ -34,6 +34,9 @@ using namespace chip::Ble; namespace { +constexpr ChipBleUUID expectedUUID = { { 0x00, 0x00, 0xFF, 0xF6, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, + 0xFB } }; + TEST(TestBleUUID, CheckUUIDsMatch_NULL) { // Test that NULL pointer UUIDs are not equal @@ -43,46 +46,36 @@ TEST(TestBleUUID, CheckUUIDsMatch_NULL) TEST(TestBleUUID, CheckStringToUUID_ChipUUID) { // Test positive scenario - CHIP Service UUID - ChipBleUUID uuid; - EXPECT_TRUE(StringToUUID("0000FFF6-0000-1000-8000-00805F9B34FB", uuid)); - EXPECT_TRUE(UUIDsMatch(&uuid, &CHIP_BLE_SVC_ID)); + ChipBleUUID uuid = StringToUUIDConstexpr("0000FFF6-0000-1000-8000-00805F9B34FB"); + EXPECT_TRUE(UUIDsMatch(&uuid, &expectedUUID)); } TEST(TestBleUUID, CheckStringToUUID_ChipUUID_RandomCase) { // Test that letter case doesn't matter - ChipBleUUID uuid; - EXPECT_TRUE(StringToUUID("0000FfF6-0000-1000-8000-00805f9B34Fb", uuid)); - EXPECT_TRUE(UUIDsMatch(&uuid, &CHIP_BLE_SVC_ID)); + ChipBleUUID uuid = StringToUUIDConstexpr("0000FfF6-0000-1000-8000-00805f9B34Fb"); + EXPECT_TRUE(UUIDsMatch(&uuid, &expectedUUID)); } TEST(TestBleUUID, CheckStringToUUID_ChipUUID_NoSeparators) { // Test that separators don't matter - ChipBleUUID uuid; - EXPECT_TRUE(StringToUUID("0000FFF600001000800000805F9B34FB", uuid)); - EXPECT_TRUE(UUIDsMatch(&uuid, &CHIP_BLE_SVC_ID)); + ChipBleUUID uuid = StringToUUIDConstexpr("0000FFF600001000800000805F9B34FB"); + EXPECT_TRUE(UUIDsMatch(&uuid, &expectedUUID)); } TEST(TestBleUUID, CheckStringToUUID_TooLong) { // Test that even one more digit is too much - ChipBleUUID uuid; - EXPECT_FALSE(StringToUUID("0000FFF600001000800000805F9B34FB0", uuid)); -} - -TEST(TestBleUUID, CheckStringToUUID_TooShort) -{ - // Test that even one less digit is too little - ChipBleUUID uuid; - EXPECT_FALSE(StringToUUID("0000FFF600001000800000805F9B34F", uuid)); + auto result = StringToUUID("0000FFF600001000800000805F9B34FB0"); + EXPECT_FALSE(result.first); } TEST(TestBleUUID, CheckStringToUUID_InvalidChar) { // Test that non-hex digits don't pass - ChipBleUUID uuid; - EXPECT_FALSE(StringToUUID("0000GFF6-0000-1000-8000-00805F9B34FB0", uuid)); + auto result = StringToUUID("0000GFF6-0000-1000-8000-00805F9B34FB"); + EXPECT_FALSE(result.first); } } // namespace diff --git a/src/platform/Linux/bluez/BluezConnection.cpp b/src/platform/Linux/bluez/BluezConnection.cpp index eeb1e7fb8f1343..6ed15b5bb7cb45 100644 --- a/src/platform/Linux/bluez/BluezConnection.cpp +++ b/src/platform/Linux/bluez/BluezConnection.cpp @@ -94,7 +94,7 @@ CHIP_ERROR BluezConnection::Init(const BluezEndpoint & aEndpoint) if (service != nullptr) { if ((BluezIsServiceOnDevice(service, mDevice.get())) == TRUE && - (strcmp(bluez_gatt_service1_get_uuid(service), CHIP_BLE_UUID_SERVICE_STRING) == 0)) + (strcmp(bluez_gatt_service1_get_uuid(service), Ble::CHIP_BLE_SERVICE_LONG_UUID_STR) == 0)) { mService.reset(service); break; @@ -111,18 +111,18 @@ CHIP_ERROR BluezConnection::Init(const BluezEndpoint & aEndpoint) if (char1 != nullptr) { if ((BluezIsCharOnService(char1, mService.get()) == TRUE) && - (strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C1_STRING) == 0)) + (strcmp(bluez_gatt_characteristic1_get_uuid(char1), Ble::CHIP_BLE_CHAR_1_UUID_STR) == 0)) { mC1.reset(char1); } else if ((BluezIsCharOnService(char1, mService.get()) == TRUE) && - (strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C2_STRING) == 0)) + (strcmp(bluez_gatt_characteristic1_get_uuid(char1), Ble::CHIP_BLE_CHAR_2_UUID_STR) == 0)) { mC2.reset(char1); } #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING else if ((BluezIsCharOnService(char1, mService.get()) == TRUE) && - (strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C3_STRING) == 0)) + (strcmp(bluez_gatt_characteristic1_get_uuid(char1), Ble::CHIP_BLE_CHAR_3_UUID_STR) == 0)) { mC3.reset(char1); } diff --git a/src/platform/Linux/bluez/BluezEndpoint.cpp b/src/platform/Linux/bluez/BluezEndpoint.cpp index 151c09e09f662d..55b127e1b17014 100644 --- a/src/platform/Linux/bluez/BluezEndpoint.cpp +++ b/src/platform/Linux/bluez/BluezEndpoint.cpp @@ -438,10 +438,10 @@ void BluezEndpoint::SetupGattService() static const char * const c3_flags[] = { "read", nullptr }; #endif - mService.reset(CreateGattService(CHIP_BLE_UUID_SERVICE_SHORT_STRING)); + mService.reset(CreateGattService(Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR)); // C1 characteristic - mC1.reset(CreateGattCharacteristic(mService.get(), "c1", CHIP_PLAT_BLE_UUID_C1_STRING, c1_flags)); + mC1.reset(CreateGattCharacteristic(mService.get(), "c1", Ble::CHIP_BLE_CHAR_1_UUID_STR, c1_flags)); g_signal_connect(mC1.get(), "handle-read-value", G_CALLBACK(+[](BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInv, GVariant * aOpt, BluezEndpoint * self) { return self->BluezCharacteristicReadValue(aChar, aInv, aOpt); }), @@ -455,7 +455,7 @@ void BluezEndpoint::SetupGattService() g_signal_connect(mC1.get(), "handle-confirm", G_CALLBACK(BluezCharacteristicConfirmError), nullptr); // C2 characteristic - mC2.reset(CreateGattCharacteristic(mService.get(), "c2", CHIP_PLAT_BLE_UUID_C2_STRING, c2_flags)); + mC2.reset(CreateGattCharacteristic(mService.get(), "c2", Ble::CHIP_BLE_CHAR_2_UUID_STR, c2_flags)); g_signal_connect(mC2.get(), "handle-read-value", G_CALLBACK(+[](BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInv, GVariant * aOpt, BluezEndpoint * self) { return self->BluezCharacteristicReadValue(aChar, aInv, aOpt); }), @@ -478,7 +478,7 @@ void BluezEndpoint::SetupGattService() #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING ChipLogDetail(DeviceLayer, "CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING is TRUE"); // Additional data characteristics - mC3.reset(CreateGattCharacteristic(mService.get(), "c3", CHIP_PLAT_BLE_UUID_C3_STRING, c3_flags)); + mC3.reset(CreateGattCharacteristic(mService.get(), "c3", Ble::CHIP_BLE_CHAR_3_UUID_STR, c3_flags)); g_signal_connect(mC3.get(), "handle-read-value", G_CALLBACK(+[](BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInv, GVariant * aOpt, BluezEndpoint * self) { return self->BluezCharacteristicReadValue(aChar, aInv, aOpt); }), diff --git a/src/platform/Linux/bluez/ChipDeviceScanner.cpp b/src/platform/Linux/bluez/ChipDeviceScanner.cpp index dcb113b7f479c9..3323f1e7da57af 100644 --- a/src/platform/Linux/bluez/ChipDeviceScanner.cpp +++ b/src/platform/Linux/bluez/ChipDeviceScanner.cpp @@ -42,7 +42,7 @@ bool BluezGetChipDeviceInfo(BluezDevice1 & aDevice, chip::Ble::ChipBLEDeviceIden GVariant * serviceData = bluez_device1_get_service_data(&aDevice); VerifyOrReturnError(serviceData != nullptr, false); - GAutoPtr dataValue(g_variant_lookup_value(serviceData, CHIP_BLE_UUID_SERVICE_STRING, nullptr)); + GAutoPtr dataValue(g_variant_lookup_value(serviceData, Ble::CHIP_BLE_SERVICE_LONG_UUID_STR, nullptr)); VerifyOrReturnError(dataValue != nullptr, false); size_t dataLen = 0; diff --git a/src/platform/Linux/bluez/Types.h b/src/platform/Linux/bluez/Types.h index 95fd669efc1226..4bd2c89d9a7966 100644 --- a/src/platform/Linux/bluez/Types.h +++ b/src/platform/Linux/bluez/Types.h @@ -110,18 +110,6 @@ namespace Internal { #define ADVERTISING_INTERFACE BLUEZ_INTERFACE ".LEAdvertisement1" #define DEVICE_INTERFACE BLUEZ_INTERFACE ".Device1" -#define CHIP_PLAT_BLE_UUID_C1_STRING "18ee2ef5-263d-4559-959f-4f9c429f9d11" -#define CHIP_PLAT_BLE_UUID_C2_STRING "18ee2ef5-263d-4559-959f-4f9c429f9d12" -#define CHIP_PLAT_BLE_UUID_C3_STRING "64630238-8772-45F2-B87D-748A83218F04" - -#define CHIP_BLE_BASE_SERVICE_UUID_STRING "-0000-1000-8000-00805f9b34fb" -#define CHIP_BLE_SERVICE_PREFIX_LENGTH 8 -#define CHIP_BLE_BASE_SERVICE_PREFIX "0000" -#define CHIP_BLE_UUID_SERVICE_SHORT_STRING "fff6" - -#define CHIP_BLE_UUID_SERVICE_STRING \ - CHIP_BLE_BASE_SERVICE_PREFIX CHIP_BLE_UUID_SERVICE_SHORT_STRING CHIP_BLE_BASE_SERVICE_UUID_STRING - #define BLUEZ_ADV_TYPE_FLAGS 0x01 #define BLUEZ_ADV_TYPE_SERVICE_DATA 0x16 diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index a78efd9c944cce..944447d2e759df 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -74,14 +74,6 @@ namespace Internal { namespace { -/* CHIPoBLE UUID strings */ -constexpr char chip_ble_service_uuid[] = "0000FFF6-0000-1000-8000-00805F9B34FB"; -constexpr char chip_ble_char_c1_tx_uuid[] = "18EE2EF5-263D-4559-959F-4F9C429F9D11"; -constexpr char chip_ble_char_c2_rx_uuid[] = "18EE2EF5-263D-4559-959F-4F9C429F9D12"; - -constexpr char chip_ble_desc_uuid_short[] = "2902"; -constexpr char chip_ble_service_uuid_short[] = "FFF6"; - constexpr System::Clock::Timeout kNewConnectionScanTimeout = System::Clock::Seconds16(20); constexpr System::Clock::Timeout kConnectTimeout = System::Clock::Seconds16(20); constexpr System::Clock::Timeout kFastAdvertiseTimeout = @@ -582,12 +574,12 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_create() failed: %s", get_error_message(ret))); // Create Service (BTP Service) - ret = bt_gatt_service_create(chip_ble_service_uuid, BT_GATT_SERVICE_TYPE_PRIMARY, &service); + ret = bt_gatt_service_create(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR, BT_GATT_SERVICE_TYPE_PRIMARY, &service); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_service_create() failed: %s", get_error_message(ret))); // Create 1st Characteristic (Client TX Buffer) ret = bt_gatt_characteristic_create( - chip_ble_char_c1_tx_uuid, BT_GATT_PERMISSION_WRITE, + Ble::CHIP_BLE_CHAR_1_UUID_STR, BT_GATT_PERMISSION_WRITE, BT_GATT_PROPERTY_WRITE, // Write Request is not coming if we use WITHOUT_RESPONSE property. Let's use WRITE property and // consider to use WITHOUT_RESPONSE property in the future according to the CHIP Spec 4.16.3.2. BTP // GATT Service @@ -611,7 +603,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() ChipLogError(DeviceLayer, "bt_gatt_service_add_characteristic() failed: %s", get_error_message(ret))); // Create 2nd Characteristic (Client RX Buffer) - ret = bt_gatt_characteristic_create(chip_ble_char_c2_rx_uuid, BT_GATT_PERMISSION_READ, + ret = bt_gatt_characteristic_create(Ble::CHIP_BLE_CHAR_2_UUID_STR, BT_GATT_PERMISSION_READ, BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_INDICATE, "CHIPoBLE_C2", strlen("CHIPoBLE_C2"), &char2); VerifyOrExit(ret == BT_ERROR_NONE, @@ -637,8 +629,8 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() get_error_message(ret))); // Create CCC Descriptor - ret = bt_gatt_descriptor_create(chip_ble_desc_uuid_short, BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE, desc_value, - sizeof(desc_value), &desc); + ret = bt_gatt_descriptor_create(Ble::CHIP_BLE_DESC_SHORT_UUID_STR, BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE, + desc_value, sizeof(desc_value), &desc); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_descriptor_create() failed: %s", get_error_message(ret))); ret = bt_gatt_characteristic_add_descriptor(char2, desc); VerifyOrExit(ret == BT_ERROR_NONE, @@ -711,7 +703,8 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising() VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "GetBLEDeviceIdentificationInfo() failed: %" CHIP_ERROR_FORMAT, err.Format())); - ret = bt_adapter_le_add_advertising_service_data(mAdvertiser, BT_ADAPTER_LE_PACKET_ADVERTISING, chip_ble_service_uuid_short, + ret = bt_adapter_le_add_advertising_service_data(mAdvertiser, BT_ADAPTER_LE_PACKET_ADVERTISING, + Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR, reinterpret_cast(&deviceIdInfo), sizeof(deviceIdInfo)); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_adapter_le_add_advertising_service_data() failed: %s", get_error_message(ret))); @@ -779,12 +772,12 @@ static bool __GattClientForeachCharCb(int total, int index, bt_gatt_h charHandle VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from CHAR handle: %s", get_error_message(ret))); - if (strcasecmp(uuid.get(), chip_ble_char_c1_tx_uuid) == 0) + if (strcasecmp(uuid.get(), Ble::CHIP_BLE_CHAR_1_UUID_STR) == 0) { ChipLogProgress(DeviceLayer, "CHIP Char C1 TX Found [%s]", StringOrNullMarker(uuid.get())); conn->gattCharC1Handle = charHandle; } - else if (strcasecmp(uuid.get(), chip_ble_char_c2_rx_uuid) == 0) + else if (strcasecmp(uuid.get(), Ble::CHIP_BLE_CHAR_2_UUID_STR) == 0) { ChipLogProgress(DeviceLayer, "CHIP Char C2 RX Found [%s]", StringOrNullMarker(uuid.get())); conn->gattCharC2Handle = charHandle; @@ -806,7 +799,7 @@ static bool __GattClientForeachServiceCb(int total, int index, bt_gatt_h svcHand VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from SVC handle: %s", get_error_message(ret))); - if (strcasecmp(uuid.get(), chip_ble_service_uuid) == 0) + if (strcasecmp(uuid.get(), chip::Ble::CHIP_BLE_SERVICE_LONG_UUID_STR) == 0) { ChipLogProgress(DeviceLayer, "CHIP Service UUID Found [%s]", StringOrNullMarker(uuid.get())); @@ -1142,36 +1135,21 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv } break; case DeviceEventType::kPlatformTizenBLEWriteComplete: { - Ble::ChipBleUUID service_uuid; - Ble::ChipBleUUID char_write_uuid; - - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c1_tx_uuid, char_write_uuid); - - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &service_uuid, &char_write_uuid); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; } case DeviceEventType::kPlatformTizenBLESubscribeOpComplete: { - Ble::ChipBleUUID service_uuid; - Ble::ChipBleUUID char_notif_uuid; - - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c2_rx_uuid, char_notif_uuid); - if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) - HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &service_uuid, &char_notif_uuid); + HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, + &chip::Ble::CHIP_BLE_CHAR_2_UUID); else - HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &service_uuid, &char_notif_uuid); + HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, + &chip::Ble::CHIP_BLE_CHAR_2_UUID); break; } case DeviceEventType::kPlatformTizenBLEIndicationReceived: { - Ble::ChipBleUUID service_uuid; - Ble::ChipBleUUID char_notif_uuid; - - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c2_rx_uuid, char_notif_uuid); - - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &service_uuid, &char_notif_uuid, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &Ble::CHIP_BLE_SVC_ID, + &chip::Ble::CHIP_BLE_CHAR_2_UUID, System::PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; } @@ -1182,43 +1160,29 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) { - Ble::ChipBleUUID service_uuid; - Ble::ChipBleUUID char_notification_uuid; - Ble::ChipBleUUID char_write_uuid; - switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: ChipLogProgress(DeviceLayer, "CHIPoBLESubscribe"); - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c2_rx_uuid, char_notification_uuid); - - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &service_uuid, &char_notification_uuid); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); NotifyBLEConnectionEstablished(event->CHIPoBLESubscribe.ConId, CHIP_NO_ERROR); break; case DeviceEventType::kCHIPoBLEUnsubscribe: ChipLogProgress(DeviceLayer, "CHIPoBLEUnsubscribe"); - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c2_rx_uuid, char_notification_uuid); - - HandleUnsubscribeReceived(event->CHIPoBLESubscribe.ConId, &service_uuid, &char_notification_uuid); + HandleUnsubscribeReceived(event->CHIPoBLESubscribe.ConId, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: ChipLogProgress(DeviceLayer, "CHIPoBLEWriteReceived"); - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c1_tx_uuid, char_write_uuid); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &service_uuid, &char_write_uuid, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, System::PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: ChipLogProgress(DeviceLayer, "CHIPoBLEIndicateConfirm"); - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c2_rx_uuid, char_notification_uuid); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &service_uuid, &char_notification_uuid); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: ChipLogProgress(DeviceLayer, "CHIPoBLEConnectionError"); @@ -1241,19 +1205,14 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId) { - Ble::ChipBleUUID service_uuid; - Ble::ChipBleUUID char_notif_uuid; int ret; ChipLogProgress(DeviceLayer, "SubscribeCharacteristic"); - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c2_rx_uuid, char_notif_uuid); - VerifyOrExit(conId != nullptr, ChipLogError(DeviceLayer, "Invalid Connection")); - VerifyOrExit(Ble::UUIDsMatch(svcId, &service_uuid), + VerifyOrExit(Ble::UUIDsMatch(svcId, &Ble::CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &char_notif_uuid), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->gattCharC2Handle != nullptr, ChipLogError(DeviceLayer, "Char C2 is null")); @@ -1274,19 +1233,14 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId) { - Ble::ChipBleUUID service_uuid; - Ble::ChipBleUUID char_notif_uuid; int ret; ChipLogProgress(DeviceLayer, "UnSubscribeCharacteristic"); - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c2_rx_uuid, char_notif_uuid); - VerifyOrExit(conId != nullptr, ChipLogError(DeviceLayer, "Invalid Connection")); - VerifyOrExit(Ble::UUIDsMatch(svcId, &service_uuid), + VerifyOrExit(Ble::UUIDsMatch(svcId, &Ble::CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "UnSubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &char_notif_uuid), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "UnSubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->gattCharC2Handle != nullptr, ChipLogError(DeviceLayer, "Char C2 is null")); @@ -1360,19 +1314,14 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::Chip bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, System::PacketBufferHandle pBuf) { - Ble::ChipBleUUID service_uuid; - Ble::ChipBleUUID char_write_uuid; int ret; ChipLogProgress(DeviceLayer, "SendWriteRequest"); - StringToUUID(chip_ble_service_uuid, service_uuid); - StringToUUID(chip_ble_char_c1_tx_uuid, char_write_uuid); - VerifyOrExit(conId != nullptr, ChipLogError(DeviceLayer, "Invalid Connection")); - VerifyOrExit(Ble::UUIDsMatch(svcId, &service_uuid), + VerifyOrExit(Ble::UUIDsMatch(svcId, &Ble::CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &char_write_uuid), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid characteristic ID")); VerifyOrExit(conId->gattCharC1Handle != nullptr, ChipLogError(DeviceLayer, "Char C1 is null")); @@ -1455,7 +1404,7 @@ void BLEManagerImpl::InitiateScan(BleScanState scanType) } /* Send StartChipScan Request to Scanner Class */ - strcpy(data.service_uuid, chip_ble_service_uuid_short); + strcpy(data.service_uuid, Ble::CHIP_BLE_DESC_SHORT_UUID_STR); err = mDeviceScanner->StartChipScan(kNewConnectionScanTimeout, ScanFilterType::kServiceData, data); VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Failed to start BLE scan")); diff --git a/src/platform/Tizen/ChipDeviceScanner.cpp b/src/platform/Tizen/ChipDeviceScanner.cpp index aea5aabd7d0799..2b022f537d79b9 100644 --- a/src/platform/Tizen/ChipDeviceScanner.cpp +++ b/src/platform/Tizen/ChipDeviceScanner.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -40,10 +41,6 @@ namespace chip { namespace DeviceLayer { namespace Internal { -// CHIPoBLE UUID strings -const char chip_service_uuid[] = "0000FFF6-0000-1000-8000-00805F9B34FB"; -const char chip_service_uuid_short[] = "FFF6"; - ChipDeviceScanner::ChipDeviceScanner(ChipDeviceScannerDelegate * delegate) : mDelegate(delegate) {} ChipDeviceScanner::~ChipDeviceScanner() @@ -100,8 +97,8 @@ static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, { for (int i = 0; i < count; i++) { - if (g_strcmp0(dataList[i].service_uuid, chip_service_uuid) == 0 || - g_strcmp0(dataList[i].service_uuid, chip_service_uuid_short) == 0) + if (g_strcmp0(dataList[i].service_uuid, chip::Ble::CHIP_BLE_CHAR_1_UUID_STR) == 0 || + g_strcmp0(dataList[i].service_uuid, chip::Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR) == 0) { ChipLogProgress(DeviceLayer, "CHIP Thing Device Found! [Service Data UUID] = %s", dataList[i].service_uuid); // Print full Service Data From 17c5a0029e5a374be3c21ec4bf9ab22d5ff7710b Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 30 May 2024 22:41:35 +0200 Subject: [PATCH 010/162] [Python] Remove obsolete callback handling (#33665) The Call() function currently still has some callback handling code the completeEvent and callbackRes variables. These are only used when callbacks are in play, like pychip_DeviceController_Commission or pychip_DeviceController_OpenCommissioningWindow. When calling these functions CallAsyncWithCompleteCallback() needs to be used (and is beeing used in all cases). In practice, on single threaded applications this is not a problem. However, when calling the SDK from multiple threads, then another Call() Might accidentally release a call to CallAsyncWithCompleteCallback() early. --- src/controller/python/chip/ChipStack.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index 35f9e24ef4db25..3a167bb6bc0a7a 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -32,8 +32,7 @@ import os import sys import time -from ctypes import (CFUNCTYPE, POINTER, Structure, c_bool, c_char_p, c_int64, c_uint8, c_uint16, c_uint32, c_ulong, c_void_p, - py_object, pythonapi) +from ctypes import CFUNCTYPE, Structure, c_bool, c_char_p, c_int64, c_uint8, c_uint16, c_uint32, c_void_p, py_object, pythonapi from threading import Condition, Event, Lock import chip.native @@ -194,9 +193,6 @@ def __call__(self): pythonapi.Py_DecRef(py_object(self)) -_CompleteFunct = CFUNCTYPE(None, c_void_p, c_void_p) -_ErrorFunct = CFUNCTYPE(None, c_void_p, c_void_p, - c_ulong, POINTER(DeviceStatusStruct)) _LogMessageFunct = CFUNCTYPE( None, c_int64, c_int64, c_char_p, c_uint8, c_char_p) _ChipThreadTaskRunnerFunct = CFUNCTYPE(None, py_object) @@ -272,21 +268,11 @@ def __init__(self, persistentStoragePath: str, installDefaultLogHandler=True, self.logger.addHandler(logHandler) self.logger.setLevel(logging.DEBUG) - def HandleComplete(appState, reqState): - self.callbackRes = True - self.completeEvent.set() - - def HandleError(appState, reqState, err, devStatusPtr): - self.callbackRes = self.ErrorToException(err, devStatusPtr) - self.completeEvent.set() - @_ChipThreadTaskRunnerFunct def HandleChipThreadRun(callback): callback() self.cbHandleChipThreadRun = HandleChipThreadRun - self.cbHandleComplete = _CompleteFunct(HandleComplete) - self.cbHandleError = _ErrorFunct(HandleError) # set by other modules(BLE) that require service by thread while thread blocks. self.blockingCB = None @@ -389,15 +375,9 @@ def Call(self, callFunct, timeoutMs: int = None): This function is a wrapper of PostTaskOnChipThread, which includes some handling of application specific logics. Calling this function on CHIP on CHIP mainloop thread will cause deadlock. ''' - # throw error if op in progress - self.callbackRes = None - self.completeEvent.clear() # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. with self.networkLock: res = self.PostTaskOnChipThread(callFunct).Wait(timeoutMs) - self.completeEvent.set() - if res == 0 and self.callbackRes is not None: - return self.callbackRes return res async def CallAsync(self, callFunct, timeoutMs: int = None): From 452cad3a36197d299660adb6b50d7a89041c7657 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Thu, 30 May 2024 15:42:19 -0700 Subject: [PATCH 011/162] [chip-tool][ICD]Remove icd entry in icd client storage after unregisterClient in ICDManagemenet is triggered (#33671) * Remove icd entry in icd client storage after unregisterClient is triggered * Restyled by clang-format * address comments * Update ModelCommand.cpp * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../chip-tool/commands/clusters/ClusterCommand.h | 16 +++++++++++++++- .../chip-tool/commands/clusters/ModelCommand.cpp | 9 +++++++++ .../chip-tool/commands/clusters/ModelCommand.h | 2 ++ .../commands/clusters/ModelCommand.cpp | 5 +++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/examples/chip-tool/commands/clusters/ClusterCommand.h b/examples/chip-tool/commands/clusters/ClusterCommand.h index 792588a886dffb..171c664481c9dd 100644 --- a/examples/chip-tool/commands/clusters/ClusterCommand.h +++ b/examples/chip-tool/commands/clusters/ClusterCommand.h @@ -55,6 +55,15 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub return InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value); } + CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, + chip::CommandId commandId, + const chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type & value) + { + ReturnErrorOnFailure(InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value)); + mScopedNodeId = chip::ScopedNodeId(value.checkInNodeID, device->GetSecureSession().Value()->GetFabricIndex()); + return CHIP_NO_ERROR; + } + CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::CommandId commandId, const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type & value) @@ -109,6 +118,11 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub return; } } + if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) && + (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id)) + { + ModelCommand::ClearICDEntry(mScopedNodeId); + } } virtual void OnError(const chip::app::CommandSender * client, CHIP_ERROR error) override @@ -208,7 +222,7 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub private: chip::ClusterId mClusterId; chip::CommandId mCommandId; - + chip::ScopedNodeId mScopedNodeId; CHIP_ERROR mError = CHIP_NO_ERROR; CustomArgument mPayload; }; diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index 94b2b36c5538a3..2a549e62d4668b 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -76,6 +76,15 @@ void ModelCommand::Shutdown() CHIPCommand::Shutdown(); } +void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId) +{ + CHIP_ERROR deleteEntryError = CHIPCommand::sICDClientStorage.DeleteEntry(nodeId); + if (deleteEntryError != CHIP_NO_ERROR) + { + ChipLogError(chipTool, "Failed to delete ICD entry: %" CHIP_ERROR_FORMAT, deleteEntryError.Format()); + } +} + void ModelCommand::CheckPeerICDType() { if (mIsPeerLIT.HasValue()) diff --git a/examples/chip-tool/commands/clusters/ModelCommand.h b/examples/chip-tool/commands/clusters/ModelCommand.h index d4e8eac613f468..79c31cf865930d 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.h +++ b/examples/chip-tool/commands/clusters/ModelCommand.h @@ -67,6 +67,8 @@ class ModelCommand : public CHIPCommand virtual CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) { return CHIP_ERROR_BAD_REQUEST; }; + virtual void ClearICDEntry(const chip::ScopedNodeId & nodeId); + void Shutdown() override; protected: diff --git a/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp b/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp index 1210af574603f4..dafa11f2381fed 100644 --- a/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp +++ b/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp @@ -82,6 +82,11 @@ void ModelCommand::Shutdown() mOnDeviceConnectionFailureCallback.Cancel(); } +void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId) +{ + ChipLogError(chipTool, "ClearICDEntry is not implemented in tv-casting-app"); +} + bool ModelCommand::IsPeerLIT() { // Does not support tv-casting-app From 55012bfe697b147677b841052ce7a6a3d3b12733 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 30 May 2024 19:34:18 -0400 Subject: [PATCH 012/162] Stop using human-readable release names in Darwin availability.yaml. (#33677) People are making assumptions based on those, and those assumptions will come back to bite them. Just switch to using UUIDs for the release names. --- .../CHIP/templates/MTRBaseClusters-src.zapt | 8 +-- .../CHIP/templates/MTRBaseClusters.zapt | 42 ++++++++-------- .../CHIP/templates/MTRClusterConstants.zapt | 50 +++++++++---------- .../CHIP/templates/MTRClusters-src.zapt | 6 +-- .../Framework/CHIP/templates/MTRClusters.zapt | 22 ++++---- .../templates/MTRCommandPayloadsObjc-src.zapt | 6 +-- .../templates/MTRCommandPayloadsObjc.zapt | 4 +- .../CHIP/templates/availability.yaml | 18 +++---- 8 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt index 9d6e786ce03149..0b8529b9c566c5 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt @@ -116,7 +116,7 @@ MTR{{cluster}}Cluster{{command}}Params {{! This is used as the implementation for both the new-name and old-name bits, so check for both here. }} {{#if (or (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)) (and (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) - (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name))))}} + (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name))))}} {{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} - (void)read{{>attribute}}With {{~#if_is_fabric_scoped_struct type~}} @@ -223,7 +223,7 @@ reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value {{/if}} {{/unless}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name)) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping name)) (isSupported (compatClusterNameRemapping name)))}} @implementation MTRBaseCluster{{compatClusterNameRemapping name}} (Deprecated) @@ -231,7 +231,7 @@ reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value {{#if (is_str_equal source 'client')}} {{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} {{#*inline "commandImpl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" cluster command=command) (isSupported cluster command=command))}} - (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler { @@ -268,7 +268,7 @@ reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value {{/zcl_commands}} {{#zcl_attributes_server removeKeys='isOptional'}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)))}} {{#*inline "attribute"}}Attribute{{compatAttributeNameRemapping parent.name name}}{{/inline}} - (void)read{{>attribute}}With diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt index 7488fda7019126..35d09c0f916431 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt @@ -29,20 +29,20 @@ NS_ASSUME_NONNULL_BEGIN * * {{description}} */ -- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="First major API revamp"}}; +- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; {{#unless commandHasRequiredField}} - (void){{asLowerCamelCase name}}WithCompletion:({{>command_completion_type command=.}})completion {{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} {{#if (and (isStrEqual command "KeySetReadAllIndices") (isStrEqual cluster "GroupKeyManagement"))}} -{{availability cluster command=command minimalRelease="Fall 2023"}}; +{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691"}}; {{else}} {{#if (isInConfigList (concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true)) "LegacyCommandsWithOnlyOptionalArguments")}} -{{availability cluster command=command minimalRelease="Early 2024"}}; +{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A"}}; {{else}} -{{availability cluster command=command minimalRelease="First major API revamp"}}; +{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; {{/if}} {{/if}} {{/unless}} @@ -62,16 +62,16 @@ NS_ASSUME_NONNULL_BEGIN {{~else~}} Completion: {{~/if_is_fabric_scoped_struct~}} -(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; +(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; {{#if (or isWritableAttribute (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; +- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; +- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; {{/if}} {{#if isReportableAttribute}} - (void) subscribe{{>attribute}}WithParams:(MTRSubscribeParams *)params -subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; -+ (void) read{{>attribute}}WithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; +subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; ++ (void) read{{>attribute}}WithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; {{/if}} {{/if}} {{/zcl_attributes_server}} @@ -89,7 +89,7 @@ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptio */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID - queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; + queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; @end {{/if}} @@ -207,22 +207,22 @@ typedef NS_OPTIONS({{asUnderlyingZclType name}}, {{objCEnumName clusterName bitm {{/zcl_clusters}} {{#zcl_clusters}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name)) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping name)) (isSupported (compatClusterNameRemapping name)))}} @interface MTRBaseCluster{{compatClusterNameRemapping name}} (Deprecated) - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(uint16_t)endpoint - queue:(dispatch_queue_t)queue {{availability (compatClusterNameRemapping name) deprecatedRelease="First major API revamp" deprecationMessage="Please use initWithDevice:endpointID:queue:"}}; + queue:(dispatch_queue_t)queue {{availability (compatClusterNameRemapping name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="Please use initWithDevice:endpointID:queue:"}}; {{#zcl_commands}} {{#if (is_str_equal source 'client')}} {{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} {{#*inline "commandDecl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" cluster command=command) (isSupported cluster command=command))}} - (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler - {{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithParams:completion:")}}; + {{availability cluster command=command deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithParams:completion:")}}; {{#unless commandHasRequiredField}} {{! No need for these backwards-compat APIs for commands that never shipped them. }} {{#unless (isInConfigList @@ -232,7 +232,7 @@ typedef NS_OPTIONS({{asUnderlyingZclType name}}, {{objCEnumName clusterName bitm {{#unless (and (isStrEqual cluster "GroupKeyManagement") (isStrEqual command "KeySetReadAllIndices"))}} - (void){{asLowerCamelCase command}}WithCompletionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler - {{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithCompletion:")}}; + {{availability cluster command=command deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithCompletion:")}}; {{/unless}} {{/unless}} {{/unless}} @@ -244,7 +244,7 @@ typedef NS_OPTIONS({{asUnderlyingZclType name}}, {{objCEnumName clusterName bitm {{/zcl_commands}} {{#zcl_attributes_server removeKeys='isOptional'}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)))}} {{#*inline "attribute"}}Attribute{{compatAttributeNameRemapping parent.name name}}{{/inline}} - (void)read{{>attribute}}With @@ -253,17 +253,17 @@ typedef NS_OPTIONS({{asUnderlyingZclType name}}, {{objCEnumName clusterName bitm {{~else~}} CompletionHandler: {{~/if_is_fabric_scoped_struct~}} -(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" fabricScopedDeprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams:completion:") nonFabricScopedDeprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithCompletion:") type=type}}; +(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" fabricScopedDeprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams:completion:") nonFabricScopedDeprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithCompletion:") type=type}}; {{#if (or isWritableAttribute (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value completionHandler:(MTRStatusCompletion)completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue:completion:")}}; -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue:params:completion:")}}; +- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value completionHandler:(MTRStatusCompletion)completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue:completion:")}}; +- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue:params:completion:")}}; {{/if}} {{#if isReportableAttribute}} - (void) subscribe{{>attribute}}WithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval params:(MTRSubscribeParams * _Nullable)params -subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use subscribeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams:subscriptionEstablished:")}}; -+ (void) read{{>attribute}}WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithAttributeCache:endpoint:queue:completion:")}}; +subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use subscribeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams:subscriptionEstablished:")}}; ++ (void) read{{>attribute}}WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithAttributeCache:endpoint:queue:completion:")}}; {{/if}} {{/if}} {{/zcl_attributes_server}} diff --git a/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt b/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt index ba2e57a45bc491..98d6d6b35431b1 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt @@ -7,15 +7,15 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { {{#zcl_clusters}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name) isForIds=true) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping name) isForIds=true) (isSupported (compatClusterNameRemapping name) isForIds=true))}} -MTRCluster{{compatClusterNameRemapping label}}ID {{availability (compatClusterNameRemapping name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use MTRClusterIDType" (asUpperCamelCase label preserveAcronyms=true) "ID") isForIds=true}} = {{asMEI manufacturerCode code}}, +MTRCluster{{compatClusterNameRemapping label}}ID {{availability (compatClusterNameRemapping name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use MTRClusterIDType" (asUpperCamelCase label preserveAcronyms=true) "ID") isForIds=true}} = {{asMEI manufacturerCode code}}, {{/if}} {{/zcl_clusters}} {{#zcl_clusters}} {{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} {{~#*inline "cluster"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} -MTRClusterIDType{{>cluster}}ID {{availability (asUpperCamelCase label preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true deprecationMessage=(concat "The " (asUpperCamelCase label preserveAcronyms=true) " cluster will be removed")}} = {{asMEI manufacturerCode code}}, +MTRClusterIDType{{>cluster}}ID {{availability (asUpperCamelCase label preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" isForIds=true deprecationMessage=(concat "The " (asUpperCamelCase label preserveAcronyms=true) " cluster will be removed")}} = {{asMEI manufacturerCode code}}, {{/if}} {{/zcl_clusters}} }; @@ -26,7 +26,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { // Deprecated global attribute names {{#zcl_attributes_server}} {{#unless clusterRef}} -{{#if (wasIntroducedBeforeRelease "First major API revamp" "" globalAttribute=(asUpperCamelCase label) isForIds=true)}} +{{#if (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" "" globalAttribute=(asUpperCamelCase label) isForIds=true)}} MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID {{availability "" api="Deprecated global attribute names" deprecationMessage=(concat "Please use MTRAttributeIDTypeGlobalAttribute" (asUpperCamelCase label) "ID") isForIds=true}} = {{asMEI manufacturerCode code}}, @@ -39,7 +39,7 @@ MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID {{~#*inline "attribute"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} {{#unless clusterRef}} {{#if (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} -MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID {{availability "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true}} = {{asMEI manufacturerCode code}}, +MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID {{availability "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" isForIds=true}} = {{asMEI manufacturerCode code}}, {{/if}} {{/unless}} {{/zcl_attributes_server}} @@ -48,7 +48,7 @@ MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID {{availability "" globalAttrib {{#*inline "attributeIDs"}} {{#zcl_attributes_server}} {{#first}} -{{#if (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) isForIds=true)}} +{{#if (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping ../clusterName) isForIds=true)}} {{#if (isSupported (compatClusterNameRemapping ../clusterName) isForIds=true)}} // Cluster {{compatClusterNameRemapping ../clusterName}} deprecated attribute names {{/if}} @@ -60,14 +60,14 @@ MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID {{availability "" globalAttrib {{#if (isStrEqual (asUpperCamelCase ../clusterName) "Descriptor")}} {{#if (isStrEqual (asUpperCamelCase label) "DeviceTypeList")}} MTRClusterDescriptorAttributeDeviceTypeListID -{{availability "Descriptor" attribute="DeviceTypeList" deprecatedRelease="First major API revamp" deprecationMessage="Please use MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID" isForIds=true}} +{{availability "Descriptor" attribute="DeviceTypeList" deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="Please use MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID" isForIds=true}} = {{asMEI manufacturerCode code}}, {{/if}} {{/if}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true) (isSupported (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true))}} MTRCluster{{compatClusterNameRemapping ../clusterName}}Attribute{{compatAttributeNameRemapping ../clusterName label}}ID -{{availability (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use MTRAttributeIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Attribute" (asUpperCamelCase label preserveAcronyms=true) "ID") isForIds=true}} = +{{availability (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use MTRAttributeIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Attribute" (asUpperCamelCase label preserveAcronyms=true) "ID") isForIds=true}} = {{#if clusterRef}} {{asMEI manufacturerCode code}}, {{else}} @@ -89,20 +89,20 @@ MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID, {{#if (and (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true) (or clusterRef (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)))}} -MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID {{availability (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true deprecationMessage=(concat "The " (asUpperCamelCase label preserveAcronyms=true) " attribute will be removed")}} = +MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID {{availability (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" isForIds=true deprecationMessage=(concat "The " (asUpperCamelCase label preserveAcronyms=true) " attribute will be removed")}} = {{#if clusterRef}} {{asMEI manufacturerCode code}}, {{else}} MTRAttributeIDTypeGlobalAttribute{{asUpperCamelCase label}}ID, {{/if}} {{/if}} -{{! Anything which has an old name, and the new name was introduced in the "First after major API revamp" release or later - (or just after the "First major API revamp" release, but we don't have a good way to test for that), +{{! Anything which has an old name, and the new name was introduced in the "27C5E231-9EB5-4932-B4C1-10D88419D9CB" release or later + (or just after the "267F4B03-3256-4056-A62D-5237640FDCFE" release, but we don't have a good way to test for that), we need to generate the new-form id for the old name too, as long as it was not removed. }} {{#if (and (hasOldName (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true) - (not (wasIntroducedBeforeRelease "First after major API revamp" (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)) + (not (wasIntroducedBeforeRelease "27C5E231-9EB5-4932-B4C1-10D88419D9CB" (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)) (isSupported (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true))}} -MTRAttributeIDTypeCluster{{compatClusterNameRemapping ../clusterName}}Attribute{{compatAttributeNameRemapping ../clusterName label}}ID {{availability (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true minimalRelease="First major API revamp" deprecationMessage=(concat "Please use MTRAttributeIDType" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Attribute" (asUpperCamelCase label preserveAcronyms=true) "ID")}} = MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID, +MTRAttributeIDTypeCluster{{compatClusterNameRemapping ../clusterName}}Attribute{{compatAttributeNameRemapping ../clusterName label}}ID {{availability (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use MTRAttributeIDType" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Attribute" (asUpperCamelCase label preserveAcronyms=true) "ID")}} = MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID, {{/if}} {{#last}} @@ -121,7 +121,7 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { {{#*inline "commandIDs"}} {{#zcl_commands}} {{#first}} -{{#if (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) isForIds=true)}} +{{#if (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping ../clusterName) isForIds=true)}} {{#if (isSupported (compatClusterNameRemapping ../clusterName) isForIds=true)}} // Cluster {{compatClusterNameRemapping ../clusterName}} deprecated command id names {{/if}} @@ -129,10 +129,10 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { {{/first}} {{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} {{#*inline "commandIdDecl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command isForIds=true) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" cluster command=command isForIds=true) (isSupported cluster command=command isForIds=true))}} MTRCluster{{cluster}}Command{{command}}ID -{{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use MTRCommandIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Command" (asUpperCamelCase name preserveAcronyms=true) "ID") isForIds=true}} +{{availability cluster command=command deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use MTRCommandIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Command" (asUpperCamelCase name preserveAcronyms=true) "ID") isForIds=true}} = {{asMEI manufacturerCode code}}, {{/if}} {{/inline}} @@ -152,16 +152,16 @@ MTRCluster{{cluster}}Command{{command}}ID {{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} {{#*inline "commandIdDecl"}} {{#if (isSupported cluster command=command isForIds=true)}} -MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID {{availability cluster command=command minimalRelease="First major API revamp" isForIds=true deprecationMessage=(concat "The " command " command will be removed")}} = {{asMEI manufacturerCode code}}, +MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" isForIds=true deprecationMessage=(concat "The " command " command will be removed")}} = {{asMEI manufacturerCode code}}, {{/if}} {{/inline}} {{> commandIdDecl cluster=(asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true)}} -{{! Anything which has an old name, and the new name was introduced in the "First after major API revamp" release or later - (or just after the "First major API revamp" release, but we don't have a good way to test for that), +{{! Anything which has an old name, and the new name was introduced in the "27C5E231-9EB5-4932-B4C1-10D88419D9CB" release or later + (or just after the "267F4B03-3256-4056-A62D-5237640FDCFE" release, but we don't have a good way to test for that), we need to generate the new-form id for the old name too, as long as it was not removed. }} {{#if (and (hasOldName (asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForIds=true) - (not (wasIntroducedBeforeRelease "First after major API revamp" (asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForIds=true)) + (not (wasIntroducedBeforeRelease "27C5E231-9EB5-4932-B4C1-10D88419D9CB" (asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForIds=true)) (isSupported (compatClusterNameRemapping ../clusterName) command=(compatCommandNameRemapping ../clusterName name) isForIds=true))}} {{> commandIdDecl cluster=(compatClusterNameRemapping ../clusterName) command=(compatCommandNameRemapping ../clusterName name)}} @@ -183,16 +183,16 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { {{#*inline "eventIDs"}} {{#zcl_events}} {{#first}} -{{#if (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) isForIds=true)}} +{{#if (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping ../clusterName) isForIds=true)}} {{#if (isSupported (compatClusterNameRemapping ../clusterName))}} // Cluster {{compatClusterNameRemapping ../clusterName}} deprecated event names {{/if}} {{/if}} {{/first}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) event=(asUpperCamelCase name) isForIds=true) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping ../clusterName) event=(asUpperCamelCase name) isForIds=true) (isSupported (compatClusterNameRemapping ../clusterName) event=(asUpperCamelCase name) isForIds=true))}} MTRCluster{{compatClusterNameRemapping ../clusterName}}Event{{asUpperCamelCase name}}ID -{{availability (compatClusterNameRemapping ../clusterName) event=(asUpperCamelCase name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use MTREventIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Event" (asUpperCamelCase name preserveAcronyms=true) "ID") isForIds=true}} +{{availability (compatClusterNameRemapping ../clusterName) event=(asUpperCamelCase name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use MTREventIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Event" (asUpperCamelCase name preserveAcronyms=true) "ID") isForIds=true}} = {{asMEI manufacturerCode code}}, {{/if}} {{#last}} @@ -208,7 +208,7 @@ MTRCluster{{compatClusterNameRemapping ../clusterName}}Event{{asUpperCamelCase n {{/if}} {{/first}} {{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true) isForIds=true)}} -MTREventIDTypeCluster{{>cluster}}Event{{>event}}ID {{availability (asUpperCamelCase ../clusterName preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true}} = {{asMEI manufacturerCode code}}, +MTREventIDTypeCluster{{>cluster}}Event{{>event}}ID {{availability (asUpperCamelCase ../clusterName preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" isForIds=true}} = {{asMEI manufacturerCode code}}, {{/if}} {{#last}} diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt index c42b95e71ef9b7..c73e8aeb70d023 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt @@ -103,7 +103,7 @@ MTR{{cluster}}Cluster{{command}}Params (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true))) (or (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)) (and (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) - (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)))))}} + (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)))))}} {{#*inline "cluster"}}{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline}} {{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} - (NSDictionary * _Nullable)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params { @@ -143,7 +143,7 @@ MTR{{cluster}}Cluster{{command}}Params {{/if}} {{/unless}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name)) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping name)) (isSupported (compatClusterNameRemapping name)))}} @implementation MTRCluster{{compatClusterNameRemapping name}} (Deprecated) @@ -156,7 +156,7 @@ MTR{{cluster}}Cluster{{command}}Params {{#if (is_str_equal source 'client')}} {{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} {{#*inline "commandImpl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" cluster command=command) (isSupported cluster command=command))}} - (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler { diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters.zapt index 4ea998e04b6f86..ebcd299d0871f4 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters.zapt @@ -24,20 +24,20 @@ NS_ASSUME_NONNULL_BEGIN {{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} {{#*inline "commandDecl"}} {{#if (isSupported cluster command=command)}} -- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="First major API revamp"}}; +- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; {{#unless commandHasRequiredField}} - (void){{asLowerCamelCase name}}WithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion {{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} {{#if (and (isStrEqual command "KeySetReadAllIndices") (isStrEqual cluster "GroupKeyManagement"))}} -{{availability cluster command=command minimalRelease="Fall 2023"}}; +{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691"}}; {{else}} {{#if (isInConfigList (concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true)) "LegacyCommandsWithOnlyOptionalArguments")}} -{{availability cluster command=command minimalRelease="Early 2024"}}; +{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A"}}; {{else}} -{{availability cluster command=command minimalRelease="First major API revamp"}}; +{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; {{/if}} {{/if}} {{/unless}} @@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID - queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; + queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}}; @end @@ -104,21 +104,21 @@ NS_ASSUME_NONNULL_BEGIN {{/zcl_clusters}} {{#zcl_clusters}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name)) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping name)) (isSupported (compatClusterNameRemapping name)))}} @interface MTRCluster{{compatClusterNameRemapping name}} (Deprecated) - (nullable instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint - queue:(dispatch_queue_t)queue {{availability (compatClusterNameRemapping name) deprecatedRelease="First major API revamp" deprecationMessage="Please use initWithDevice:endpoindID:queue:"}}; + queue:(dispatch_queue_t)queue {{availability (compatClusterNameRemapping name) deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="Please use initWithDevice:endpoindID:queue:"}}; {{#zcl_commands}} {{#if (is_str_equal source 'client')}} {{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} {{#*inline "commandDecl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command) +{{#if (and (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" cluster command=command) (isSupported cluster command=command))}} -- (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler {{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithParams:expectedValues:expectedValueInterval:completion:")}}; +- (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler {{availability cluster command=command deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithParams:expectedValues:expectedValueInterval:completion:")}}; {{#unless commandHasRequiredField}} {{! No need for these backwards-compat APIs for commands that never shipped them. }} {{#unless (isInConfigList @@ -127,7 +127,7 @@ NS_ASSUME_NONNULL_BEGIN {{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} {{#unless (and (isStrEqual cluster "GroupKeyManagement") (isStrEqual command "KeySetReadAllIndices"))}} -- (void){{asLowerCamelCase command}}WithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler {{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithExpectedValues:expectedValueInterval:completion:")}}; +- (void){{asLowerCamelCase command}}WithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler {{availability cluster command=command deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithExpectedValues:expectedValueInterval:completion:")}}; {{/unless}} {{/unless}} {{/unless}} @@ -140,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN {{~#zcl_attributes_server}} {{~#*inline "attributeDecls"}} {{#unless (isStrEqual attribute (asUpperCamelCase name preserveAcronyms=true))}} -- (NSDictionary *)readAttribute{{attribute}}WithParams:(MTRReadParams * _Nullable)params {{availability cluster attribute=attribute deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams on MTRCluster" (asUpperCamelCase parent.name preserveAcronyms=true))}}; +- (NSDictionary *)readAttribute{{attribute}}WithParams:(MTRReadParams * _Nullable)params {{availability cluster attribute=attribute deprecatedRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams on MTRCluster" (asUpperCamelCase parent.name preserveAcronyms=true))}}; {{#if (or isWritableAttribute (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} - (void)writeAttribute{{attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs {{availability cluster attribute=attribute deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue on MTRCluster" (asUpperCamelCase parent.name preserveAcronyms=true))}}; diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt index 783fe2aff9555f..4179d5a905ce07 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt @@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN {{>init_struct_member label=label type=type cluster=parent.parent.name}} {{/zcl_command_arguments}} {{#if (or (isStrEqual source "client") - (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}} + (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}} _timedInvokeTimeoutMs = nil; {{/if}} {{#if (isStrEqual source "client")}} @@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN other.{{asStructPropertyName label}} = self.{{asStructPropertyName label}}; {{/zcl_command_arguments}} {{#if (or (isStrEqual source "client") - (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}} + (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}} other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; {{/if}} {{#if (isStrEqual source "client")}} @@ -210,7 +210,7 @@ NS_ASSUME_NONNULL_BEGIN {{#if (isStrEqual source "client")}} @dynamic timedInvokeTimeoutMs; @dynamic serverSideProcessingTimeout; -{{else if (wasIntroducedBeforeRelease "First major API revamp" cluster command=command)}} +{{else if (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" cluster command=command)}} @dynamic timedInvokeTimeoutMs; {{/if}} @end diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt index 686b502405a64c..6e8cfd6ff9b36d 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt @@ -55,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; {{! This is using the pre-renaming names for the isAvailableBefore test, because the pre-rename things inherit from the post-rename ones and need to have this selector.}} -{{else if (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name))}} +{{else if (wasIntroducedBeforeRelease "267F4B03-3256-4056-A62D-5237640FDCFE" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name))}} /** * Controls whether the command is a timed command (using Timed Invoke). * @@ -86,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN * schema for this command. */ - (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue - error:(NSError * __autoreleasing *)error {{availability cluster command=command deprecationMessage="This command has been removed" minimalRelease="Fall 2023"}}; + error:(NSError * __autoreleasing *)error {{availability cluster command=command deprecationMessage="This command has been removed" minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691"}}; {{/if}} @end {{/if}} diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 97199ad7bda19a..637f92de14f824 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -72,7 +72,7 @@ # "provisional" to make sure all the things that should have # been omitted have been. -- release: "Initial release" +- release: "0E17B7EB-314F-4264-BDA8-AD6A93120B15" versions: iOS: "16.1" macOS: "13.0" @@ -4774,7 +4774,7 @@ - PulseWidthModulation - TimeSynchronization -- release: "First dot-release" +- release: "FD8D09B4-6CF7-4EBA-BD4F-7EDE872E3098" versions: iOS: "16.2" macOS: "13.1" @@ -4830,7 +4830,7 @@ Descriptor: DeviceTypeStruct: DeviceType -- release: "First major API revamp" +- release: "267F4B03-3256-4056-A62D-5237640FDCFE" # First major API revamp versions: iOS: "16.4" macOS: "13.3" @@ -6787,7 +6787,7 @@ HeatSetpointPresent: HeatSetpointFieldPresent CoolSetpointPresent: CoolSetpointFieldPresent -- release: "First after major API revamp" +- release: "27C5E231-9EB5-4932-B4C1-10D88419D9CB" # First after major API revamp versions: iOS: "16.5" macOS: "13.4" @@ -7095,7 +7095,7 @@ PumpFeature: LocalOperation: Local -- release: "Fall 2023" +- release: "3C23F160-13CE-4397-BC65-122B61E4D691" versions: iOS: "17.0" macOS: "14.0" @@ -7560,7 +7560,7 @@ - TimeFailure - MissingTrustedTimeSource -- release: "Fall 2023 #2" +- release: "F7CA8603-6336-4E63-A216-30EE3F77CE8B" versions: iOS: "17.1" macOS: "14.1" @@ -7625,7 +7625,7 @@ - ProxyDiscovery - ProxyValid -- release: "Fall 2023 #3" +- release: "A188F985-88AC-4F0B-8968-C887132CEF9E" versions: iOS: "17.2" macOS: "14.2" @@ -7771,7 +7771,7 @@ Feature: DeadFrontBehavior: DeadFront -- release: "Early 2024" +- release: "ADDB2DC1-4701-4696-87EB-87CD1123BE1A" versions: iOS: "17.4" macOS: "14.4" @@ -8509,7 +8509,7 @@ ContentLaunchStatusEnum: - URLNotAvailable -- release: "Middle of 2024" +- release: "FB974A56-BCF5-46CB-91EF-B5D096E84375" versions: iOS: "17.6" macOS: "14.6" From b3fc1d08238b8f062f58d4fa5d2ec86a97553614 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 30 May 2024 23:29:17 -0700 Subject: [PATCH 013/162] [Fabric-Bridge] Refactor device management from main (#33618) * [Fabric-Bridge] Refactor device management from main * Address review comments --- examples/fabric-bridge-app/linux/BUILD.gn | 2 + examples/fabric-bridge-app/linux/Device.cpp | 6 +- .../fabric-bridge-app/linux/DeviceManager.cpp | 130 +++++++++ .../linux/include/DeviceManager.h | 68 +++++ examples/fabric-bridge-app/linux/main.cpp | 265 ++++-------------- 5 files changed, 260 insertions(+), 211 deletions(-) create mode 100644 examples/fabric-bridge-app/linux/DeviceManager.cpp create mode 100644 examples/fabric-bridge-app/linux/include/DeviceManager.h diff --git a/examples/fabric-bridge-app/linux/BUILD.gn b/examples/fabric-bridge-app/linux/BUILD.gn index 21c93344416b62..ea7e6e0b31b331 100644 --- a/examples/fabric-bridge-app/linux/BUILD.gn +++ b/examples/fabric-bridge-app/linux/BUILD.gn @@ -22,7 +22,9 @@ executable("fabric-bridge-app") { sources = [ "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h", "Device.cpp", + "DeviceManager.cpp", "include/Device.h", + "include/DeviceManager.h", "main.cpp", ] diff --git a/examples/fabric-bridge-app/linux/Device.cpp b/examples/fabric-bridge-app/linux/Device.cpp index 40cd8c007e8baa..4cf72a281113b6 100644 --- a/examples/fabric-bridge-app/linux/Device.cpp +++ b/examples/fabric-bridge-app/linux/Device.cpp @@ -46,11 +46,11 @@ void Device::SetReachable(bool aReachable) if (aReachable) { - ChipLogProgress(DeviceLayer, "Device[%s]: ONLINE", mName); + ChipLogProgress(NotSpecified, "Device[%s]: ONLINE", mName); } else { - ChipLogProgress(DeviceLayer, "Device[%s]: OFFLINE", mName); + ChipLogProgress(NotSpecified, "Device[%s]: OFFLINE", mName); } if (changed) @@ -63,7 +63,7 @@ void Device::SetName(const char * szName) { bool changed = (strncmp(mName, szName, sizeof(mName)) != 0); - ChipLogProgress(DeviceLayer, "Device[%s]: New Name=\"%s\"", mName, szName); + ChipLogProgress(NotSpecified, "Device[%s]: New Name=\"%s\"", mName, szName); chip::Platform::CopyString(mName, szName); diff --git a/examples/fabric-bridge-app/linux/DeviceManager.cpp b/examples/fabric-bridge-app/linux/DeviceManager.cpp new file mode 100644 index 00000000000000..a5ffe68445949b --- /dev/null +++ b/examples/fabric-bridge-app/linux/DeviceManager.cpp @@ -0,0 +1,130 @@ +/* + * + * Copyright (c) 2024 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 "DeviceManager.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::Credentials; +using namespace chip::Inet; +using namespace chip::Transport; +using namespace chip::DeviceLayer; +using namespace chip::app::Clusters; + +namespace { +constexpr uint8_t kMaxRetries = 10; +} // namespace + +DeviceManager::DeviceManager() +{ + memset(mDevices, 0, sizeof(mDevices)); + mFirstDynamicEndpointId = static_cast( + static_cast(emberAfEndpointFromIndex(static_cast(emberAfFixedEndpointCount() - 1))) + 1); + mCurrentEndpointId = mFirstDynamicEndpointId; +} + +int DeviceManager::AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, + const chip::Span & deviceTypeList, + const chip::Span & dataVersionStorage, chip::EndpointId parentEndpointId) +{ + uint8_t index = 0; + while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) + { + if (nullptr == mDevices[index]) + { + mDevices[index] = dev; + CHIP_ERROR err; + int retryCount = 0; + while (retryCount < kMaxRetries) + { + DeviceLayer::StackLock lock; + dev->SetEndpointId(mCurrentEndpointId); + dev->SetParentEndpointId(parentEndpointId); + err = + emberAfSetDynamicEndpoint(index, mCurrentEndpointId, ep, dataVersionStorage, deviceTypeList, parentEndpointId); + if (err == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Added device %s to dynamic endpoint %d (index=%d)", dev->GetName(), + mCurrentEndpointId, index); + return index; + } + if (err != CHIP_ERROR_ENDPOINT_EXISTS) + { + return -1; // Return error as endpoint addition failed due to an error other than endpoint already exists + } + // Increment the endpoint ID and handle wrap condition + if (++mCurrentEndpointId < mFirstDynamicEndpointId) + { + mCurrentEndpointId = mFirstDynamicEndpointId; + } + retryCount++; + } + ChipLogError(NotSpecified, "Failed to add dynamic endpoint after %d retries", kMaxRetries); + return -1; // Return error as all retries are exhausted + } + index++; + } + ChipLogProgress(NotSpecified, "Failed to add dynamic endpoint: No endpoints available!"); + return -1; +} + +int DeviceManager::RemoveDeviceEndpoint(Device * dev) +{ + uint8_t index = 0; + while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) + { + if (mDevices[index] == dev) + { + DeviceLayer::StackLock lock; + // Silence complaints about unused ep when progress logging + // disabled. + [[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint(index); + mDevices[index] = nullptr; + ChipLogProgress(NotSpecified, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); + return index; + } + index++; + } + return -1; +} + +Device * DeviceManager::GetDevice(uint16_t index) const +{ + if (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) + { + return mDevices[index]; + } + return nullptr; +} diff --git a/examples/fabric-bridge-app/linux/include/DeviceManager.h b/examples/fabric-bridge-app/linux/include/DeviceManager.h new file mode 100644 index 00000000000000..8e87c9059bcb78 --- /dev/null +++ b/examples/fabric-bridge-app/linux/include/DeviceManager.h @@ -0,0 +1,68 @@ +/* + * + * Copyright (c) 2024 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 "Device.h" + +class DeviceManager +{ +public: + DeviceManager(); + + /** + * @brief Adds a device to a dynamic endpoint. + * + * This function attempts to add a device to a dynamic endpoint. It tries to find an available + * endpoint slot and retries the addition process up to a specified maximum number of times if + * the endpoint already exists. If the addition is successful, it returns the index of the + * dynamic endpoint; otherwise, it returns -1. + * + * @param dev A pointer to the device to be added. + * @param ep A pointer to the endpoint type. + * @param deviceTypeList A span containing the list of device types. + * @param dataVersionStorage A span containing the data version storage. + * @param parentEndpointId The parent endpoint ID. Defaults to an invalid endpoint ID. + * @return int The index of the dynamic endpoint if successful, -1 otherwise. + */ + int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const chip::Span & deviceTypeList, + const chip::Span & dataVersionStorage, + chip::EndpointId parentEndpointId = chip::kInvalidEndpointId); + + /** + * @brief Removes a device from a dynamic endpoint. + * + * This function attempts to remove a device from a dynamic endpoint by iterating through the + * available endpoints and checking if the device matches. If the device is found, it clears the + * dynamic endpoint, logs the removal, and returns the index of the removed endpoint. + * If the device is not found, it returns -1. + * + * @param dev A pointer to the device to be removed. + * @return int The index of the removed dynamic endpoint if successful, -1 otherwise. + */ + int RemoveDeviceEndpoint(Device * dev); + + Device * GetDevice(uint16_t index) const; + +private: + chip::EndpointId mCurrentEndpointId; + chip::EndpointId mFirstDynamicEndpointId; + Device * mDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT + 1]; +}; diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index d639cea1ca0697..600d4a2a376d55 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -17,54 +17,27 @@ */ #include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "CommissionableInit.h" #include "Device.h" +#include "DeviceManager.h" + +#include +#include -#include -#include #include #include #include using namespace chip; -using namespace chip::app; -using namespace chip::Credentials; -using namespace chip::Inet; -using namespace chip::Transport; -using namespace chip::DeviceLayer; -using namespace chip::app::Clusters; #define POLL_INTERVAL_MS (100) +#define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u) +#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u) +#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u) namespace { -EndpointId gCurrentEndpointId; -EndpointId gFirstDynamicEndpointId; -Device * gDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT + 1]; - bool KeyboardHit() { int bytesWaiting; @@ -81,7 +54,7 @@ void BridgePollingThread() int ch = getchar(); if (ch == 'e') { - ChipLogProgress(DeviceLayer, "Exiting....."); + ChipLogProgress(NotSpecified, "Exiting....."); exit(0); } continue; @@ -92,213 +65,89 @@ void BridgePollingThread() } } -} // namespace - -// REVISION DEFINITIONS: -// ================================================================================= - -#define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u) -#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u) -#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u) - -// --------------------------------------------------------------------------- - -int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const Span & deviceTypeList, - const Span & dataVersionStorage, chip::EndpointId parentEndpointId = chip::kInvalidEndpointId) -{ - uint8_t index = 0; - const int maxRetries = 10; // Set the maximum number of retries - while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) - { - if (nullptr == gDevices[index]) - { - gDevices[index] = dev; - CHIP_ERROR err; - int retryCount = 0; - while (retryCount < maxRetries) - { - DeviceLayer::StackLock lock; - dev->SetEndpointId(gCurrentEndpointId); - dev->SetParentEndpointId(parentEndpointId); - err = - emberAfSetDynamicEndpoint(index, gCurrentEndpointId, ep, dataVersionStorage, deviceTypeList, parentEndpointId); - if (err == CHIP_NO_ERROR) - { - ChipLogProgress(DeviceLayer, "Added device %s to dynamic endpoint %d (index=%d)", dev->GetName(), - gCurrentEndpointId, index); - return index; - } - if (err != CHIP_ERROR_ENDPOINT_EXISTS) - { - return -1; // Return error as endpoint addition failed due to an error other than endpoint already exists - } - // Increment the endpoint ID and handle wrap condition - if (++gCurrentEndpointId < gFirstDynamicEndpointId) - { - gCurrentEndpointId = gFirstDynamicEndpointId; - } - retryCount++; - } - ChipLogError(DeviceLayer, "Failed to add dynamic endpoint after %d retries", maxRetries); - return -1; // Return error as all retries are exhausted - } - index++; - } - ChipLogProgress(DeviceLayer, "Failed to add dynamic endpoint: No endpoints available!"); - return -1; -} +DeviceManager gDeviceManager; -int RemoveDeviceEndpoint(Device * dev) -{ - uint8_t index = 0; - while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) - { - if (gDevices[index] == dev) - { - DeviceLayer::StackLock lock; - // Silence complaints about unused ep when progress logging - // disabled. - [[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint(index); - gDevices[index] = nullptr; - ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); - return index; - } - index++; - } - return -1; -} +} // namespace -namespace { -void CallReportingCallback(intptr_t closure) +void ApplicationInit() { - auto path = reinterpret_cast(closure); - MatterReportingAttributeChangeCallback(*path); - Platform::Delete(path); + // Start a thread for bridge polling + std::thread pollingThread(BridgePollingThread); + pollingThread.detach(); } -void ScheduleReportingCallback(Device * dev, ClusterId cluster, AttributeId attribute) -{ - auto * path = Platform::New(dev->GetEndpointId(), cluster, attribute); - PlatformMgr().ScheduleWork(CallReportingCallback, reinterpret_cast(path)); -} -} // anonymous namespace +void ApplicationShutdown() {} -void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask) +int main(int argc, char * argv[]) { - if (itemChangedMask & Device::kChanged_Reachable) - { - ScheduleReportingCallback(dev, BridgedDeviceBasicInformation::Id, BridgedDeviceBasicInformation::Attributes::Reachable::Id); - } - - if (itemChangedMask & Device::kChanged_Name) + if (ChipLinuxAppInit(argc, argv) != 0) { - ScheduleReportingCallback(dev, BridgedDeviceBasicInformation::Id, BridgedDeviceBasicInformation::Attributes::NodeLabel::Id); + return -1; } -} - -Protocols::InteractionModel::Status HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::AttributeId attributeId, - uint8_t * buffer, uint16_t maxReadLength) -{ - using namespace BridgedDeviceBasicInformation::Attributes; - - ChipLogProgress(DeviceLayer, "HandleReadBridgedDeviceBasicAttribute: attrId=%d, maxReadLength=%d", attributeId, maxReadLength); - if ((attributeId == Reachable::Id) && (maxReadLength == 1)) - { - *buffer = dev->IsReachable() ? 1 : 0; - } - else if ((attributeId == NodeLabel::Id) && (maxReadLength == 32)) - { - MutableByteSpan zclNameSpan(buffer, maxReadLength); - MakeZclCharString(zclNameSpan, dev->GetName()); - } - else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2)) - { - uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION; - memcpy(buffer, &rev, sizeof(rev)); - } - else if ((attributeId == FeatureMap::Id) && (maxReadLength == 4)) - { - uint32_t featureMap = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP; - memcpy(buffer, &featureMap, sizeof(featureMap)); - } - else - { - return Protocols::InteractionModel::Status::Failure; - } + ChipLinuxAppMainLoop(); - return Protocols::InteractionModel::Status::Success; + return 0; } +// External attribute read callback function Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength) { - uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); + uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); + AttributeId attributeId = attributeMetadata->attributeId; - Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure; - - if ((endpointIndex < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) && (gDevices[endpointIndex] != nullptr)) + Device * dev = gDeviceManager.GetDevice(endpointIndex); + if (dev != nullptr && clusterId == app::Clusters::BridgedDeviceBasicInformation::Id) { - Device * dev = gDevices[endpointIndex]; + using namespace app::Clusters::BridgedDeviceBasicInformation::Attributes; + ChipLogProgress(NotSpecified, "HandleReadBridgedDeviceBasicAttribute: attrId=%d, maxReadLength=%d", attributeId, + maxReadLength); - if (clusterId == BridgedDeviceBasicInformation::Id) + if ((attributeId == Reachable::Id) && (maxReadLength == 1)) + { + *buffer = dev->IsReachable() ? 1 : 0; + } + else if ((attributeId == NodeLabel::Id) && (maxReadLength == 32)) + { + MutableByteSpan zclNameSpan(buffer, maxReadLength); + MakeZclCharString(zclNameSpan, dev->GetName()); + } + else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2)) + { + uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION; + memcpy(buffer, &rev, sizeof(rev)); + } + else if ((attributeId == FeatureMap::Id) && (maxReadLength == 4)) + { + uint32_t featureMap = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP; + memcpy(buffer, &featureMap, sizeof(featureMap)); + } + else { - ret = HandleReadBridgedDeviceBasicAttribute(dev, attributeMetadata->attributeId, buffer, maxReadLength); + return Protocols::InteractionModel::Status::Failure; } + return Protocols::InteractionModel::Status::Success; } - return ret; + return Protocols::InteractionModel::Status::Failure; } +// External attribute write callback function Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { - uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); - + uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure; - if (endpointIndex < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) + Device * dev = gDeviceManager.GetDevice(endpointIndex); + if (dev != nullptr && dev->IsReachable()) { - Device * dev = gDevices[endpointIndex]; - - if (dev->IsReachable()) - { - ChipLogProgress(DeviceLayer, "emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d", endpoint, clusterId); - ret = Protocols::InteractionModel::Status::Success; - } + ChipLogProgress(NotSpecified, "emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d", endpoint, clusterId); + ret = Protocols::InteractionModel::Status::Success; } return ret; } - -void ApplicationInit() -{ - // Clear out the device database - memset(gDevices, 0, sizeof(gDevices)); - - // Set starting endpoint id where dynamic endpoints will be assigned, which - // will be the next consecutive endpoint id after the last fixed endpoint. - gFirstDynamicEndpointId = static_cast( - static_cast(emberAfEndpointFromIndex(static_cast(emberAfFixedEndpointCount() - 1))) + 1); - gCurrentEndpointId = gFirstDynamicEndpointId; - - // Start a thread for bridge polling - std::thread pollingThread(BridgePollingThread); - pollingThread.detach(); -} - -void ApplicationShutdown() {} - -int main(int argc, char * argv[]) -{ - if (ChipLinuxAppInit(argc, argv) != 0) - { - return -1; - } - - ChipLinuxAppMainLoop(); - - return 0; -} From 60b721525fc22081883d396aa5e3ac761ee518d9 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 31 May 2024 03:41:47 -0400 Subject: [PATCH 014/162] Global attribute tests: Remove (#33599) Removes scripts associated with the test deletion in https://github.com/CHIP-Specifications/chip-test-plans/pull/4104 and https://github.com/CHIP-Specifications/chip-test-plans/pull/4184 --- .github/workflows/tests.yaml | 2 - .../certification/Test_TC_ACFREMON_1_1.yaml | 183 ---- .../suites/certification/Test_TC_ACL_1_1.yaml | 100 --- .../suites/certification/Test_TC_ACT_1_1.yaml | 224 ----- .../certification/Test_TC_AIRQUAL_1_1.yaml | 137 --- .../certification/Test_TC_ALOGIN_1_12.yaml | 93 -- .../certification/Test_TC_APBSC_1_10.yaml | 124 --- .../Test_TC_APPLAUNCHER_1_3.yaml | 124 --- .../Test_TC_APPOBSERVER_1_13.yaml | 94 -- .../Test_TC_AUDIOOUTPUT_1_8.yaml | 103 --- .../certification/Test_TC_BIND_1_1.yaml | 91 -- .../certification/Test_TC_BINFO_1_1.yaml | 257 ------ .../certification/Test_TC_BOOLCFG_1_1.yaml | 292 ------ .../certification/Test_TC_BOOL_1_1.yaml | 102 --- .../certification/Test_TC_BRBINFO_1_1.yaml | 272 ------ .../suites/certification/Test_TC_CC_1_1.yaml | 850 ------------------ .../certification/Test_TC_CGEN_1_1.yaml | 92 -- .../certification/Test_TC_CHANNEL_1_6.yaml | 178 ---- .../certification/Test_TC_CONCON_1_14.yaml | 149 --- .../Test_TC_CONTENTLAUNCHER_1_11.yaml | 151 ---- .../certification/Test_TC_DEMM_1_1.yaml | 116 --- .../certification/Test_TC_DESC_1_1.yaml | 114 --- .../certification/Test_TC_DGETH_1_1.yaml | 216 ----- .../certification/Test_TC_DGGEN_1_1.yaml | 193 ---- .../certification/Test_TC_DGSW_1_1.yaml | 166 ---- .../certification/Test_TC_DGTHREAD_1_1.yaml | 318 ------- .../certification/Test_TC_DGWIFI_1_1.yaml | 195 ---- .../certification/Test_TC_DISHALM_1_1.yaml | 114 --- .../certification/Test_TC_DISHM_1_1.yaml | 106 --- .../certification/Test_TC_DLOG_1_1.yaml | 91 -- .../certification/Test_TC_DRLK_1_1.yaml | 544 ----------- .../certification/Test_TC_DRYERCTRL_1_1.yaml | 91 -- .../certification/Test_TC_EEVSEM_1_1.yaml | 116 --- .../certification/Test_TC_EEVSE_1_1.yaml | 301 ------- .../suites/certification/Test_TC_FAN_1_1.yaml | 217 ----- .../certification/Test_TC_FLABEL_1_1.yaml | 93 -- .../suites/certification/Test_TC_FLW_1_1.yaml | 103 --- .../certification/Test_TC_GRPKEY_1_1.yaml | 105 --- .../suites/certification/Test_TC_G_1_1.yaml | 103 --- .../certification/Test_TC_HEPAFREMON_1_1.yaml | 183 ---- .../suites/certification/Test_TC_ILL_1_1.yaml | 114 --- .../suites/certification/Test_TC_I_1_1.yaml | 136 --- .../Test_TC_KEYPADINPUT_1_2.yaml | 128 --- .../certification/Test_TC_LCFG_1_1.yaml | 93 -- .../certification/Test_TC_LOWPOWER_1_1.yaml | 93 -- .../certification/Test_TC_LUNIT_1_2.yaml | 117 --- .../suites/certification/Test_TC_LVL_1_1.yaml | 224 ----- .../suites/certification/Test_TC_LWM_1_1.yaml | 128 --- .../certification/Test_TC_MEDIAINPUT_1_4.yaml | 128 --- .../Test_TC_MEDIAPLAYBACK_1_7.yaml | 266 ------ .../suites/certification/Test_TC_MOD_1_1.yaml | 125 --- .../certification/Test_TC_MWOM_1_1.yaml | 94 -- .../suites/certification/Test_TC_OCC_1_1.yaml | 198 ---- .../suites/certification/Test_TC_OO_1_1.yaml | 207 ----- .../certification/Test_TC_OPCREDS_1_2.yaml | 121 --- .../certification/Test_TC_OTCCM_1_1.yaml | 101 --- .../suites/certification/Test_TC_PRS_1_1.yaml | 169 ---- .../certification/Test_TC_PSCFG_1_1.yaml | 93 -- .../suites/certification/Test_TC_PS_1_1.yaml | 211 ----- .../certification/Test_TC_REFALM_1_1.yaml | 116 --- .../suites/certification/Test_TC_RH_1_1.yaml | 103 --- .../certification/Test_TC_RVCCLEANM_1_1.yaml | 99 -- .../certification/Test_TC_RVCOPSTATE_1_1.yaml | 162 ---- .../certification/Test_TC_RVCRUNM_1_1.yaml | 99 -- .../suites/certification/Test_TC_S_1_1.yaml | 132 --- .../certification/Test_TC_TCCM_1_1.yaml | 129 --- .../certification/Test_TC_TGTNAV_1_9.yaml | 104 --- .../certification/Test_TC_TIMESYNC_1_1.yaml | 400 --------- .../suites/certification/Test_TC_TMP_1_1.yaml | 101 --- .../certification/Test_TC_TSUIC_1_1.yaml | 102 --- .../certification/Test_TC_ULABEL_1_1.yaml | 93 -- .../certification/Test_TC_VALCC_1_1.yaml | 186 ---- .../certification/Test_TC_WAKEONLAN_1_5.yaml | 104 --- .../certification/Test_TC_WASHERCTRL_1_1.yaml | 140 --- src/app/tests/suites/ciTests.json | 143 +-- src/app/tests/suites/manualTests.json | 6 +- src/python_testing/TC_OPSTATE_1_1.py | 53 -- src/python_testing/TC_OVENOPSTATE_1_1.py | 53 -- 78 files changed, 36 insertions(+), 12138 deletions(-) delete mode 100644 src/app/tests/suites/certification/Test_TC_ACFREMON_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_ACL_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_ACT_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_AIRQUAL_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_ALOGIN_1_12.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_APBSC_1_10.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_APPLAUNCHER_1_3.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_APPOBSERVER_1_13.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_AUDIOOUTPUT_1_8.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_BIND_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_BINFO_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_BOOLCFG_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_BRBINFO_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_CC_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_CGEN_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_CHANNEL_1_6.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_CONCON_1_14.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_1_11.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DEMM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DESC_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DGETH_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DGGEN_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DGSW_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DGTHREAD_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DGWIFI_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DISHALM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DISHM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DLOG_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DRLK_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_DRYERCTRL_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_EEVSEM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_EEVSE_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_FLABEL_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_FLW_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_GRPKEY_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_G_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_HEPAFREMON_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_ILL_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_I_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_KEYPADINPUT_1_2.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_LCFG_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_LOWPOWER_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_LUNIT_1_2.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_LVL_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_LWM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_MEDIAINPUT_1_4.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_MEDIAPLAYBACK_1_7.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_MOD_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_MWOM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_OCC_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_OO_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_OPCREDS_1_2.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_OTCCM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_PRS_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_PSCFG_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_PS_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_REFALM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_RH_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_RVCOPSTATE_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_S_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_TCCM_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_TGTNAV_1_9.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_TIMESYNC_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_TMP_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_TSUIC_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_ULABEL_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_VALCC_1_1.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_WAKEONLAN_1_5.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_WASHERCTRL_1_1.yaml delete mode 100644 src/python_testing/TC_OPSTATE_1_1.py delete mode 100644 src/python_testing/TC_OVENOPSTATE_1_1.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f4031eb47104bc..8b3588c6fdf13c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -536,13 +536,11 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_1_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_1_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' diff --git a/src/app/tests/suites/certification/Test_TC_ACFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ACFREMON_1_1.yaml deleted file mode 100644 index 3f4a7cc16bbd57..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_ACFREMON_1_1.yaml +++ /dev/null @@ -1,183 +0,0 @@ -# Copyright (c) 2023 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. - -name: 165.1.1. [TC-ACFREMON-1.1] Global Attributes with DUT as Server - -PICS: - - ACFREMON.S - -config: - nodeId: 0x12344321 - cluster: "Activated Carbon Filter Monitoring" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - PICS: "!ACFREMON.S.F00 && !ACFREMON.S.F01 && !ACFREMON.S.F02" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given ACFREMON.S.F00(Condition) ensure featuremap has the - correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: ACFREMON.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given ACFREMON.S.F01(Warning) ensure featuremap has the - correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: ACFREMON.S.F01 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given ACFREMON.S.F02(ReplacementProductList) ensure - featuremap has the correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: ACFREMON.S.F02 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the feature dependent(ACFREMON.S.F00) attribute in - AttributeList" - PICS: ACFREMON.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2] - - - label: - "Step 4c: TH reads the optional attribute InPlaceIndicator - (ACFREMON.S.A0003) in AttributeList" - PICS: ACFREMON.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4d: TH reads the optional attribute LastChangedTime - (ACFREMON.S.A0004) in AttributeList" - PICS: ACFREMON.S.A0004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 4e: TH reads the optional attribute ReplacementProductList - (ACFREMON.S.F02) in AttributeList" - PICS: ACFREMON.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: "Step 5: TH reads EventList attribute from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6a: TH reads from the DUT the AcceptedCommandList attribute." - PICS: "!ACFREMON.S.C00.Rsp" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6b: TH reads the optional command (ResetCondition) in - AcceptedCommandList" - PICS: ACFREMON.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_ACL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ACL_1_1.yaml deleted file mode 100644 index 1f33f19854e874..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_ACL_1_1.yaml +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (c) 2021 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. - -name: 133.1.1. [TC-ACL-1.1] Global attributes - -PICS: - - ACL.S - -config: - nodeId: 0x12344321 - cluster: "Access Control" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads ClusterRevision attribute from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads FeatureMap attribute from DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads AttributeList attribute from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 2, 3, 4, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads AttributeList attribute from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 2, 3, 4, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 4b: TH reads optional attribute (Extension) in AttributeList" - PICS: ACL.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 5: TH reads EventList attribute from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0, 1] - - - label: "Step 6: TH reads AcceptedCommandList attribute from DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads GeneratedCommandList attribute from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_ACT_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ACT_1_1.yaml deleted file mode 100644 index 50ebde13e9a2de..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_ACT_1_1.yaml +++ /dev/null @@ -1,224 +0,0 @@ -# Copyright (c) 2021 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. - -name: 77.1.1. [TC-ACT-1.1] Global attributes with server as DUT - -PICS: - - ACT.S - -config: - nodeId: 0x12344321 - cluster: "Actions" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: Read the global attribute: AttributeList" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 4b: Read the optional attribute(SetupURL) in AttributeList" - PICS: ACT.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - #Issue: https://github.com/project-chip/connectedhomeip/issues/26721 - - label: "Step 5: TH reads EventList attribute from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0, 1] - - # Checking only type check all commands are optional - - label: - "Step 6a: TH Read the optional command (InstantAction) in - AcceptedCommandList" - PICS: ACT.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x0] - - - label: - "Step 6b: TH Read the optional command (InstantActionWithTransition) - in AcceptedCommandList" - PICS: ACT.S.C01.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x01] - - - label: - "Step 6C: TH Read the optional command (StartAction) in - AcceptedCommandList" - PICS: ACT.S.C02.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x02] - - - label: - "Step 6d: TH Read the optional command (StartActionWithDuration) in - AcceptedCommandList" - PICS: ACT.S.C03.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x03] - - - label: - "Step 6e: TH Read the optional command (StopAction) in - AcceptedCommandList" - PICS: ACT.S.C04.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x04] - - label: - "Step 6f: TH Read the optional command (PauseAction) in - AcceptedCommandList" - PICS: ACT.S.C05.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x05] - - - label: - "Step 6g: TH Read the optional command (PauseActionWithDuration) in - AcceptedCommandList" - PICS: ACT.S.C06.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x06] - - - label: - "Step 6h: TH Read the optional command (ResumeAction) in - AcceptedCommandList" - PICS: ACT.S.C07.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x07] - - - label: - "Step 6i: TH Read the optional command (EnableAction) in - AcceptedCommandList" - PICS: ACT.S.C08.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x08] - - label: - "Step 6j: TH Read the optional command (EnableActionWithDuration) in - AcceptedCommandList" - PICS: ACT.S.C09.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x09] - - - label: - "Step 6k: TH Read the optional command (DisableAction) in - AcceptedCommandList" - PICS: ACT.S.C0a.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x0a] - - - label: - "Step 6l: TH Read the optional command (DisableActionWithDuration) in - AcceptedCommandList" - PICS: ACT.S.C0b.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x0b] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_AIRQUAL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_AIRQUAL_1_1.yaml deleted file mode 100644 index 5bb595f91fa807..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_AIRQUAL_1_1.yaml +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright (c) 2023 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. - -name: 164.1.1. [TC-AIRQUAL-1.1] Global Attributes with DUT as Server - -PICS: - - AIRQUAL.S - -config: - nodeId: 0x12344321 - cluster: "Air Quality" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - PICS: - "!AIRQUAL.S.F00 && !AIRQUAL.S.F01 && !AIRQUAL.S.F02 && !AIRQUAL.S.F03" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given AIRQUAL.S.F00(Fair) ensure featuremap has the correct - bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: AIRQUAL.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given AIRQUAL.S.F01(Moderate) ensure featuremap has the - correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: AIRQUAL.S.F01 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given AIRQUAL.S.F02(VeryPoor) ensure featuremap has the - correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: AIRQUAL.S.F02 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: - "Step 3e: Given AIRQUAL.S.F03(ExtremelyPoor) ensure featuremap has the - correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: AIRQUAL.S.F03 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x8] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_ALOGIN_1_12.yaml b/src/app/tests/suites/certification/Test_TC_ALOGIN_1_12.yaml deleted file mode 100644 index 25e6457fd786f9..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_ALOGIN_1_12.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.12. [TC-ALOGIN-1.12] Global attributes - Account Login Cluster (DUT as - Server) - -PICS: - - ALOGIN.S - -config: - nodeId: 0x12344321 - cluster: "Account Login" - endpoint: 3 - -tests: - - label: "Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 2: TH reads the FeatureMap attribute from the DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 2, 3] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_APBSC_1_10.yaml b/src/app/tests/suites/certification/Test_TC_APBSC_1_10.yaml deleted file mode 100644 index 44e11d6cb3b53e..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_APBSC_1_10.yaml +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.10. [TC-APBSC-1.10] Global attributes - Application Basic Cluster (DUT - as Server) - -PICS: - - APBSC.S - -config: - nodeId: 0x12344321 - cluster: "Application Basic" - endpoint: 3 - -tests: - - label: "Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 2: TH reads the FeatureMap attribute from the DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [2, 4, 5, 6, 7, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2, 4, 5, 6, 7, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 3b: TH reads the optional attribute(VendorName) in AttributeList" - PICS: APBSC.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 3c: TH reads the optional attribute(VendorID) in AttributeList" - PICS: APBSC.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 3d: TH reads the optional attribute(ProductID) in AttributeList" - PICS: APBSC.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_APPLAUNCHER_1_3.yaml b/src/app/tests/suites/certification/Test_TC_APPLAUNCHER_1_3.yaml deleted file mode 100644 index e7f3817a6a8084..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_APPLAUNCHER_1_3.yaml +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.3. [TC-APPLAUNCHER-1.3] Global attributes - Application Launcher - Cluster (DUT as Server) - -PICS: - - APPLAUNCHER.S - -config: - nodeId: 0x12344321 - cluster: "Application Launcher" - endpoint: 1 - -tests: - - label: "Step 0: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 2a: TH reads the FeatureMap attribute from the DUT" - PICS: APPLAUNCHER.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 1 - constraints: - type: bitmap32 - - - label: "Step 2b: TH reads the FeatureMap attribute from the DUT" - PICS: " !APPLAUNCHER.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: - "Step 3b: TH reads the optional attribute(CatalogList) in - AttributeList" - PICS: APPLAUNCHER.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 3c: TH reads the optional attribute(CurrentApp) in AttributeList" - PICS: APPLAUNCHER.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1, 2] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_APPOBSERVER_1_13.yaml b/src/app/tests/suites/certification/Test_TC_APPOBSERVER_1_13.yaml deleted file mode 100644 index 509b0232e88ec6..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_APPOBSERVER_1_13.yaml +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) 2023 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: - 19.1.13. [TC-APPOBSERVER-1.13] Global attributes - Content App Observer - Cluster (DUT as Server) - -PICS: - - APPOBSERVER.S - -config: - nodeId: 0x12344321 - cluster: "ContentAppObserver" - endpoint: 1 - -tests: - - label: "Step 0: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 2: TH reads the FeatureMap attribute from the DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_AUDIOOUTPUT_1_8.yaml b/src/app/tests/suites/certification/Test_TC_AUDIOOUTPUT_1_8.yaml deleted file mode 100644 index 49d43cb8a23659..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_AUDIOOUTPUT_1_8.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.8. [TC-AUDIOOUTPUT-1.8] Global attributes - Audio Output Cluster(DUT as - Server) - -PICS: - - AUDIOOUTPUT.S - -config: - nodeId: 0x12344321 - cluster: "Audio Output" - endpoint: 1 - -tests: - - label: "Step 0: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 2a: TH reads the FeatureMap attribute from the DUT" - PICS: AUDIOOUTPUT.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 2b: TTH reads the FeatureMap attribute from the DUT" - PICS: " !AUDIOOUTPUT.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksClear: [0x1] - - - label: "Step 3: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_BIND_1_1.yaml b/src/app/tests/suites/certification/Test_TC_BIND_1_1.yaml deleted file mode 100644 index a6c7b0024ffea6..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_BIND_1_1.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2021 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. - -name: 116.1.1. [TC-BIND-1.1] Global Attributes with DUT as Server - -PICS: - - BIND.S - -config: - nodeId: 0x12344321 - cluster: "Binding" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads the FeatureMap from DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads EventList attribute from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads AcceptedCommandList attribute from DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads GeneratedCommandList attribute from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_BINFO_1_1.yaml b/src/app/tests/suites/certification/Test_TC_BINFO_1_1.yaml deleted file mode 100644 index 6a9c2eb23074b9..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_BINFO_1_1.yaml +++ /dev/null @@ -1,257 +0,0 @@ -# Copyright (c) 2021 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. - -name: 12.1.1. [TC-BINFO-1.1] Global Attributes with DUT as Server - -PICS: - - BINFO.S - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 3 - constraints: - type: int16u - - - label: "Step 3: TH reads the FeatureMap from DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 19, - 65528, - 65529, - 65530, - 65531, - 65532, - 65533, - ] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 19, - 65528, - 65529, - 65531, - 65532, - 65533, - ] - - - label: - "Step 4b: TH reads optional attribute(ManufacturingDate) in - attributeList" - PICS: BINFO.S.A000b - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [11] - - - label: "Step 4c: TH reads optional attribute(PartNumber) in attributeList" - PICS: BINFO.S.A000c - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [12] - - - label: "Step 4d: TH reads optional attribute(ProductURL) in attributeList" - PICS: BINFO.S.A000d - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [13] - - - label: - "Step 4e: TH reads optional attribute(ProductLabel) in attributeList" - PICS: BINFO.S.A000e - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [14] - - - label: - "Step 4f: TH reads optional attribute(SerialNumber) in attributeList" - PICS: BINFO.S.A000f - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [15] - - - label: - "Step 4g: TH reads optional attribute(LocalConfigDisabled) in - attributeList" - PICS: BINFO.S.A0010 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16] - - - label: "Step 4h: TH reads optional attribute(Reachable) in attributeList" - PICS: BINFO.S.A0011 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [17] - - - label: "Step 4i: TH reads optional attribute(UniqueID) in attributeList" - PICS: BINFO.S.A0012 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [18] - - - label: - "Step 4j: TH reads optional attribute(ProductAppearance) in - attributeList" - PICS: BINFO.S.A0014 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [20] - - - label: "Step 5a: TH reads EventList from DUT" - PICS: - " !BINFO.S.E00 && !BINFO.S.E01 && !BINFO.S.E02 && !BINFO.S.A0011 && - PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 5b: TH reads BINFO.S.E00(StartUp) event in EventList" - PICS: BINFO.S.E00 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5c: TH reads BINFO.S.E01(ShutDown) event in EventList" - PICS: BINFO.S.E01 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 5d: TH reads BINFO.S.E02(Leave) event in EventList" - PICS: BINFO.S.E02 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 5e: TH reads (ReachableChanged) event in EventList" - PICS: BINFO.S.A0011 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_BOOLCFG_1_1.yaml b/src/app/tests/suites/certification/Test_TC_BOOLCFG_1_1.yaml deleted file mode 100644 index d8294f379d108a..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_BOOLCFG_1_1.yaml +++ /dev/null @@ -1,292 +0,0 @@ -# Copyright (c) 2024 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. - -name: 69.1.1. [TC-BOOLCFG-1.1] Global attributes with server as DUT - -PICS: - - BOOLCFG.S - -config: - nodeId: 0x12344321 - cluster: "Boolean State Configuration" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: Read the global attribute: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3a: Read the global attribute: FeatureMap" - command: "readAttribute" - attribute: "FeatureMap" - PICS: - ( !BOOLCFG.S.F00 && !BOOLCFG.S.F01 && !BOOLCFG.S.F02 && !BOOLCFG.S.F03 - ) - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given BOOLCFG.S.F00(VIS) ensure featuremap has the correct - bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: BOOLCFG.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given BOOLCFG.S.F01(AUD) ensure featuremap has the correct - bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: BOOLCFG.S.F01 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given BOOLCFG.S.F02(SPRS) ensure featuremap has the correct - bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: BOOLCFG.S.F02 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: - "Step 3d: Given BOOLCFG.S.F03(SENSLVL) ensure featuremap has the - correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: BOOLCFG.S.F03 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x8] - - - label: "Step 4a: Read the global attribute: AttributeList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: Read the global attribute: AttributeList" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: Read the feature dependent(BOOLCFG.S.F00) attribute in - AttributeList" - PICS: BOOLCFG.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3, 6] - - - label: - "Step 4c: Read the feature dependent(BOOLCFG.S.F00) optional attribute - in AttributeList" - PICS: BOOLCFG.S.F00 && BOOLCFG.S.A0005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 4d: Read the feature dependent(BOOLCFG.S.F01) attribute in - AttributeList" - PICS: BOOLCFG.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3, 6] - - - label: - "Step 4e: Read the feature dependent(BOOLCFG.S.F01) optional attribute - in AttributeList" - PICS: BOOLCFG.S.F01 && BOOLCFG.S.A0005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 4f: Read the feature dependent(BOOLCFG.S.F02) attribute in - AttributeList" - PICS: BOOLCFG.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 4g: Read the feature dependent(BOOLCFG.S.F03) attribute in - AttributeList" - PICS: BOOLCFG.S.F03 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1] - - - label: - "Step 4h: Read the feature dependent(BOOLCFG.S.F03) optional attribute - in AttributeList" - PICS: BOOLCFG.S.F03 && BOOLCFG.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4i: TH reads optional (SensorFault) attribute in AttributeList" - PICS: BOOLCFG.S.A0007 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [7] - - - label: "Step 5a: Read the global attribute: EventList" - PICS: - PICS_EVENT_LIST_ENABLED && !BOOLCFG.S.F00 && !BOOLCFG.S.F01 && - !BOOLCFG.S.E01 - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: - "Step 5b: Read the feature dependent(BOOLCFG.S.F00) - (AlarmsStateChanged) event in EventList" - PICS: PICS_EVENT_LIST_ENABLED && BOOLCFG.S.F00 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 5c: Read the feature dependent(BOOLCFG.S.F01) - (AlarmsStateChanged) event in EventList" - PICS: PICS_EVENT_LIST_ENABLED && BOOLCFG.S.F01 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5d: Read the optional (SensorFault) event in EventList" - PICS: PICS_EVENT_LIST_ENABLED && BOOLCFG.S.E01 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 6a: Read the global attribute: AcceptedCommandList" - PICS: ( !BOOLCFG.S.F00 && !BOOLCFG.S.F01 && !BOOLCFG.S.F02 ) - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6b: Read the feature dependent(BOOLCFG.S.F02) (SuppressAlarm) - command in AcceptedCommandList" - PICS: BOOLCFG.S.F02 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 6c: Read the feature dependent(BOOLCFG.S.F00) - (EnableDisableAlarm) command in AcceptedCommandList" - PICS: BOOLCFG.S.F00 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 6d: Read the feature dependent(BOOLCFG.S.F01) - (EnableDisableAlarm) command in AcceptedCommandList" - PICS: BOOLCFG.S.F01 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 7: Read the global attribute: GeneratedCommandList" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml deleted file mode 100644 index d9055041616007..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (c) 2021 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. - -name: 68.1.1. [TC-BOOL-1.1] Global attributes with server as DUT - -PICS: - - BOOL.S - -config: - nodeId: 0x12344321 - cluster: "Boolean State" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute" - PICS: BOOL.S.E00 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [0] - constraints: - type: list - - - label: "Step 5: TH reads from the DUT the EventList attribute" - PICS: " !BOOL.S.E00 && PICS_EVENT_LIST_ENABLED " - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_BRBINFO_1_1.yaml b/src/app/tests/suites/certification/Test_TC_BRBINFO_1_1.yaml deleted file mode 100644 index ef95ddd67bb3b9..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_BRBINFO_1_1.yaml +++ /dev/null @@ -1,272 +0,0 @@ -# Copyright (c) 2021 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: - 130.1.1. [TC-BRBINFO-1.1] Global Attributes for Bridged Device Basic - Information Cluster Cluster [DUT-Server] - -PICS: - - BRBINFO.S - -config: - nodeId: 0x12344321 - cluster: "Bridged Device Basic Information" - endpoint: 3 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - #Issue: https://github.com/project-chip/connectedhomeip/issues/30467 - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3: TH reads the FeatureMap from DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [17, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: " !PICS_EVENT_LIST_ENABLED " - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [17, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 4b: TH reads optional attribute(VendorName) in AttributeList" - PICS: BRBINFO.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 4c: TH reads optional attribute(VendorID) in AttributeList" - PICS: BRBINFO.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4d: TH reads optional attribute(ProductName) in AttributeList" - PICS: BRBINFO.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 4e: TH reads optional attribute(NodeLabel) in AttributeList" - PICS: BRBINFO.S.A0005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 4f: TH reads optional attribute(HardwareVersion) in - AttributeList" - PICS: BRBINFO.S.A0007 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [7] - - - label: - "Step 4g: TH reads optional attribute(HardwareVersionString) in - AttributeList" - PICS: BRBINFO.S.A0008 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [8] - - - label: - "Step 4h: TH reads optional attribute(SoftwareVersion) in - AttributeList" - PICS: BRBINFO.S.A0009 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [9] - - - label: - "Step 4i: TH reads optional attribute(SoftwareVersionString) in - AttributeList" - PICS: BRBINFO.S.A000a - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [10] - - - label: - "Step 4j: TH reads optional attribute(ManufacturingDate) in - AttributeList" - PICS: BRBINFO.S.A000b - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [11] - - - label: "Step 4k: TH reads optional attribute(PartNumber) in AttributeList" - PICS: BRBINFO.S.A000c - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [12] - - - label: "Step 4l: TH reads optional attribute(ProductURL) in AttributeList" - PICS: BRBINFO.S.A000d - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [13] - - - label: - "Step 4m: TH reads optional attribute(ProductLabel) in AttributeList" - PICS: BRBINFO.S.A000e - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [14] - - - label: - "Step 4n: TH reads optional attribute(SerialNumber) in AttributeList" - PICS: BRBINFO.S.A000f - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [15] - - - label: "Step 4o: TH reads optional attribute(UniqueID) in AttributeList" - PICS: BRBINFO.S.A0012 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [18] - - - label: - "Step 4p: TH reads optional attribute(ProductAppearance) in - AttributeList" - PICS: BRBINFO.S.A0014 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [20] - - - label: "Step 5a: TH reads from the DUT the EventList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 5b: TH reads optional event(StartUp) in EventList" - PICS: BRBINFO.S.E00 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5c: TH reads optional attribute(ShutDown) in EventList" - PICS: BRBINFO.S.E01 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 5d TH reads optional attribute(Leave) in EventList" - PICS: BRBINFO.S.E02 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH1 reads GeneratedCommandList from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_CC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_CC_1_1.yaml deleted file mode 100644 index b80e541799ba32..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CC_1_1.yaml +++ /dev/null @@ -1,850 +0,0 @@ -# Copyright (c) 2021 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. - -name: 25.1.1. [TC-CC-1.1] Global attributes with server as DUT - -PICS: - - CC.S - -config: - nodeId: 0x12344321 - cluster: "Color Control" - endpoint: 1 - -tests: - - label: "Step 1: Commission DUT to TH" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: - "Step 2: TH reads from the DUT the (0xFFFD) ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 6 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the (0xFFFC) FeatureMap attribute" - PICS: ( !CC.S.F00 && !CC.S.F01 && !CC.S.F02 && !CC.S.F03 && !CC.S.F04 ) - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given CC.S.F00(HS) ensure featuremap has the correct bit set" - PICS: CC.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given CC.S.F01(EHue) ensure featuremap has the correct bit - set" - PICS: CC.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given CC.S.F02(CL) ensure featuremap has the correct bit set" - PICS: CC.S.F02 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: - "Step 3e: Given CC.S.F03(XY) ensure featuremap has the correct bit set" - PICS: CC.S.F03 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x8] - - - label: - "Step 3f: Given CC.S.F04(CT) ensure featuremap has the correct bit set" - PICS: CC.S.F04 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x10] - - - label: - "Step 4a: TH reads from the DUT the (0xFFFB) AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 8, - 15, - 16, - 16385, - 16394, - 65528, - 65529, - 65530, - 65531, - 65532, - 65533, - ] - - - label: - "Step 4a: TH reads from the DUT the (0xFFFB) AttributeList attribute" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [8, 15, 16, 16385, 16394, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads feature dependent attribute (CurrentHue) in - AttributeList" - PICS: CC.S.F00 && CC.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 4c: TH reads feature dependent attribute (CurrentSaturation) in - AttributeList" - PICS: CC.S.F00 && CC.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 4d: TH reads the optional attribute(RemainingTime) in - AttributeList" - PICS: CC.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4e: TH reads feature dependent attribute (CurrentX) in - AttributeList" - PICS: CC.S.F03 && CC.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4f: TH reads feature dependent attribute (CurrentY) in - AttributeList" - PICS: CC.S.F03 && CC.S.A0004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 4g: TH reads the optional attribute(DriftCompensation) in - AttributeList" - PICS: CC.S.A0005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 4h: TH reads the optional attribute(CompensationText) in - AttributeList" - PICS: CC.S.A0006 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [6] - - - label: - "Step 4i: TH reads feature dependent attribute - (ColorTemperatureMireds) in AttributeList" - PICS: CC.S.F04 && CC.S.A0007 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [7] - - - label: "Step 4j: TH reads the Primary1X attribute in AttributeList" - PICS: CC.S.A0011 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [17] - - - label: "Step 4k: TH reads the Primary1Y attribute in AttributeList" - PICS: CC.S.A0012 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [18] - - - label: - "Step 4l: TH reads the Primary1Intensity attribute in AttributeList" - PICS: CC.S.A0013 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [19] - - - label: "Step 4m: TH reads the Primary2X attribute in AttributeList" - PICS: CC.S.A0015 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [21] - - - label: "Step 4n: TH reads the Primary2Y attribute in AttributeList" - PICS: CC.S.A0016 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [22] - - - label: - "Step 4o: TH reads the Primary2Intensity attribute in AttributeList" - PICS: CC.S.A0017 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [23] - - - label: "Step 4p: TH reads the Primary3X attribute in AttributeList" - PICS: CC.S.A0019 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [25] - - - label: "Step 4q: TH reads the Primary3Y attribute in AttributeList" - PICS: CC.S.A001a - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [26] - - - label: - "Step 4r: TH reads the Primary3Intensity attribute in AttributeList" - PICS: CC.S.A001b - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [27] - - - label: "Step 4s: TH reads the Primary4X attribute in AttributeList" - PICS: CC.S.A0020 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [32] - - - label: "Step 4t: TH reads the Primary4Y attribute in AttributeList" - PICS: CC.S.A0021 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [33] - - - label: - "Step 4u: TH reads the Primary4Intensity attribute in AttributeList" - PICS: CC.S.A0022 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [34] - - - label: "Step 4v: TH reads the Primary5X attribute in AttributeList" - PICS: CC.S.A0024 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [36] - - - label: "Step 4w: TH reads the Primary5Y attribute in AttributeList" - PICS: CC.S.A0025 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [37] - - - label: - "Step 4x: TH reads the Primary5Intensity attribute in AttributeList" - PICS: CC.S.A0026 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [38] - - - label: "Step 4y: TH reads the Primary6X attribute in AttributeList" - PICS: CC.S.A0028 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [40] - - - label: "Step 4z: TH reads the Primary6Y attribute in AttributeList" - PICS: CC.S.A0029 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [41] - - - label: - "Step 4a1: TH reads the Primary6Intensity attribute in AttributeList" - PICS: CC.S.A002a - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [42] - - - label: - "Step 4a2: TH reads the optional attribute(WhitePointX) in - AttributeList" - PICS: CC.S.A0030 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [48] - - - label: - "Step 4a3: TH reads the optional attribute(WhitePointY) in - AttributeList" - PICS: CC.S.A0031 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [49] - - - label: - "Step 4a4: TH reads the optional attribute(ColorPointRX) in - AttributeList" - PICS: CC.S.A0032 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [50] - - - label: - "Step 4a5: TH reads the optional attribute(ColorPointRY) in - AttributeList" - PICS: CC.S.A0033 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [51] - - - label: - "Step 4a6: TH reads the optional attribute(ColorPointRIntensity) in - AttributeList" - PICS: CC.S.A0034 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [52] - - - label: - "Step 4a7: TH reads the optional attribute(ColorPointGX) in - AttributeList" - PICS: CC.S.A0036 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [54] - - - label: - "Step 4a8: TH reads the optional attribute(ColorPointGY) in - AttributeList" - PICS: CC.S.A0037 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [55] - - - label: - "Step 4a9: TH reads the optional attribute(ColorPointGIntensity) in - AttributeList" - PICS: CC.S.A0038 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [56] - - - label: - "Step 4a10: TH reads the optional attribute(ColorPointBX) in - AttributeList" - PICS: CC.S.A003a - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [58] - - - label: - "Step 4a11: TH reads the optional attribute(ColorPointBY) in - AttributeList" - PICS: CC.S.A003b - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [59] - - - label: - "Step 4a12: TH reads the optional attribute(ColorPointBIntensity) in - AttributeList" - PICS: CC.S.A003c - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [60] - - - label: - "Step 4a13: TH reads feature dependent attribute (EnhancedCurrentHue) - in AttributeList" - PICS: CC.S.F01 && CC.S.A4000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16384] - - - label: - "Step 4a14: TH reads feature dependent attribute (ColorLoopActive) in - AttributeList" - PICS: CC.S.F02 && CC.S.A4002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16386] - - - label: - "Step 4a15: TH reads feature dependent attribute (ColorLoopDirection) - in AttributeList" - PICS: CC.S.F02 && CC.S.A4003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16387] - - - label: - "Step 4a16: TH reads feature dependent attribute (ColorLoopTime) in - AttributeList" - PICS: CC.S.F02 && CC.S.A4004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16388] - - - label: - "Step 4a17: TH reads feature dependent attribute - (ColorLoopStartEnhancedHue) in AttributeList" - PICS: CC.S.F02 && CC.S.A4005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16389] - - - label: - "Step 4a18: TH reads feature dependent attribute - (ColorLoopStoredEnhancedHue) in AttributeList" - PICS: CC.S.F02 && CC.S.A4006 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16390] - - - label: - "Step 4a19: TH reads feature dependent attribute - (ColorTempPhysicalMinMireds) in AttributeList" - PICS: CC.S.F04 && CC.S.A400b - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16395] - - - label: - "Step 4a20: TH reads feature dependent attribute - (ColorTempPhysicalMaxMireds) in AttributeList" - PICS: CC.S.F04 && CC.S.A400c - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16396] - - - label: - "Step 4a21:TH reads feature dependent attribute - (CoupleColorTempToLevelMinMireds) in AttributeList" - PICS: CC.S.F04 && CC.S.A400d - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16397] - - - label: - "Step 4a22: TH reads feature dependent attribute - (StartUpColorTemperatureMireds) in AttributeList" - PICS: CC.S.F04 && CC.S.A4010 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16400] - - - label: "Step 5: TH reads from the DUT the (0xFFFA) EventList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6a: TH reads feature dependent command(MoveToHue) in - AcceptedCommandList" - PICS: CC.S.F00 && CC.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 6b: TH reads feature dependent command(MoveHue) in - AcceptedCommandList" - PICS: CC.S.F00 && CC.S.C01.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 6c: TH reads feature dependent command(StepHue) in - AcceptedCommandList" - PICS: CC.S.F00 && CC.S.C02.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 6d: TH reads feature dependent command(MoveToSaturation) in - AcceptedCommandList" - PICS: CC.S.F00 && CC.S.C03.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 6e: TH reads feature dependent command(MoveSaturation) in - AcceptedCommandList" - PICS: CC.S.F00 && CC.S.C04.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 6f: TH reads feature dependent command(StepSaturation) in - AcceptedCommandList" - PICS: CC.S.F00 && CC.S.C05.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 6g: TH reads feature dependent command(MoveToHueAndSaturation) - in AcceptedCommandList" - PICS: CC.S.F00 && CC.S.C06.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [6] - - - label: - "Step 6h: TH reads feature dependent command(MoveToColor) in - AcceptedCommandList" - PICS: CC.S.F03 && CC.S.C07.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [7] - - - label: - "Step 6i: TH reads feature dependent command(MoveColor) in - AcceptedCommandList" - PICS: CC.S.F03 && CC.S.C08.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [8] - - - label: - "Step 6j: TH reads feature dependent command(StepColor) in - AcceptedCommandList" - PICS: CC.S.F03 && CC.S.C09.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [9] - - - label: - "Step 6k: TH reads feature dependent command(MoveToColorTemperature) - in AcceptedCommandList" - PICS: CC.S.F04 && CC.S.C0a.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [10] - - - label: - "Step 6l: TH reads feature dependent command(EnhancedMoveToHue) in - AcceptedCommandList" - PICS: CC.S.F01 && CC.S.C40.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [64] - - - label: - "Step 6m: TH reads feature dependent command(EnhancedMoveHue) in - AcceptedCommandList" - PICS: CC.S.F01 && CC.S.C41.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [65] - - - label: - "Step 6n: TH reads feature dependent command(EnhancedStepHue) in - AcceptedCommandList" - PICS: CC.S.F01 && CC.S.C42.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [66] - - - label: - "Step 6o:TH reads feature dependent - command(EnhancedMoveToHueAndSaturation) in AcceptedCommandList" - PICS: CC.S.F01 && CC.S.C43.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [67] - - - label: - "Step 6p: TH reads feature dependent command(ColorLoopSet) in - AcceptedCommandList" - PICS: CC.S.F02 && CC.S.C44.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [68] - - - label: - "Step 6q: TH reads feature dependent command(StopMoveStep) in - AcceptedCommandList" - PICS: CC.S.F00 && CC.S.F03 && CC.S.F04 && CC.S.C47.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [71] - - - label: - "Step 6r: TH reads feature dependent command(StopMoveStep) in - AcceptedCommandList" - PICS: CC.S.F04 && CC.S.C4b.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [75] - - - label: - "Step 6s: TH reads feature dependent command(StepColorTemperature) in - AcceptedCommandList" - PICS: CC.S.F04 && CC.S.C4c.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [76] - - - label: - "Step 7: TH reads from the DUT the (0xFFF8) GeneratedCommandList - attribute" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_CGEN_1_1.yaml b/src/app/tests/suites/certification/Test_TC_CGEN_1_1.yaml deleted file mode 100644 index 983b77c6b33a4f..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CGEN_1_1.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (c) 2021 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. - -name: 90.1. [TC-CGEN-1.1] Global Attributes [DUT-Server] - -PICS: - - CGEN.S - -config: - nodeId: 0x12344321 - cluster: "General Commissioning" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: Read the global attribute: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: Read the global attribute: FeatureMap" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: Read the global attribute: AttributeList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [0, 1, 2, 3, 4, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: Read the global attribute: AttributeList" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 4, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: Read the global attribute: EventList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: Read the global attribute: AcceptedCommandList" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 2, 4] - - - label: "Step 7: Read the global attribute: GeneratedCommandList" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1, 3, 5] diff --git a/src/app/tests/suites/certification/Test_TC_CHANNEL_1_6.yaml b/src/app/tests/suites/certification/Test_TC_CHANNEL_1_6.yaml deleted file mode 100644 index fb0379c14734f2..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CHANNEL_1_6.yaml +++ /dev/null @@ -1,178 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.6. [TC-CHANNEL-1.6] Global attributes - Channel Cluster (DUT as Server) - -PICS: - - CHANNEL.S - -config: - nodeId: 0x12344321 - cluster: "Channel" - endpoint: 1 - -tests: - - label: "Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: read the global attribute: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 2a: Read the global attribute: FeatureMap" - PICS: ( !CHANNEL.S.F00 && !CHANNEL.S.F01 ) - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 2b: Given CCHANNEL.S.F00(CL) ensure featuremap has the correct - bit set" - PICS: CHANNEL.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 2c: Given CHANNEL.S.F01(LI) ensure featuremap has the correct - bit set" - PICS: CHANNEL.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: "Step 3a: Read the global attribute: AttributeList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: Read the global attribute: AttributeList" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: "Step 3b: Read the optional attribute(ChannelList): AttributeList" - PICS: CHANNEL.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 3c: Reading optional attribute(Lineup) in AttributeList" - PICS: CHANNEL.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 3d: Read the optional attribute(CurrentChannel): AttributeList" - PICS: CHANNEL.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4a: Read the optional command(ChangeChannel) in - AcceptedCommandList" - PICS: CHANNEL.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 4b: Read the optional command(ChangeChannelByNumber) in - AcceptedCommandList" - PICS: CHANNEL.S.C02.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4c: Read the optional command(SkipChannel) in - AcceptedCommandList" - PICS: CHANNEL.S.C03.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 5a: Read the global attribute: GeneratedCommandList" - PICS: ( !CHANNEL.S.F00 && !CHANNEL.S.F01 ) - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 5b: Read the global attribute: GeneratedCommandList" - PICS: CHANNEL.S.F00 || CHANNEL.S.F01 - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 6: Read the global attribute: EventList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_CONCON_1_14.yaml b/src/app/tests/suites/certification/Test_TC_CONCON_1_14.yaml deleted file mode 100644 index 1b9c2215d3e0ce..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CONCON_1_14.yaml +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright (c) 2023 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: - 19.1.14. [TC-CONCON-1.14] Global attributes - Content Control Cluster (DUT - as Server) - -PICS: - - CONCON.S - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - verification: | - ./chip-tool contentcontrol read cluster-revision 1 1 - - [1704869094.517260][4293:4295] CHIP:DMG: } - [1704869094.517545][4293:4295] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050F Attribute 0x0000_FFFD DataVersion: 1251967611 - [1704869094.517631][4293:4295] CHIP:TOO: ClusterRevision: 1 - [1704869094.518028][4293:4295] CHIP:EM: <<< [E:20721i S:28265 M:144462024 (Ack:200262914)] (S) Msg TX to 1:0000000000000001 [EF1D] [UDP:[fe80::e65f:1ff:fe49:ae1b%wlan0]:5640] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1704869094.518235][4293:4295] CHIP:EM: Flushed pending ack for MessageCounter:200262914 on exchange 20721i - disabled: true - - label: "Step 2: TH reads the FeatureMap attribute from the DUT" - - verification: | - ./chip-tool contentcontrol read feature-map 1 1 - - [1704869124.605470][4296:4298] CHIP:DMG: InteractionModelRevision = 11 - [1704869124.605531][4296:4298] CHIP:DMG: } - [1704869124.605872][4296:4298] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050F Attribute 0x0000_FFFC DataVersion: 1251967611 - [1704869124.605970][4296:4298] CHIP:TOO: FeatureMap: 0 - [1704869124.606460][4296:4298] CHIP:EM: <<< [E:55393i S:13705 M:14084931 (Ack:173736992)] (S) Msg TX to 1:0000000000000001 [EF1D] [UDP:[fe80::e65f:1ff:fe49:ae1b%wlan0]:5640] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1704869124.606702][4296:4298] CHIP:EM: Flushed pending ack for MessageCounter:173736992 on exchange 55393i - [1704869124.607077][4296:4296] CHIP:CTL: Shutting down the commissioner - disabled: true - - - label: "Step 3: TH reads the AttributeList attribute from the DUT" - verification: | - ./chip-tool contentcontrol read attribute-list 1 1 - - [1704869156.246646][4299:4301] CHIP:DMG: InteractionModelRevision = 11 - [1704869156.246689][4299:4301] CHIP:DMG: } - [1704869156.247013][4299:4301] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050F Attribute 0x0000_FFFB DataVersion: 1251967611 - [1704869156.248939][4299:4301] CHIP:TOO: AttributeList: 13 entries - [1704869156.248979][4299:4301] CHIP:TOO: [1]: 0 - [1704869156.249005][4299:4301] CHIP:TOO: [2]: 1 - [1704869156.249031][4299:4301] CHIP:TOO: [3]: 2 - [1704869156.249055][4299:4301] CHIP:TOO: [4]: 3 - [1704869156.249080][4299:4301] CHIP:TOO: [5]: 4 - [1704869156.249105][4299:4301] CHIP:TOO: [6]: 5 - [1704869156.249130][4299:4301] CHIP:TOO: [7]: 6 - [1704869156.249154][4299:4301] CHIP:TOO: [8]: 7 - [1704869156.249180][4299:4301] CHIP:TOO: [9]: 65528 - [1704869156.249204][4299:4301] CHIP:TOO: [10]: 65529 - [1704869156.249229][4299:4301] CHIP:TOO: [11]: 65531 - [1704869156.249254][4299:4301] CHIP:TOO: [12]: 65532 - [1704869156.249279][4299:4301] CHIP:TOO: [13]: 65533 - [1704869156.249630][4299:4301] CHIP:EM: <<< [E:14371i S:6146 M:117952128 (Ack:180483729)] (S) Msg TX to 1:0000000000000001 [EF1D] [UDP:[fe80::e65f:1ff:fe49:ae1b%wlan0]:5640] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1704869156.249770][4299:4301] CHIP:EM: Flushed pending ack for MessageCounter:180483729 on exchange 14371i - disabled: true - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - verification: | - ./chip-tool contentcontrol read accepted-command-list 1 1 - [1704869442.419331][4306:4308] CHIP:DMG: SuppressResponse = true, - [1704869442.419358][4306:4308] CHIP:DMG: InteractionModelRevision = 11 - [1704869442.419382][4306:4308] CHIP:DMG: } - [1704869442.419678][4306:4308] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050F Attribute 0x0000_FFF9 DataVersion: 1251967611 - [1704869442.419774][4306:4308] CHIP:TOO: AcceptedCommandList: 10 entries - [1704869442.419808][4306:4308] CHIP:TOO: [1]: 0 - [1704869442.419835][4306:4308] CHIP:TOO: [2]: 1 - [1704869442.419860][4306:4308] CHIP:TOO: [3]: 3 - [1704869442.419885][4306:4308] CHIP:TOO: [4]: 4 - [1704869442.419909][4306:4308] CHIP:TOO: [5]: 5 - [1704869442.419933][4306:4308] CHIP:TOO: [6]: 6 - [1704869442.419958][4306:4308] CHIP:TOO: [7]: 7 - [1704869442.419982][4306:4308] CHIP:TOO: [8]: 8 - [1704869442.420006][4306:4308] CHIP:TOO: [9]: 9 - [1704869442.420031][4306:4308] CHIP:TOO: [10]: 10 - [1704869442.420310][4306:4308] CHIP:EM: <<< [E:22515i S:37055 M:163291838 (Ack:95370016)] (S) Msg TX to 1:0000000000000001 [EF1D] [UDP:[fe80::e65f:1ff:fe49:ae1a%wlan0]:5640] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1704869442.420470][4306:4308] CHIP:EM: Flushed pending ack for MessageCounter:95370016 on exchange 22515i - disabled: true - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - verification: | - ./chip-tool contentcontrol read generated-command-list 1 1 - - [1704869486.142562][4311:4313] CHIP:DMG: SuppressResponse = true, - [1704869486.142591][4311:4313] CHIP:DMG: InteractionModelRevision = 11 - [1704869486.142617][4311:4313] CHIP:DMG: } - [1704869486.142837][4311:4313] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050F Attribute 0x0000_FFF8 DataVersion: 1251967611 - [1704869486.142903][4311:4313] CHIP:TOO: GeneratedCommandList: 1 entries - [1704869486.142938][4311:4313] CHIP:TOO: [1]: 2 - [1704869486.143197][4311:4313] CHIP:EM: <<< [E:58684i S:20913 M:112498974 (Ack:84853992)] (S) Msg TX to 1:0000000000000001 [EF1D] [UDP:[fe80::e65f:1ff:fe49:ae1a%wlan0]:5640] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true - - - label: "Step 6: TH reads the EventList attribute from the DUT" - verification: | - ./chip-tool contentcontrol read event-list 1 1 - - [1704869518.133231][4314:4316] CHIP:EM: Rxd Ack; Removing MessageCounter:245792542 from Retrans Table on exchange 18480i - [1704869518.133334][4314:4316] CHIP:DMG: ReportDataMessage = - [1704869518.133370][4314:4316] CHIP:DMG: { - [1704869518.133398][4314:4316] CHIP:DMG: AttributeReportIBs = - [1704869518.133440][4314:4316] CHIP:DMG: [ - [1704869518.133472][4314:4316] CHIP:DMG: AttributeReportIB = - [1704869518.133515][4314:4316] CHIP:DMG: { - [1704869518.133549][4314:4316] CHIP:DMG: AttributeStatusIB = - [1704869518.133594][4314:4316] CHIP:DMG: { - [1704869518.133631][4314:4316] CHIP:DMG: AttributePathIB = - [1704869518.133674][4314:4316] CHIP:DMG: { - [1704869518.133720][4314:4316] CHIP:DMG: Endpoint = 0x1, - [1704869518.133764][4314:4316] CHIP:DMG: Cluster = 0x50f, - [1704869518.133809][4314:4316] CHIP:DMG: Attribute = 0x0000_FFFA, - [1704869518.133850][4314:4316] CHIP:DMG: } - [1704869518.133946][4314:4316] CHIP:DMG: - [1704869518.133988][4314:4316] CHIP:DMG: StatusIB = - [1704869518.134031][4314:4316] CHIP:DMG: { - [1704869518.134072][4314:4316] CHIP:DMG: status = 0x86 (UNSUPPORTED_ATTRIBUTE), - [1704869518.134144][4314:4316] CHIP:DMG: }, - [1704869518.134189][4314:4316] CHIP:DMG: - [1704869518.134226][4314:4316] CHIP:DMG: }, - [1704869518.134268][4314:4316] CHIP:DMG: - [1704869518.134324][4314:4316] CHIP:DMG: }, - [1704869518.134368][4314:4316] CHIP:DMG: - [1704869518.134398][4314:4316] CHIP:DMG: ], - [1704869518.134438][4314:4316] CHIP:DMG: - [1704869518.134469][4314:4316] CHIP:DMG: SuppressResponse = true, - [1704869518.134501][4314:4316] CHIP:DMG: InteractionModelRevision = 11 - [1704869518.134531][4314:4316] CHIP:DMG: } - [1704869518.134726][4314:4316] CHIP:TOO: Response Failure: IM Error 0x00000586: General error: 0x86 (UNSUPPORTED_ATTRIBUTE) - [1704869518.135007][4314:4316] CHIP:EM: <<< [E:18480i S:40415 M:245792543 (Ack:116804273)] (S) Msg TX to 1:0000000000000001 [EF1D] [UDP:[fe80::e65f:1ff:fe49:ae1a%wlan0]:5640] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_1_11.yaml b/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_1_11.yaml deleted file mode 100644 index a30b8ce2df79e2..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_1_11.yaml +++ /dev/null @@ -1,151 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.11. [TC-CONTENTLAUNCHER-1.11] Global attributes - Content Launcher - Cluster (DUT as Server) - -PICS: - - CONTENTLAUNCHER.S - -config: - nodeId: 0x12344321 - cluster: "Content Launcher" - endpoint: 1 - -tests: - - label: "Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 2a: TH reads the FeatureMap attribute from the DUT" - PICS: ( !CONTENTLAUNCHER.S.F00 && !CONTENTLAUNCHER.S.F01 ) - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 2b: Given CONTENTLAUNCHER.S.F00 (CS) ensure featuremap has the - correct bit set" - PICS: CONTENTLAUNCHER.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 2c: Given CONTENTLAUNCHER.S.F01(UP) ensure featuremap has the - correct bit set" - PICS: CONTENTLAUNCHER.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: - "Step 3b: TH reads the optional attribute(AcceptHeader): AttributeList" - PICS: CONTENTLAUNCHER.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 3c: TH reads the optional - attribute(SupportedStreamingProtocols): AttributeList" - PICS: CONTENTLAUNCHER.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 4a: TH reads the optional command(LaunchContent) in - AcceptedCommandList attribute" - PICS: CONTENTLAUNCHER.C.C00.Tx - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 4b: TH reads the optional command(LaunchURL) in - AcceptedCommandList attribute" - PICS: CONTENTLAUNCHER.C.C01.Tx - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_DEMM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DEMM_1_1.yaml deleted file mode 100644 index b2f927d14fd554..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DEMM_1_1.yaml +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2024 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. - -name: 241.1.1. [TC-DEMM-1.1] Global attributes with DUT as Server - -PICS: - - DEMM.S - -config: - nodeId: 0x12344321 - cluster: "Device Energy Management Mode" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - #https://github.com/project-chip/connectedhomeip/issues/31599 - - label: "Step 3: TH reads from the DUT the FeatureMap attribute" - verification: | - ./chip-tool deviceenergymanagementmode read feature-map 1 1 - - On the TH(Chip-tool) Log, Verify featureMap value is 0 and below is the sample log provided for the raspi platform: - - [1707803263.396282][12695:12697] CHIP:DMG: } - [1707803263.396447][12695:12697] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009F Attribute 0x0000_FFFC DataVersion: 3404644350 - [1707803263.396492][12695:12697] CHIP:TOO: FeatureMap: 0 - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP - arguments: - values: - - name: "message" - value: "Enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads optional attribute (StartUpMode) in AttributeList - from DUT" - PICS: DEMM.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [0] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [1] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_DESC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DESC_1_1.yaml deleted file mode 100644 index cb6ce46a174404..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DESC_1_1.yaml +++ /dev/null @@ -1,114 +0,0 @@ -# Copyright (c) 2021 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. - -name: 84.1.1. [TC-DESC-1.1] Global Attributes with DUT as Server - -PICS: - - DESC.S - -config: - nodeId: 0x12344321 - cluster: "Descriptor" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: "!DESC.S.F00" - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksClear: [0x1] - - - label: - "Step 3: TH reads from the DUT the FeatureMap attribute. 0x0001: SHALL - be included if and only if DESC.S.F00(TagList)" - PICS: DESC.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads from the DUT the AttributeList attribute. 0x0004: - SHALL be included if and only if DESC.S.F00" - PICS: DESC.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads AcceptedCommandList attribute from DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads GeneratedCommandList attribute from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_DGETH_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DGETH_1_1.yaml deleted file mode 100644 index 4c101adf4a3de8..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DGETH_1_1.yaml +++ /dev/null @@ -1,216 +0,0 @@ -# Copyright (c) 2021 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 47.1.1. [TC-DGETH-1.1] Global Attributes with DUT as Server - -PICS: - - DGETH.S - -config: - nodeId: 0x12344321 - cluster: "Ethernet Network Diagnostics" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3a: TH reads the FeatureMap from DUT" - PICS: " !DGETH.S.F00 && !DGETH.S.F01" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given DGETH.S.F00 ensure featuremap has the correct bit set" - PICS: DGETH.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given DGETH.S.F01 ensure featuremap has the correct bit set" - PICS: DGETH.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: "Step 4b: TH reads optional attribute(PHYRate) in AttributeList" - PICS: DGETH.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 4c: TH reads optional attribute(FullDuplex) in AttributeList" - PICS: DGETH.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 4d: TH reads optional attribute(PacketRxCount) and Feature - dependent(DGETH.S.F00(PKTCNT)) in AttributeList" - PICS: DGETH.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4e: TH reads optional attribute(PacketRxCount) and Feature - dependent(DGETH.S.F00(PKTCNT)) in AttributeList" - PICS: DGETH.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4f: TH reads optional attribute(PacketRxCount) and Feature - dependent(DGETH.S.F01(ERRCNT)) in AttributeList" - PICS: DGETH.S.A0004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 4g: TH reads optional attribute(PacketRxCount) and Feature - dependent(DGETH.S.F01(ERRCNT)) in AttributeList" - PICS: DGETH.S.A0005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 4h: TH reads optional attribute(PacketRxCount) and Feature - dependent(DGETH.S.F01(ERRCNT)) in AttributeList" - PICS: DGETH.S.A0006 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [6] - - - label: - "Step 4i: TH reads optional attribute(CarrierDetect) in AttributeList" - PICS: DGETH.S.A0007 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [7] - - - label: - "Step 4j: TH reads optional attribute(TimeSinceReset) in AttributeList" - PICS: DGETH.S.A0008 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [8] - - - label: "Step 5: TH reads EventList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - PICS: ( DGETH.S.F00 || DGETH.S.F01 ) - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - PICS: " !DGETH.S.F00 && !DGETH.S.F01 " - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads GeneratedCommandList from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_DGGEN_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DGGEN_1_1.yaml deleted file mode 100644 index 6641fcf879939c..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DGGEN_1_1.yaml +++ /dev/null @@ -1,193 +0,0 @@ -# Copyright (c) 2021 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. - -name: 88.1.1. [TC-DGGEN-1.1] Global Attributes with DUT as Server - -PICS: - - DGGEN.S - -config: - nodeId: 0x12344321 - cluster: "General Diagnostics" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: "!DGGEN.S.F00" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: DGGEN.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 1 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 8, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 8, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: Validate presence of mandatory attribute(UpTime) in - AttributeList" - PICS: DGGEN.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4c: TH reads optional attribute(TotalOperationalHours) in - AttributeList" - PICS: DGGEN.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 4d: TH reads optional attribute(BootReason) in AttributeList" - PICS: DGGEN.S.A0004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 4e: TH reads optional attribute(ActiveHardwareFaults) in - AttributeList" - PICS: DGGEN.S.A0005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 4f: TH reads optional attribute(ActiveRadioFaults) in - AttributeList" - PICS: DGGEN.S.A0006 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [6] - - - label: - "Step 4g: TH reads optional attribute(ActiveNetworkFaults) in - AttributeList" - PICS: DGGEN.S.A0007 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [7] - - - label: "Step 5a: TH reads from the DUT the EventList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 5b: TH reads optional event(HardwareFaultChange) in EventList" - PICS: DGGEN.S.E00 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5c: TH reads optional event(RadioFaultChange) in EventList" - PICS: DGGEN.S.E01 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 5d: TH reads optional event(NetworkFaultChange) in EventList" - PICS: DGGEN.S.E02 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [2] diff --git a/src/app/tests/suites/certification/Test_TC_DGSW_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DGSW_1_1.yaml deleted file mode 100644 index 0b516f079ca053..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DGSW_1_1.yaml +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (c) 2021 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 44.1.1. [TC-DGSW-1.1] Global Attributes with DUT as Server - -PICS: - - DGSW.S - -config: - nodeId: 0x12344321 - cluster: "Software Diagnostics" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3a: TH reads the FeatureMap from DUT" - PICS: " !DGSW.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given DGSW.S.F00(Watermarks) ensure featuremap has the - correct bit set" - PICS: DGSW.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads optional attribute(ThreadMetrics) in AttributeList" - PICS: DGSW.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 4c: TH reads optional attribute(CurrentHeapFree) in - AttributeList" - PICS: DGSW.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 4d: TH reads optional attribute(CurrentHeapUsed) in - AttributeList" - PICS: DGSW.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4e: TH reads Feature dependent - attribute(CurrentHeapHighWatermark) in AttributeList" - PICS: ( DGSW.S.F00 || DGSW.S.A0003 ) - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 5a: TH reads EventList from DUT" - PICS: DGSW.S.E00 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5b: TH reads EventList from DUT" - PICS: " !DGSW.S.E00 && PICS_EVENT_LIST_ENABLED " - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - PICS: DGSW.S.F00 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - PICS: " !DGSW.S.F00 " - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads GeneratedCommandList from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_DGTHREAD_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DGTHREAD_1_1.yaml deleted file mode 100644 index d1c6cd1b889987..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DGTHREAD_1_1.yaml +++ /dev/null @@ -1,318 +0,0 @@ -# Copyright (c) 2021 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. - -name: 50.1.1. [TC-DGTHREAD-1.1] Global Attributes [DUT-Server] - -PICS: - - DGTHREAD.S - -config: - nodeId: 0x12344321 - cluster: "Thread Network Diagnostics" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3a: TH reads the FeatureMap from DUT" - PICS: - " !DGTHREAD.S.F00 && !DGTHREAD.S.F01 && !DGTHREAD.S.F02 && - !DGTHREAD.S.F03 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given DGTHREAD.S.F00(PKTCNT) ensure featuremap has the - correct bit set" - PICS: DGTHREAD.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given DGTHREAD.S.F01(ERRCNT) ensure featuremap has the - correct bit set" - PICS: DGTHREAD.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given DGTHREAD.S.F02(MLECNT) ensure featuremap has the - correct bit set" - PICS: DGTHREAD.S.F02 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: - "Step 3e: Given DGTHREAD.S.F03(MACCNT) ensure featuremap has the - correct bit set" - PICS: DGTHREAD.S.F03 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x8] - - - label: "Step 4a: TH reads mandatory attributes in AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0, - 1, - 2, - 3, - 4, - 5, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 59, - 60, - 61, - 62, - 65528, - 65529, - 65530, - 65531, - 65532, - 65533, - ] - - - label: "Step 4a: TH reads mandatory attributes in AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0, - 1, - 2, - 3, - 4, - 5, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 59, - 60, - 61, - 62, - 65528, - 65529, - 65531, - 65532, - 65533, - ] - - - label: - "Step 4b: TH reads Feature dependent attribute(DGTHREAD.S.F01(ERRCNT)) - in attributeList" - PICS: DGTHREAD.S.A0006 && DGTHREAD.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [6] - - - label: - "Step 4c: TH reads Feature dependent attribute - (DGTHREAD.S.F02(MLECNT)) in attributeList" - PICS: DGTHREAD.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [14, 15, 16, 17, 18, 19, 20, 21] - - - label: - "Step 4d: TH reads Feature dependent attribute - (DGTHREAD.S.F03(MACCNT)) in attributeList" - PICS: DGTHREAD.S.F03 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - ] - - - label: - "Step 4e: TH reads the optional attribute (ActiveTimestamp) in - AttributeList" - PICS: DGTHREAD.S.A0038 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [56] - - - label: - "Step 4f: TH reads the optional attribute (PendingTimestamp) in - AttributeList" - PICS: DGTHREAD.S.A0039 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [57] - - - label: "Step 4g: TH reads the optional attribute (Delay) in AttributeList" - PICS: DGTHREAD.S.A003a - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [58] - - - label: "Step 5a: TH reads EventList from DUT" - PICS: " !DGTHREAD.S.E00 && !DGTHREAD.S.E01 && PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: - "Step 5b: TH reads DGTHREAD.S.E00(ConnectionStatus) event in EventList" - PICS: DGTHREAD.S.E00 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 5c: TH reads DGTHREAD.S.E01(NetworkFaultChange) event in - EventList" - PICS: DGTHREAD.S.E01 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - PICS: " !DGTHREAD.S.F01 " - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - PICS: DGTHREAD.S.F01 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads GeneratedCommandList from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_DGWIFI_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DGWIFI_1_1.yaml deleted file mode 100644 index 8ac9fd1a0afd2e..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DGWIFI_1_1.yaml +++ /dev/null @@ -1,195 +0,0 @@ -# Copyright (c) 2021 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. - -name: 53.1.1. [TC-DGWIFI-1.1] Global Attributes [DUT as Server] - -PICS: - - DGWIFI.S - -config: - nodeId: 0x12344321 - cluster: "WiFi Network Diagnostics" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3a: TH reads the FeatureMap from DUT" - PICS: ( !DGWIFI.S.F00 && !DGWIFI.S.F01 ) - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given DGWIFI.S.F00(PacketCounts) ensure featuremap has the - correct bit set" - PICS: DGWIFI.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given DGWIFI.S.F01(ErrorCounts) ensure featuremap has the - correct bit set" - PICS: DGWIFI.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [0, 1, 2, 3, 4, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 4, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads Feature dependent(DGWIFI.S.F00) attributes in - attributeList from DUT" - PICS: DGWIFI.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [6, 7, 8, 9, 10] - - - label: - "Step 4c: TH reads Feature dependent(DGWIFI.S.F01) attributes in - attributeList from DUT" - PICS: DGWIFI.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5, 12] - - - label: - "Step 4d: TH reads optional attribute (CurrentMaxRate) in - AttributeList from DUT" - PICS: DGWIFI.S.A000b - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [11] - - - label: "Step 5a: TH reads EventList from DUT" - PICS: - " !DGWIFI.S.E00 && !DGWIFI.S.E01 && !DGWIFI.S.E02 && - PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: - "Step 5b: TH reads optional attribute (Disconnection) in EventList - from DUT" - PICS: DGWIFI.S.E00 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 5c: TH reads optional attribute (AssociationFailure) in - EventList from DUT" - PICS: DGWIFI.S.E01 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 5d: TH reads optional attribute (ConnectionStatus) in EventList - from DUT" - PICS: DGWIFI.S.E02 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 6a: TH reads AcceptedCommandList from DUT" - PICS: " !DGWIFI.S.F01 " - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6b: TH reads Feature dependent(DGWIFI.S.F01) command in - AcceptedCommandList from DUT" - PICS: DGWIFI.S.F01 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads GeneratedCommandList from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_DISHALM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DISHALM_1_1.yaml deleted file mode 100644 index c18c6fc6254636..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DISHALM_1_1.yaml +++ /dev/null @@ -1,114 +0,0 @@ -# Copyright (c) 2023 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 198.1.1. [TC-DISHALM-1.1] Global attributes with DUT as Server - -PICS: - - DISHALM.S - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: "Note" - verification: | - Step 5 is currently not supported and SHALL be skipped. - disabled: true - - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - verification: | - - disabled: true - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - verification: | - ./chip-tool dishwasheralarm read cluster-revision 1 1 - Verify the "ClusterRevision" value is of unit16 and reflects the highest revision number 1 on the TH(Chip-tool) and below is the sample log provided for the raspi platform: - - [1688447208.697823][4176:4178] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_005D Attribute 0x0000_FFFD DataVersion: 1386394810 - [1688447208.701428][4176:4178] CHIP:TOO: ClusterRevision: 1 - [1688447208.701860][4176:4178] CHIP:EM: <<< [E:62008i S:18101 M:251225540 (Ack:117573954)] (S) Msg TX to 1:0000000000000001 [5AF3] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - verification: | - ./chip-tool dishwasheralarm read feature-map 1 1 - On TH(chip-tool), verify that DUT responds the Featuremap value as 1 and below is the sample log provided for the raspi platform: - - [1689841072.440418][2534:2536] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_005D Attribute 0x0000_FFFC DataVersion: 3155962179 - [1689841072.440498][2534:2536] CHIP:TOO: FeatureMap: 1 - [1689841072.440655][2534:2536] CHIP:EM: <<< [E:51712i S:9959 M:43369330 (Ack:105494463)] (S) Msg TX to 1:0000000000000001 [C4B0] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - verification: | - ./chip-tool dishwasheralarm read attribute-list 1 1 - Verify " AttributeList " value consists the list of mandatory attributes (0, 2, 3, 65533, 65532, 65531, 65529, 65528) and optional attributes(1) on the TH(Chip-tool) Log: - Below is the sample log provided for the raspi platform: - [1692613019.157928][10524:10526] CHIP:DMG: } - [1692613019.158276][10524:10526] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_005D Attribute 0x0000_FFFB DataVersion: 2220437053 - [1692613019.158381][10524:10526] CHIP:TOO: AttributeList: 9 entries - [1692613019.158441][10524:10526] CHIP:TOO: [1]: 0 - [1692613019.158479][10524:10526] CHIP:TOO: [2]: 1 - [1692613019.158517][10524:10526] CHIP:TOO: [3]: 2 - [1692613019.158551][10524:10526] CHIP:TOO: [4]: 3 - [1692613019.158587][10524:10526] CHIP:TOO: [5]: 65528 - [1692613019.158622][10524:10526] CHIP:TOO: [6]: 65529 - [1692613019.158657][10524:10526] CHIP:TOO: [7]: 65531 - [1692613019.158692][10524:10526] CHIP:TOO: [8]: 65532 - [1692613019.158727][10524:10526] CHIP:TOO: [9]: 65533 - [1692613019.158909][10524:10526] CHIP:EM: <<< [E:17897i S:25614 M:15345399 (Ack:182319742)] (S) Msg TX to 1:0000000000000001 [5213] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1692613019.158968][10524:10526] CHIP:IN: (S) Sending msg 15345399 on secure session with LSID: 25614 - disabled: true - - - label: "Step 5: TH reads from the DUT the EventList attribute." - verification: | - ./chip-tool dishwasheralarm read event-list 1 1 - Verify " EventList attribute " consists the list may contain optional events(1) on the TH(Chip-tool) Log: - Below is the sample log provided for the raspi platform: - - [1689677416.105596][18367:18369] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_005D Attribute 0x0000_FFFA DataVersion: 1517282962 - [1689677416.105625][18367:18369] CHIP:TOO: EventList: 1 entries - [1689677416.105635][18367:18369] CHIP:TOO: [1]: 0 - [1689677416.105696][18367:18369] CHIP:EM: <<< [E:51484i S:36714 M:192916227 (Ack:1705890)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689677416.105710][18367:18369] CHIP:IN: (S) Sending msg 192916227 on secure session with LSID: 36714 - [1689677416.105737][18367:18369] CHIP:EM: Flushed pending ack for MessageCounter:1705890 on exchange 51484i - disabled: true - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - verification: | - ./chip-tool dishwasheralarm read accepted-command-list 1 1 - Verify " AcceptedCommandList " consists the list of supported events, which for this cluster should be an empty list on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: - - [1689841406.078608][2570:2572] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_005D Attribute 0x0000_FFF9 DataVersion: 3155962179 - [1689841406.078674][2570:2572] CHIP:TOO: AcceptedCommandList: 2 entries - [1689841406.078701][2570:2572] CHIP:TOO: [1]: 0 - [1689841406.078724][2570:2572] CHIP:TOO: [2]: 1 - [1689841406.078870][2570:2572] CHIP:EM: <<< [E:3182i S:59744 M:116852840 (Ack:196212236)] (S) Msg TX to 1:0000000000000001 [C4B0] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - verification: | - ./chip-tool dishwasheralarm read generated-command-list 1 1 - Verify " GeneratedCommandList " consists the list of supported events, which for this cluster should be an empty list on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: - - [1688447564.178537][4220:4222] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0057 Attribute 0x0000_FFF8 DataVersion: 1795162772 - [1688447564.178684][4220:4222] CHIP:TOO: GeneratedCommandList: 0 entries - [1688447564.178984][4220:4222] CHIP:EM: <<< [E:5540i S:25125 M:256711779 (Ack:197472718)] (S) Msg TX to 1:0000000000000001 [10DB] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_DISHM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DISHM_1_1.yaml deleted file mode 100644 index da8a0924274e9e..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DISHM_1_1.yaml +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (c) 2023 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 263.1.1. [TC-DISHM-1.1] Global attributes with DUT as Server - -PICS: - - DISHM.S - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - verification: | - - disabled: true - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - verification: | - ./chip-tool dishwashermode read cluster-revision 1 1 - - Verify the "ClusterRevision" value is of unit16 and reflects the highest revision number 2 on the TH(Chip-tool) and below is the sample log provided for the raspi platform: - - CHIP:DMG : } - CHIP:TOO : Endpoint: 1 Cluster: 0x0000_0059 Attribute 0x0000_FFFD DataVersion: 2488070594 - CHIP:TOO : ClusterRevision: 2 - disabled: true - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - verification: | - ./chip-tool dishwashermode read feature-map 1 1 - - On the TH(Chip-tool) Log, Verify featureMap value is 0 and below is the sample log provided for the raspi platform: - - [1690365613.351850][27441:27443] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0059 Attribute 0x0000_FFFC DataVersion: 1130015440 - [1690365613.351911][27441:27443] CHIP:TOO: FeatureMap: 1 - disabled: true - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - verification: | - ./chip-tool dishwashermode read attribute-list 1 1 - - Verify the "AttributeList " should include the mandatory attributes (values 0, 1), - - Global attributes (value 65533, 65532, 65531, 65529 and 65528) and - - List may include optional attribute(value 0x0002), if DISHM.S.A0002(StartUpMode) supports, on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: - - [1696402605.599359][7921:7923] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0059 Attribute 0x0000_FFFB DataVersion: 712950283 - [1696402605.599377][7921:7923] CHIP:TOO: AttributeList: 9 entries - [1696402605.599382][7921:7923] CHIP:TOO: [1]: 0 - [1696402605.599385][7921:7923] CHIP:TOO: [2]: 1 - [1696402605.599388][7921:7923] CHIP:TOO: [3]: 2 - [1696402605.599391][7921:7923] CHIP:TOO: [4]: 3 - [1696402605.599393][7921:7923] CHIP:TOO: [5]: 65528 - [1696402605.599396][7921:7923] CHIP:TOO: [6]: 65529 - [1696402605.599399][7921:7923] CHIP:TOO: [7]: 65531 - [1696402605.599402][7921:7923] CHIP:TOO: [8]: 65532 - [1696402605.599404][7921:7923] CHIP:TOO: [9]: 65533 - disabled: true - - - label: "Step 5: TH reads from the DUT the EventList attribute." - verification: | - ./chip-tool dishwashermode read event-list 1 1 - - * Step 5 is currently not supported and SHALL be skipped. - - [1696402636.316151][7926:7928] CHIP:DMG: } - [1696402636.316183][7926:7928] CHIP:TOO: Response Failure: IM Error 0x00000586: General error: 0x86 (UNSUPPORTED_ATTRIBUTE) - disabled: true - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - verification: | - ./chip-tool dishwashermode read accepted-command-list 1 1 - - Verify the "AcceptedCommandList" contains a list of mandatory commands (value 0) on the TH (Chip-tool) and below is the sample log provided for the raspi platform: - - [1690365651.143190][27451:27453] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0059 Attribute 0x0000_FFF9 DataVersion: 1130015440 - [1690365651.143256][27451:27453] CHIP:TOO: AcceptedCommandList: 1 entries - [1690365651.143284][27451:27453] CHIP:TOO: [1]: 0 - disabled: true - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - verification: | - ./chip-tool dishwashermode read generated-command-list 1 1 - - Verify " GeneratedCommandList" contains a list of mandatory commands (value 1) on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: - - [1689997224.280302][360025:360027] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0059 Attribute 0x0000_FFF8 DataVersion: 1427220838 - [1689997224.280330][360025:360027] CHIP:TOO: GeneratedCommandList: 1 entries - [1689997224.280346][360025:360027] CHIP:TOO: [1]: 1 - disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_DLOG_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DLOG_1_1.yaml deleted file mode 100644 index 7043c694d41241..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DLOG_1_1.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2021 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. - -name: 56.1.1. [TC-DLOG-1.1] Global Attributes with DUT as Server - -PICS: - - DLOG.S - -config: - nodeId: 0x12344321 - cluster: "Diagnostic Logs" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads the FeatureMap from DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads EventList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [0] - constraints: - type: list - - - label: "Step 7: TH reads GeneratedCommandList from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [1] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_1_1.yaml deleted file mode 100644 index 72cd8f941de50e..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DRLK_1_1.yaml +++ /dev/null @@ -1,544 +0,0 @@ -# Copyright (c) 2021 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. - -name: 113.1.1. [TC-DRLK-1.1] Global Attributes [DUT-Server] - -PICS: - - DRLK.S - -config: - nodeId: 0x12344321 - cluster: "Door Lock" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision from DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 7 - constraints: - type: int16u - - - label: "Step 3a: TH reads the FeatureMap from DUT" - PICS: - " !DRLK.S.F00 && !DRLK.S.F01 && !DRLK.S.F02 && !DRLK.S.F04 && - !DRLK.S.F05 && !DRLK.S.F06 && !DRLK.S.F07 && !DRLK.S.F08 && - !DRLK.S.F0a && !DRLK.S.F0b && !DRLK.S.F0c " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given DRLK.S.F00(PIN) ensure featuremap has the correct bit - set" - PICS: DRLK.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given DRLK.S.F01(RID) ensure featuremap has the correct bit - set" - PICS: DRLK.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given DRLK.S.F02(FGP) ensure featuremap has the correct bit - set" - PICS: DRLK.S.F02 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: - "Step 3e: Given DRLK.S.F04(WDSCH) ensure featuremap has the correct - bit set" - PICS: DRLK.S.F04 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x10] - - - label: - "Step 3f: Given DRLK.S.F05(DPS) ensure featuremap has the correct bit - set" - PICS: DRLK.S.F05 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x20] - - - label: - "Step 3g: Given DRLK.S.F06(FACE) ensure featuremap has the correct bit - set" - PICS: DRLK.S.F06 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x40] - - - label: - "Step 3h: Given DRLK.S.F07(COTA) ensure featuremap has the correct bit - set" - PICS: DRLK.S.F07 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x80] - - - label: - "Step 3i: Given DRLK.S.F08(USR) ensure featuremap has the correct bit - set" - PICS: DRLK.S.F08 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x100] - - - label: - "Step 3j: Given DRLK.S.F0a(YDSCH) ensure featuremap has the correct - bit set" - PICS: DRLK.S.F0a - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x400] - - - label: - "Step 3k: Given DRLK.S.F0b(HDSCH) ensure featuremap has the correct - bit set" - PICS: DRLK.S.F0b - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x800] - - - label: - "Step 3l: Given DRLK.S.F0c(UBOLT) ensure featuremap has the correct - bit set" - PICS: DRLK.S.F0c - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1000] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [0, 1, 2, 37, 38, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 37, 38, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads Feature dependent(DRLK.S.F05) attributes in - AttributeList" - PICS: DRLK.S.F05 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4c: TH reads Feature dependent(DRLK.S.F08) attributes in - AttributeList" - PICS: DRLK.S.F08 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [17, 27, 28] - - - label: - "Step 4d: TH reads Feature dependent(DRLK.S.F00) attributes in - AttributeList" - PICS: DRLK.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [18, 23, 24] - - - label: - "Step 4e: TH reads Feature dependent(DRLK.S.F01) attributes in - AttributeList" - PICS: DRLK.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [19, 25, 26] - - - label: - "Step 4f: TH reads Feature dependent(DRLK.S.F04) attribute in - AttributeList" - PICS: DRLK.S.F04 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [20] - - - label: - "Step 4g: TH reads Feature dependent(DRLK.S.F0a) attribute in - AttributeList" - PICS: DRLK.S.F0a - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [21] - - - label: - "Step 4h: TH reads Feature dependent(DRLK.S.F0b) attribute in - AttributeList" - PICS: DRLK.S.F0b - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [22] - - - label: - "Step 4i: TH reads Feature dependent(DRLK.S.F00 or DRLK.S.F01) - attributes in AttributeList" - PICS: DRLK.S.F00 || DRLK.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [48, 49] - - - label: - "Step 4j: TH reads Feature dependent(DRLK.S.F07 or DRLK.S.F00) - attribute in AttributeList" - PICS: DRLK.S.F07 || DRLK.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [51] - - - label: "Step 4k: TH reads optional attribute(Language) in AttributeList" - PICS: DRLK.S.A0021 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [33] - - - label: - "Step 4l: TH reads optional attribute(LEDSettings) in AttributeList" - PICS: DRLK.S.A0022 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [34] - - - label: - "Step 4m: TH reads optional attribute(AutoRelockTime) in AttributeList" - PICS: DRLK.S.A0023 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [35] - - - label: - "Step 4n: TH reads optional attribute(SoundVolume) in AttributeList" - PICS: DRLK.S.A0024 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [36] - - - label: - "Step 4o: TH reads optional attribute(DefaultConfigurationRegister) in - AttributeList" - PICS: DRLK.S.A0027 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [39] - - - label: - "Step 4p: TH reads optional attribute(EnableLocalProgramming) in - AttributeList" - PICS: DRLK.S.A0028 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [40] - - - label: - "Step 4q: TH reads optional attribute(EnableOneTouchLocking) in - AttributeList" - PICS: DRLK.S.A0029 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [41] - - - label: - "Step 4r: TH reads optional attribute(EnableInsideStatusLED) in - AttributeList" - PICS: DRLK.S.A002a - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [42] - - - label: - "Step 4s: TH reads optional attribute(EnablePrivacyModeButton) in - AttributeList" - PICS: DRLK.S.A002b - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [43] - - - label: - "Step 4t: TH reads optional attribute(LocalProgrammingFeatures) in - AttributeList" - PICS: DRLK.S.A002c - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [44] - - - label: "Step 5a: TH reads EventList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0, 2, 3] - - - label: - "Step 5b: TH reads optional event(Door position sensor) in EventList" - PICS: DRLK.S.F05 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 5c: TH reads optional event(User commands and database) in - EventList" - PICS: DRLK.S.F08 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [4] - - - label: "Step 6a: TH reads AcceptedCommandList from DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1] - - - label: - "Step 6b: TH reads Feature dependent commands(DRLK.S.F04) in - AcceptedCommandList" - PICS: DRLK.S.F04 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [11, 12, 13] - - - label: - "Step 6c: TH reads Feature dependent commands(DRLK.S.F0a) in - AcceptedCommandList" - PICS: DRLK.S.F0a - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [14, 15, 16] - - - label: - "Step 6d: TH reads Feature dependent commands(DRLK.S.F0b) in - AcceptedCommandList" - PICS: DRLK.S.F0b - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [17, 18, 19] - - - label: - "Step 6e: TH reads Feature dependent commands(DRLK.S.F0c) in - AcceptedCommandList" - PICS: DRLK.S.F0c - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [39] - - - label: - "Step 6f: TH reads Feature dependent commands(DRLK.S.F08) in - AcceptedCommandList" - PICS: DRLK.S.F08 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [26, 27, 29, 34, 36, 38] - - - label: - "Step 6g: TH reads optional commands(DRLK.S.C03.Rsp) in - AcceptedCommandList" - PICS: DRLK.S.C03.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 7a: TH reads Feature dependent command(DRLK.S.F04) in - GeneratedCommandList" - PICS: DRLK.S.F04 - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [12] - - - label: - "Step 7b: TH reads Feature dependent command(DRLK.S.F0a) in - GeneratedCommandList" - PICS: DRLK.S.F0a - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [15] - - - label: - "Step 7c: TH reads Feature dependent command(DRLK.S.F0b) in - GeneratedCommandList" - PICS: DRLK.S.F0b - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [18] - - - label: - "Step 7d: TH reads Feature dependent command(DRLK.S.F08) in - GeneratedCommandList" - PICS: DRLK.S.F08 - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [28, 35, 37] diff --git a/src/app/tests/suites/certification/Test_TC_DRYERCTRL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DRYERCTRL_1_1.yaml deleted file mode 100644 index 3edb48072708bd..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_DRYERCTRL_1_1.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2023 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. - -name: 3.1.1. [TC-DRYERCTRL-1.1] Global attributes with server as DUT - -PICS: - - DRYERCTRL.S - -config: - nodeId: 0x12344321 - cluster: "Laundry Dryer Controls" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_EEVSEM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_EEVSEM_1_1.yaml deleted file mode 100644 index 769dc5d3cba3ac..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_EEVSEM_1_1.yaml +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2024 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. - -name: 265.1.1. [TC-EEVSEM-1.1] Global Attributes with DUT as Server - -PICS: - - EEVSEM.S - -config: - nodeId: 0x12344321 - cluster: "Energy EVSE Mode" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - #https://github.com/project-chip/connectedhomeip/issues/31599 - - label: "Step 3: TH reads from the DUT the FeatureMap attribute" - verification: | - ./chip-tool energyevsemode read feature-map 1 1 - - On the TH(Chip-tool) Log, Verify featureMap value is 0 and below is the sample log provided for the raspi platform: - - [1707803286.349129][12699:12701] CHIP:DMG: } - [1707803286.349183][12699:12701] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009D Attribute 0x0000_FFFC DataVersion: 811903427 - [1707803286.349202][12699:12701] CHIP:TOO: FeatureMap: 0 - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP - arguments: - values: - - name: "message" - value: "Enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 4: TH reads from the DUT the AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads optional attribute (StartUpMode) in AttributeList - from DUT" - PICS: EEVSEM.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 5: TH reads EventList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads AcceptedCommandList from DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [0] - constraints: - type: list - - - label: "Step 7: TH reads GeneratedCommandList from DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [1] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_EEVSE_1_1.yaml b/src/app/tests/suites/certification/Test_TC_EEVSE_1_1.yaml deleted file mode 100644 index 0be6a9015ed5e9..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_EEVSE_1_1.yaml +++ /dev/null @@ -1,301 +0,0 @@ -# Copyright (c) 2024 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. - -name: 265.1.1. [TC-EEVSE-1.1] Global Attributes with DUT as Server - -PICS: - - EEVSE.S - -config: - nodeId: 0x12344321 - cluster: "Energy EVSE" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute" - PICS: - "!EEVSE.S.F00 && !EEVSE.S.F01 && !EEVSE.S.F02 && !EEVSE.S.F03 && - !EEVSE.S.F04" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given EEVSE.S.F00(ChargingPreferences) ensure featuremap has - the correct bit set" - PICS: EEVSE.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3b: Given EEVSE.S.F01(SoCReporting) ensure featuremap has the - correct bit set" - PICS: EEVSE.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3b: Given EEVSE.S.F02(PlugAndCharge) ensure featuremap has the - correct bit set" - PICS: EEVSE.S.F02 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: - "Step 3b: Given EEVSE.S.F03(RFID) ensure featuremap has the correct - bit set" - PICS: EEVSE.S.F03 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x8] - - - label: - "Step 3b: Given EEVSE.S.F04(V2X) ensure featuremap has the correct bit - set" - PICS: EEVSE.S.F04 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x10] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0, - 1, - 2, - 3, - 5, - 6, - 7, - 64, - 65, - 66, - 65528, - 65529, - 65530, - 65531, - 65532, - 65533, - ] - - - label: "Step 4a: TH reads AttributeList from DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0, - 1, - 2, - 3, - 5, - 6, - 7, - 64, - 65, - 66, - 65528, - 65529, - 65531, - 65532, - 65533, - ] - - - label: - "Step 4b: TH reads optional attribute (UserMaximumChargeCurrent) in - AttributeList from DUT" - PICS: EEVSE.S.A0009 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [9] - - - label: - "Step 4c: TH reads optional attribute (RandomizationDelayWindow) in - AttributeList from DUT" - PICS: EEVSE.S.A000A - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [10] - - - label: - "Step 4d: TH reads optional attribute (V2X) in AttributeList from DUT" - PICS: EEVSE.S.F04 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4, 8, 67] - - - label: - "Step 4e: TH reads optional attribute (ChargingPreferences) in - AttributeList from DUT" - PICS: EEVSE.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [35, 36, 37, 38, 39] - - - label: - "Step 4e: TH reads optional attribute (SoCReporting) in AttributeList - from DUT" - PICS: EEVSE.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [48, 49] - - - label: - "Step 4f: TH reads optional attribute (PlugAndCharge) in AttributeList - from DUT" - PICS: EEVSE.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [50] - - - label: "Step 5a: TH reads EventList from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 4] - - - label: "Step 5b: TH reads optional attribute (RFID) in EventList from DUT" - PICS: EEVSE.S.F03 && PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [5] - - - label: "Step 6a: TH reads AcceptedCommandList from DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [1, 2] - - - label: - "Step 6b: TH reads the optional (StartDiagnostics) command in - AcceptedCommandList" - PICS: EEVSE.S.C04.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 6c: TH reads Feature dependent commands(EEVSE.S.F04) in - AcceptedCommandList" - PICS: EEVSE.S.F04 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 6d: TH reads Feature dependent commands(ChargingPreferences) in - AcceptedCommandList" - PICS: EEVSE.S.F00 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [5, 6, 7] - - - label: "Step 7a: TH reads GeneratedCommandList from DUT" - PICS: " !EEVSE.S.F00 " - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7b: TH reads GeneratedCommandList from DUT" - PICS: EEVSE.S.F00 - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [0] diff --git a/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml b/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml deleted file mode 100644 index e8986134e769eb..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml +++ /dev/null @@ -1,217 +0,0 @@ -# Copyright (c) 2023 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. - -name: 263.1.1. [TC-FAN-1.1] Global attributes with DUT as Server - -PICS: - - FAN.S - -config: - nodeId: 0x12344321 - cluster: "Fan Control" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 4 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - PICS: - " !FAN.S.F00 && !FAN.S.F01 && !FAN.S.F02 && !FAN.S.F03 && !FAN.S.F04 - && !FAN.S.F05 " - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given FAN.S.F00(SPD) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: FAN.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given FAN.S.F01(AUT) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: FAN.S.F01 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given FAN.S.F02(RCK) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: FAN.S.F02 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: - "Step 3e: Given FAN.S.F03(WND) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: FAN.S.F03 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x8] - - - label: - "Step 3f: Given FAN.S.F04(STEP) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: FAN.S.F04 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x10] - - - label: - "Step 3g: Given FAN.S.F05(DIR) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: FAN.S.F05 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x20] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4c: TH Reads the feature dependent FAN.S.F00 (SPD) attribute in - AttributeList" - PICS: FAN.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4, 5, 6] - - - label: - "Step 4d: TH Reads the feature dependent FAN.S.F02(RCK) attribute in - AttributeList" - PICS: FAN.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [7, 8] - - - label: - "Step 4e: TH Reads the feature dependent FAN.S.F03(WND) attribute in - AttributeList" - PICS: FAN.S.F03 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [9, 10] - - - label: - "Step 4f: TH Reads the feature dependent FAN.S.F05(DIR) attribute in - AttributeList" - PICS: FAN.S.F05 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [11] - - - label: "Step 5: TH reads EventList attribute from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6:TH reads from the DUT the AcceptedCommandList attribute." - PICS: " !FAN.S.C00.Rsp " - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6: TH Reads the optional command (Step) in AcceptedCommandList" - PICS: FAN.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_FLABEL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_FLABEL_1_1.yaml deleted file mode 100644 index bc66790a65f18f..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_FLABEL_1_1.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2021 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. - -name: 110.1.1. [TC-FLABEL-1.1] Global Attributes with DUT as Server - -PICS: - - FLABEL.S - -config: - nodeId: 0x12344321 - cluster: "Fixed Label" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_FLW_1_1.yaml b/src/app/tests/suites/certification/Test_TC_FLW_1_1.yaml deleted file mode 100644 index c1b3de22020da0..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_FLW_1_1.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (c) 2021 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. - -name: 33.1.1. [TC-FLW-1.1] Global Attributes with DUT as Server - -PICS: - - FLW.S - -config: - nodeId: 0x12344321 - cluster: "Flow Measurement" - endpoint: 1 - -tests: - - label: - "Step 1:Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 3 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the optional attribute(Tolerance) in AttributeList" - PICS: FLW.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_GRPKEY_1_1.yaml b/src/app/tests/suites/certification/Test_TC_GRPKEY_1_1.yaml deleted file mode 100644 index ea77cb6fb19f7d..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_GRPKEY_1_1.yaml +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright (c) 2023 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. - -name: 26.1.1. [TC-GRPKEY-1.1] Global Attributes with DUT as Server - -PICS: - - GRPKEY.S - -config: - nodeId: 0x12344321 - cluster: "Group Key Management" - endpoint: 0 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - PICS: " !GRPKEY.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given GRPKEY.S.F00(CS) ensure featuremap has the correct bit - set" - PICS: GRPKEY.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: " !PICS_EVENT_LIST_ENABLED " - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1, 3, 4] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [2, 5] diff --git a/src/app/tests/suites/certification/Test_TC_G_1_1.yaml b/src/app/tests/suites/certification/Test_TC_G_1_1.yaml deleted file mode 100644 index 305dc43ae0de62..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_G_1_1.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (c) 2021 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. - -name: 121.1.1. [TC-G-1.1] Global Attributes with DUT as Server - -PICS: - - G.S - -config: - nodeId: 0x12344321 - cluster: "Groups" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 4 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - PICS: " !G.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3b: Given G.S.F00 ensure featuremap has the correct bit set" - PICS: G.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 4, 5] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [0, 1, 2, 3] diff --git a/src/app/tests/suites/certification/Test_TC_HEPAFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_HEPAFREMON_1_1.yaml deleted file mode 100644 index 5ae91d71678e31..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_HEPAFREMON_1_1.yaml +++ /dev/null @@ -1,183 +0,0 @@ -# Copyright (c) 2023 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. - -name: 165.1.1. [TC-HEPAFREMON-1.1] Global Attributes with DUT as Server - -PICS: - - HEPAFREMON.S - -config: - nodeId: 0x12344321 - cluster: "HEPA Filter Monitoring" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - PICS: "!HEPAFREMON.S.F00 && !HEPAFREMON.S.F01 && !HEPAFREMON.S.F02" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given HEPAFREMON.S.F00(Condition) ensure featuremap has the - correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: HEPAFREMON.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given HEPAFREMON.S.F01(Warning) ensure featuremap has the - correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: HEPAFREMON.S.F01 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given HEPAFREMON.S.F02(ReplacementProductList) ensure - featuremap has the correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: HEPAFREMON.S.F02 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the feature dependent(HEPAFREMON.S.F00) attribute - in AttributeList" - PICS: HEPAFREMON.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2] - - - label: - "Step 4c: TH reads the optional attribute InPlaceIndicator - (HEPAFREMON.S.A0003) in AttributeList" - PICS: HEPAFREMON.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4d: TH reads the optional attribute LastChangedTime - (HEPAFREMON.S.A0004) in AttributeList" - PICS: HEPAFREMON.S.A0004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 4e: TH reads the optional attribute ReplacementProductList - (HEPAFREMON.S.F02) in AttributeList" - PICS: HEPAFREMON.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - PICS: "!HEPAFREMON.S.C00.Rsp" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6: TH reads the optional command (ResetCondition) in - AcceptedCommandList" - PICS: HEPAFREMON.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_ILL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ILL_1_1.yaml deleted file mode 100644 index 76f371c1145bf5..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_ILL_1_1.yaml +++ /dev/null @@ -1,114 +0,0 @@ -# Copyright (c) 2021 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. - -name: 71.1.1. [TC-ILL-1.1] Global attributes with server as DUT - -PICS: - - ILL.S - -config: - nodeId: 0x12344321 - cluster: "Illuminance Measurement" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision attribute from the DUT." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 3 - constraints: - type: int16u - - - label: "Step 3: TH reads the FeatureMap attribute from the DUT." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads the AttributeList attribute from the DUT." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads the AttributeList attribute from the DUT." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the optional attribute(Tolerance) in AttributeList" - PICS: ILL.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4c: TH reads the optional attribute(LightSensorType) in - AttributeList" - PICS: ILL.S.A0004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: "Step 5: TH reads the EventList attribute from the DUT." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads the AcceptedCommandList attribute from the DUT." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads the GeneratedCommandList attribute from the DUT." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_I_1_1.yaml b/src/app/tests/suites/certification/Test_TC_I_1_1.yaml deleted file mode 100644 index ab2e3cffa89628..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_I_1_1.yaml +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (c) 2021 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. - -name: 57.1.1. [TC-I-1.1] Global Attributes with DUT as Server - -PICS: - - I.S - -config: - nodeId: 0x12344321 - cluster: "Identify" - endpoint: 1 - -tests: - - label: - "Step 1:Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 4 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - #Commenting out the step FeatureMap attribute feature PICS I.S.F00(QRY) which is out of scope for matter V1.0 - #- label: "TH reads the FeatureMap attribute from the DUT" - # PICS: I.S.F00 - # command: "readAttribute" - # attribute: "FeatureMap" - # response: - # value: 1 - # constraints: - # type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - #Manufacturer specific event IDs check not possible - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 6: TH reads the optional command(TriggerEffect) in - AcceptedCommandList" - PICS: I.S.C40.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [64] - - #Commenting out the step IdentifyQuery (0x01) is not supported by Matter 1.0. - #- label: "TH reads the optional attribute(IdentifyQuery) in AcceptedCommandList" - # PICS: I.S.C01.Rsp - # command: "readAttribute" - # attribute: "AcceptedCommandList" - # response: - # constraints: - # type: list - # contains: [1] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - #Commenting out the step IdentifyQueryResponse (0x00) is not supported by Matter 1.0 - #- label: - # "TH reads the optional command(IdentifyQueryResponse) in - # GeneratedCommandList" - # PICS: I.S.C00.Tx - # command: "readAttribute" - # attribute: "GeneratedCommandList" - # response: - # value: [0] - # constraints: - # type: list diff --git a/src/app/tests/suites/certification/Test_TC_KEYPADINPUT_1_2.yaml b/src/app/tests/suites/certification/Test_TC_KEYPADINPUT_1_2.yaml deleted file mode 100644 index 20cd640da5dfd1..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_KEYPADINPUT_1_2.yaml +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.2. [TC-KEYPADINPUT-1.2] Global attributes - Keypad Input Cluster (DUT - as Server) - -PICS: - - KEYPADINPUT.S - -config: - nodeId: 0x12344321 - cluster: "Keypad Input" - endpoint: 1 - -tests: - - label: - "Commission DUT to TH (can be skipped if done in a preceding test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 2a: TH reads the FeatureMap attribute from the DUT" - PICS: " !KEYPADINPUT.S.F00 && KEYPADINPUT.S.F01 && !KEYPADINPUT.S.F02 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 2b: Given (KEYPADINPUT.S.F00(NV)) FeatureMap bit mask is set or - not" - PICS: KEYPADINPUT.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 2c: Given (KEYPADINPUT.S.F01(LK)) FeatureMap bit mask is set or - not" - PICS: KEYPADINPUT.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 2d: Given (KEYPADINPUT.S.F02(NK)) FeatureMap bit mask is set or - not" - PICS: KEYPADINPUT.S.F02 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_LCFG_1_1.yaml b/src/app/tests/suites/certification/Test_TC_LCFG_1_1.yaml deleted file mode 100644 index 6cd288c1a26d5d..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_LCFG_1_1.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2021 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. - -name: 101.1.1. [TC-LCFG-1.1] Global Attributes with DUT as Server - -PICS: - - LCFG.S - -config: - nodeId: 0x12344321 - cluster: "Localization Configuration" - endpoint: 0 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_LOWPOWER_1_1.yaml b/src/app/tests/suites/certification/Test_TC_LOWPOWER_1_1.yaml deleted file mode 100644 index c71888c3477df0..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_LOWPOWER_1_1.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.1. [TC-LOWPOWER-1.1] Global attributes - Low Power Cluster (DUT as - Server) - -PICS: - - LOWPOWER.S - -config: - nodeId: 0x12344321 - cluster: "Low Power" - endpoint: 1 - -tests: - - label: "Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 2: TH reads the FeatureMap attribute from the DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - value: [65528, 65529, 65530, 65531, 65532, 65533] - constraints: - type: list - - - label: "Step 3: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - value: [65528, 65529, 65531, 65532, 65533] - constraints: - type: list - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [0] - constraints: - type: list - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_LUNIT_1_2.yaml b/src/app/tests/suites/certification/Test_TC_LUNIT_1_2.yaml deleted file mode 100644 index ab55e650535f86..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_LUNIT_1_2.yaml +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright (c) 2021 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. - -name: 108.1.2. [TC-LUNIT-1.2] Global Attributes with DUT as Server - -PICS: - - LUNIT.S - -config: - nodeId: 0x12344321 - cluster: "Unit Localization" - endpoint: 0 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: " !LUNIT.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3: Given LUNIT.S.F00(TEMP) ensure featuremap has the correct bit - set" - PICS: LUNIT.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads Feature dependent(LUNIT.S.F00) attribute in - AttributeList" - PICS: LUNIT.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_LVL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_1_1.yaml deleted file mode 100644 index 76ca0f322f0e64..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_LVL_1_1.yaml +++ /dev/null @@ -1,224 +0,0 @@ -# Copyright (c) 2021 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. - -name: 18.1.1. [TC-LVL-1.1] Global Attributes with DUT as Server - -PICS: - - LVL.S - -config: - nodeId: 0x12344321 - cluster: "Level Control" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 5 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - PICS: " !LVL.S.F00 && !LVL.S.F01 && !LVL.S.F02 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given LVL.S.F00(OO) ensure featuremap has the correct bit - set" - PICS: LVL.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given LVL.S.F01(LT) ensure featuremap has the correct bit - set" - PICS: LVL.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given LVL.S.F02(FQ) ensure featuremap has the correct bit - set" - PICS: LVL.S.F02 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 15, 17, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 15, 17, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4a: TH reads the optional attribute(StartUpCurrentLevel and - RemainingTime) in AttributeList" - PICS: LVL.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1, 16384] - - - label: - "Step 4b: TH reads the optional attribute(CurrentFrequency, - MinFrequency and MinFrequency) in AttributeList" - PICS: LVL.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4, 5, 6] - - - label: - "Step 4c: TH reads the optional attribute(MinLevel) in AttributeList" - PICS: LVL.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4d: TH reads the optional attribute(MaxLevel) in AttributeList" - PICS: LVL.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4e: TH reads the optional attribute(OnOffTransitionTime) in - AttributeList" - PICS: LVL.S.A0010 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16] - - - label: - "Step 4f: TH reads the optional attribute(OnTransitionTime) in - AttributeList" - PICS: LVL.S.A0012 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [18] - - - label: - "Step 4g: TH reads the optional attribute(OffTransitionTime) in - AttributeList" - PICS: LVL.S.A0013 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [19] - - - label: - "Step 4h: TH reads the optional attribute(DefaultMoveRate) in - AttributeList" - PICS: LVL.S.A0014 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [20] - - - label: "Step 5: Read the global attribute: EventList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6a: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 4, 5, 6, 7] - - - label: - "Step 6a.1: TH reads the Feature-dependent(LVL.S.F02) command in - AcceptedCommandList" - PICS: LVL.S.F02 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [8] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_LWM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_LWM_1_1.yaml deleted file mode 100644 index 0b8b51fcbe3f10..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_LWM_1_1.yaml +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright (c) 2023 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. - -name: 183.1.2. [TC-LWM-1.1] Cluster attributes with DUT as Server - -PICS: - - LWM.S - -config: - nodeId: 0x12344321 - cluster: "Laundry Washer Mode" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - #Issue https://github.com/project-chip/connectedhomeip/issues/31551 - - label: - "Step 3:TH reads from the DUT the FeatureMap attribute., bit 0: SHALL - be 1 if and only if LWM.S.F00" - command: "readAttribute" - attribute: "FeatureMap" - PICS: LWM.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - PICS: " !LWM.S.F00 " - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the optional attribute(StartUpMode) in - AttributeList" - PICS: LWM.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - #Issue https://github.com/project-chip/connectedhomeip/issues/31551 - - label: - "Step 4c: TH reads the Feature dependent attribute in AttributeList" - PICS: LWM.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1] diff --git a/src/app/tests/suites/certification/Test_TC_MEDIAINPUT_1_4.yaml b/src/app/tests/suites/certification/Test_TC_MEDIAINPUT_1_4.yaml deleted file mode 100644 index 793d412532a3bd..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_MEDIAINPUT_1_4.yaml +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.4. [TC-MEDIAINPUT-1.4] Global attributes - Media Input Cluster (DUT as - Server) - -PICS: - - MEDIAINPUT.S - -config: - nodeId: 0x12344321 - cluster: "Media Input" - endpoint: 1 - -tests: - - label: - "Step 0: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 2: TH reads the FeatureMap attribute from the DUT" - PICS: " !MEDIAINPUT.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 2: Given MEDIAINPUT.S.F00(NU) ensure featuremap has the correct - bit set" - PICS: MEDIAINPUT.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: - "Step 3b: TH reads the optional attribute(InputList) in AttributeList" - PICS: MEDIAINPUT.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 3c: TH reads the optional attribute(CurrentInput) in - AttributeList" - PICS: MEDIAINPUT.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1, 2, 3] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_MEDIAPLAYBACK_1_7.yaml b/src/app/tests/suites/certification/Test_TC_MEDIAPLAYBACK_1_7.yaml deleted file mode 100644 index c3b55fd4e3bbac..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_MEDIAPLAYBACK_1_7.yaml +++ /dev/null @@ -1,266 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.7. [TC-MEDIAPLAYBACK-1.7] Global attributes - Media Playback Cluster - (DUT as Server) - -PICS: - - MEDIAPLAYBACK.S - -config: - nodeId: 0x12344321 - cluster: "Media Playback" - endpoint: 1 - -tests: - - label: - "Commission DUT to TH (can be skipped if done in a preceding test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 2a: TH reads the FeatureMap attribute from the DUT" - PICS: " !MEDIAPLAYBACK.S.F00 && !MEDIAPLAYBACK.S.F01 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 2b: Given MEDIAPLAYBACK.S.F00(AS) ensure featuremap has the - correct bit set" - PICS: MEDIAPLAYBACK.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 2c: Given MEDIAPLAYBACK.S.F01(VS) ensure featuremap has the - correct bit set" - PICS: MEDIAPLAYBACK.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 3b: TH reads the optional attribute(StartTime) in AttributeList" - PICS: MEDIAPLAYBACK.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 3c: TH reads the optional attribute(Duration) in AttributeList" - PICS: MEDIAPLAYBACK.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 3d: TH reads the optional attribute(SampledPosition) in - AttributeList" - PICS: MEDIAPLAYBACK.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 3e: TH reads the optional attribute(PlaybackSpeed) in - AttributeList" - PICS: MEDIAPLAYBACK.S.A0004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 3f: TH reads the optional attribute(SeekRangeEnd) in - AttributeList" - PICS: MEDIAPLAYBACK.S.A0005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 3g: TH reads the optional attribute(SeekRangeStart) in - AttributeList" - PICS: MEDIAPLAYBACK.S.A0006 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [6] - - - label: "Step 4a: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1, 2] - - - label: - "Step 4b: TH reads the optional command(StartOver) in - AcceptedCommandList" - PICS: MEDIAPLAYBACK.S.C03.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4c: TH reads the optional command(Previous) in - AcceptedCommandList" - PICS: MEDIAPLAYBACK.S.C04.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 4d: TH reads the optional command(Next) in AcceptedCommandList" - PICS: MEDIAPLAYBACK.S.C05.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 4e: TH reads the optional command(Rewind) in AcceptedCommandList" - PICS: MEDIAPLAYBACK.S.C06.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [6] - - - label: - "Step 4f: TH reads the optional command(FastForward) in - AcceptedCommandList" - PICS: MEDIAPLAYBACK.S.C07.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [7] - - - label: - "Step 4g: TH reads the optional command(SkipForward) in - AcceptedCommandList" - PICS: MEDIAPLAYBACK.S.C08.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [8] - - - label: - "Step 4h: TH reads the optional command(SkipBackward) in - AcceptedCommandList" - PICS: MEDIAPLAYBACK.S.C09.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [9] - - - label: - "Step 4i: TH reads the optional command(Seek) in AcceptedCommandList" - PICS: MEDIAPLAYBACK.S.C0b.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [11] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [10] - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_MOD_1_1.yaml b/src/app/tests/suites/certification/Test_TC_MOD_1_1.yaml deleted file mode 100644 index dc00d3b0f2a39f..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_MOD_1_1.yaml +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright (c) 2021 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. - -name: 78.1.1. [TC-MOD-1.1] Global attributes with server as DUT - -PICS: - - MOD.S - -config: - nodeId: 0x12344321 - cluster: "Mode Select" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: MOD.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 1 - constraints: - type: bitmap32 - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: " !MOD.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the optional attribute(StartUpMode) in - AttributeList from the DUT" - PICS: MOD.S.A0004 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [4] - - - label: - "Step 4c: TH reads the Feature dependent attribute(OnMode) in - AttributeList from the DUT" - PICS: MOD.S.F00 && MOD.S.A0005 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_MWOM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_MWOM_1_1.yaml deleted file mode 100644 index a35aa47a01870f..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_MWOM_1_1.yaml +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) 2024 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. - -name: 263.1.1. [TC-MWOM-1.1] Global attributes with DUT as Server - -PICS: - - MWOM.S - -config: - nodeId: 0x12344321 - cluster: "Microwave Oven Mode" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: Read the global attribute: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: Read the global attribute: FeatureMap" - command: "readAttribute" - attribute: "FeatureMap" - PICS: "!MWOM.S.F00" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: Read the global attribute: AttributeList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - excludes: [2, 3] - - - label: "Step 4b: Read the global attribute: AttributeList" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - excludes: [2, 3] - - - label: "Step 5: TH reads EventList attribute from DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - excludes: [0] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - excludes: [1] diff --git a/src/app/tests/suites/certification/Test_TC_OCC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_OCC_1_1.yaml deleted file mode 100644 index b62cc83b374141..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_OCC_1_1.yaml +++ /dev/null @@ -1,198 +0,0 @@ -# Copyright (c) 2021 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. - -name: 24.1.1. [TC-OCC-1.1] Global attributes with server as DUT - -PICS: - - OCC.S - -config: - nodeId: 0x12344321 - cluster: "Occupancy Sensing" - endpoint: 1 - -tests: - - label: "Step 1: Commission DUT to TH" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: - "Step 2: TH reads from the DUT the (0xFFFD) ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 4 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the (0xFFFC) FeatureMap attribute" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 4a: TH reads from the DUT the (0xFFFB) AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: - "Step 4a: TH reads from the DUT the (0xFFFB) AttributeList attribute" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads optional attribute(PIROccupiedToUnoccupiedDelay) in - AttributeList" - PICS: OCC.S.A0010 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16] - - - label: - "Step 4c: TH reads optional attribute(PIRUnoccupiedToOccupiedDelay) in - AttributeList" - PICS: OCC.S.A0011 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [17] - - - label: - "Step 4d: TH reads optional - attribute(PIRUnoccupiedToOccupiedThreshold) in AttributeList" - PICS: OCC.S.A0012 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [18] - - - label: - "Step 4e: TH reads optional - attribute(UltrasonicOccupiedToUnoccupiedDelay) in AttributeList" - PICS: OCC.S.A0020 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [32] - - - label: - "Step 4f: TH reads optional - attribute(UltrasonicUnoccupiedToOccupiedDelay) in AttributeList" - PICS: OCC.S.A0021 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [33] - - - label: - "Step 4g: TH reads optional - attribute(UltrasonicUnoccupiedToOccupiedThreshold) in AttributeList" - PICS: OCC.S.A0022 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [34] - - - label: - "Step 4h: TH reads optional - attribute(PhysicalContactOccupiedToUnoccupiedDelay) in AttributeList" - PICS: OCC.S.A0030 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [48] - - - label: - "Step 4i: TH reads the optional - attribute(PhysicalContactUnoccupiedToOccupiedDelay) in AttributeList" - PICS: OCC.S.A0031 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [49] - - - label: - "Step 4j: TH reads optional - attribute(PhysicalContactUnoccupiedToOccupiedThreshold) in - AttributeList" - PICS: OCC.S.A0032 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [50] - - - label: "Step 5: TH reads from the DUT the (0xFFFA) EventList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6: TH reads from the DUT the (0xFFF9) AcceptedCommandList - attribute" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: - "Step 7: TH reads from the DUT the (0xFFF8) GeneratedCommandList - attribute" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_OO_1_1.yaml b/src/app/tests/suites/certification/Test_TC_OO_1_1.yaml deleted file mode 100644 index 5b44953041dac7..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_OO_1_1.yaml +++ /dev/null @@ -1,207 +0,0 @@ -# Copyright (c) 2021 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. - -name: 4.1.1. [TC-OO-1.1] Global Attributes with DUT as Server - -PICS: - - OO.S - -config: - nodeId: 0x12344321 - cluster: "On/Off" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - #Issue: https://github.com/project-chip/connectedhomeip/issues/29786 - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 6 - constraints: - type: int16u - - - label: - "Step 3a: Given OO.S.F00(LT) ensure featuremap has the correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: ( OO.S.F00 && !OO.S.F02 ) - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - label: - "Step 3b: Given OO.S.F00(LT) ensure featuremap has the correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: ( !( OO.S.F00 && !OO.S.F02 ) ) - response: - constraints: - type: bitmap32 - hasMasksClear: [0x1] - - - label: - "Step 3c: Given OO.S.F01(DF) ensure featuremap has the correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: ( OO.S.F01 && !OO.S.F02 ) - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - label: - "Step 3d: Given OO.S.F01(DF) ensure featuremap has the correct bit set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: ( !( OO.S.F01 && !OO.S.F02 ) ) - response: - constraints: - type: bitmap32 - hasMasksClear: [0x2] - - - label: - "Step 3e: Given OO.S.F02(OFFONLY) TH reads from the DUT the FeatureMap - attribute." - command: "readAttribute" - attribute: "FeatureMap" - PICS: ( OO.S.F02 && !OO.S.F00 && !OO.S.F01 ) - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - label: - "Step 3f: Given OO.S.F02(OFFONLY) TH reads from the DUT the FeatureMap - attribute." - command: "readAttribute" - attribute: "FeatureMap" - PICS: ( !( OO.S.F02 && !OO.S.F00 && !OO.S.F01 ) ) - response: - constraints: - type: bitmap32 - hasMasksClear: [0x4] - - label: "Step 3g: All remaining shall be zero" - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksClear: [0xFFFFFFF8] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the feature dependent(OO.S.F00) attribute in - AttributeList" - PICS: OO.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16384, 16385, 16386, 16387] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6a: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: - "Step 6b: TH reads the feature dependent(OO.S.F02) commands in - AcceptedCommandList" - command: "readAttribute" - attribute: "AcceptedCommandList" - PICS: ( !OO.S.F02 ) - response: - constraints: - type: list - contains: [1, 2] - - - label: - "Step 6c: TH reads the feature dependent(OO.S.F02) commands in - AcceptedCommandList" - command: "readAttribute" - attribute: "AcceptedCommandList" - PICS: OO.S.F02 - response: - constraints: - type: list - excludes: [1, 2] - - - label: - "Step 6d: TH reads the feature dependent(OO.S.F00) commands in - AcceptedCommandList" - command: "readAttribute" - attribute: "AcceptedCommandList" - PICS: OO.S.F00 - response: - constraints: - type: list - contains: [64, 65, 66] - - - label: - "Step 6e: TH reads the feature dependent(OO.S.F00) commands in - AcceptedCommandList" - command: "readAttribute" - attribute: "AcceptedCommandList" - PICS: ( !OO.S.F00 ) - response: - constraints: - type: list - excludes: [64, 65, 66] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_OPCREDS_1_2.yaml b/src/app/tests/suites/certification/Test_TC_OPCREDS_1_2.yaml deleted file mode 100644 index cce8acd22655ca..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_OPCREDS_1_2.yaml +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright (c) 2021 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 11.1.2. [TC-OPCREDS-1.2] Global Attributes with DUT as Server - -PICS: - - OPCREDS.S - -config: - nodeId: 0x12344321 - cluster: "Operational Credentials" - endpoint: 0 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0xFFFD, - 0xFFFC, - 0xFFFB, - 0xFFFA, - 0xFFF9, - 0xFFF8, - 0x00, - 0x01, - 0x02, - 0x03, - 0x04, - 0x05, - ] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0xFFFD, - 0xFFFC, - 0xFFFB, - 0xFFF9, - 0xFFF8, - 0x00, - 0x01, - 0x02, - 0x03, - 0x04, - 0x05, - ] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0x00, 0x02, 0x04, 0x06, 0x07, 0x09, 0x0a, 0x0b] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [0x01, 0x03, 0x05, 0x08] diff --git a/src/app/tests/suites/certification/Test_TC_OTCCM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_OTCCM_1_1.yaml deleted file mode 100644 index 008c608c9736ba..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_OTCCM_1_1.yaml +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright (c) 2023 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. - -name: 260.1.1. [TC-OTCCM-1.1] Global attributes with DUT as Server - -PICS: - - OTCCM.S - -config: - nodeId: 0x12344321 - cluster: "Oven Mode" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: Read the optional attribute(StartUpMode) in AttributeList" - PICS: OTCCM.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1] diff --git a/src/app/tests/suites/certification/Test_TC_PRS_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PRS_1_1.yaml deleted file mode 100644 index 3d6f49e133bdd4..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_PRS_1_1.yaml +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright (c) 2021 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. - -name: 36.1.1. [TC-PRS-1.1] Global Attributes with DUT as Server - -PICS: - - PRS.S - -config: - nodeId: 0x12344321 - cluster: "Pressure Measurement" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 3 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: " !PRS.S.F00 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3: Given PRS.S.F00(EXT) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: PRS.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the optional attribute(ScaledValue) in - AttributeList" - PICS: PRS.S.A0010 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [16] - - - label: - "Step 4c: TH reads the optional attribute(MinScaledValue) in - AttributeList" - PICS: PRS.S.A0011 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [17] - - - label: - "Step 4d: TH reads the optional attribute(MaxScaledValue) in - AttributeList" - PICS: PRS.S.A0012 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [18] - - - label: "Step 4e: TH reads the optional attribute(Scale) in AttributeList" - PICS: PRS.S.A0014 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [20] - - - label: - "Step 4f: TH reads the optional attribute(Tolerance) in AttributeList" - PICS: PRS.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4g: TH reads the optional attribute(ScaledTolerance) in - AttributeList" - PICS: PRS.S.A0013 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [19] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: - "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_PSCFG_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PSCFG_1_1.yaml deleted file mode 100644 index d3ec7430f62bfe..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_PSCFG_1_1.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2021 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. - -name: 63.1.1. [TC-PSCFG-1.1] Global Attributes with DUT as Server - -PICS: - - PSCFG.S - -config: - nodeId: 0x12344321 - cluster: "Power Source Configuration" - endpoint: 0 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml deleted file mode 100644 index f0ac68665894fb..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml +++ /dev/null @@ -1,211 +0,0 @@ -# Copyright (c) 2021 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. - -name: 62.1.1. [TC-PS-1.1] Global Attributes with DUT as Server - -PICS: - - PS.S - -config: - nodeId: 0x12344321 - cluster: "Power Source" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: Test Harness Client reads ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - PICS: " !PS.S.F00 && !PS.S.F01 && !PS.S.F02 && !PS.S.F03 " - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given PS.S.F00(WIRED) ensure featuremap has the correct bit - set" - PICS: PS.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given PS.S.F01(BAT) ensure featuremap has the correct bit - set" - PICS: PS.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3c: Given PS.S.F02(RECHG) ensure featuremap has the correct bit - set" - PICS: PS.S.F02 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2, 0x4] - - - label: - "Step 3d: Given PS.S.F03(REPLC) ensure featuremap has the correct bit - set" - PICS: PS.S.F03 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2, 0x8] - - - label: "Step 4: Test Harness Client reads AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [0, 1, 2, 0x1f, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: Test Harness Client reads AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 0x1f, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4a: TH reads the Feature dependent(PS.S.F00-WIRED) attribute in - AttributeList" - PICS: PS.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [5] - - - label: - "Step 4b: TH reads the Feature dependent(PS.S.F01-BAT) attribute in - AttributeList" - PICS: PS.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [14, 15, 16] - - - label: - "Step 4c: TH reads the Feature dependent(PS.S.F02-RECHG) attribute in - AttributeList" - PICS: PS.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [26, 28] - - - label: - "Step 4d: TH reads the Feature dependent(PS.S.F03-REPLC) attribute in - AttributeList" - PICS: PS.S.F03 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [19, 25] - - - label: "Step 5a: Test Harness Client reads EventList attribute." - PICS: "PICS_EVENT_LIST_ENABLED && !PS.S.E00 && !PS.S.E01 && !PS.S.E02 " - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 5b: TH reads PS.S.E00(WiredFaultChange) event in EventList" - PICS: PICS_EVENT_LIST_ENABLED && PS.S.E00 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5c: TH reads PS.S.E01(BatFaultChange) event in EventList" - PICS: PICS_EVENT_LIST_ENABLED && PS.S.E01 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 5d: TH reads PS.S.E02(BatChargeFaultChange) event in EventList" - PICS: PICS_EVENT_LIST_ENABLED && PS.S.E02 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 6: Test Harness Client reads AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: Test Harness Client reads GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_REFALM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_REFALM_1_1.yaml deleted file mode 100644 index fd9a44944b8b49..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_REFALM_1_1.yaml +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2023 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. - -name: 223.1.1. [TC-REFALM-1.1] Global attributes with DUT as Server - -PICS: - - REFALM.S - -config: - nodeId: 0x12344321 - cluster: "Refrigerator Alarm" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0x0000, - 0x0002, - 0x0003, - 0xfff8, - 0xfff9, - 0xfffa, - 0xfffb, - 0xfffc, - 0xfffd, - ] - excludes: [0x0001] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [ - 0x0000, - 0x0002, - 0x0003, - 0xfff8, - 0xfff9, - 0xfffb, - 0xfffc, - 0xfffd, - ] - excludes: [0x0001] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_RH_1_1.yaml b/src/app/tests/suites/certification/Test_TC_RH_1_1.yaml deleted file mode 100644 index 8281fc20386d14..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_RH_1_1.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (c) 2021 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. - -name: 9.1.1. [TC-RH-1.1] Global attributes with server as DUT - -PICS: - - RH.S - -config: - nodeId: 0x12344321 - cluster: "Relative Humidity Measurement" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads the ClusterRevision attribute from the DUT." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 3 - constraints: - type: int16u - - - label: "Step 3: TH reads the FeatureMap attribute from the DUT." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads the AttributeList attribute from the DUT." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads the AttributeList attribute from the DUT." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the optional attribute(Tolerance) in AttributeList" - command: "readAttribute" - attribute: "AttributeList" - PICS: RH.S.A0003 - response: - constraints: - type: list - contains: [3] - - - label: "Step 5: TH reads the AcceptedCommandList attribute from the DUT." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads the GeneratedCommandList attribute from the DUT." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads the EventList attribute from the DUT." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml deleted file mode 100644 index 1a4dbae62cb01f..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (c) 2023 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. - -name: 78.1.1. [TC-RVCCLEANM-1.1] Global attributes with DUT as Server - -PICS: - - RVCCLEANM.S - -config: - nodeId: 0x12344321 - cluster: "RVC Clean Mode" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6: TH reads from the DUT the AcceptedCommandList attribute. - Check if it contains id 0x0 (ChangeToMode)" - PICS: RVCCLEANM.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [0] - constraints: - type: list - - - label: - "Step 7: TH reads from the DUT the GeneratedCommandList attribute. - Check if it contains id 0x1 (ChangeToModeResponse)" - PICS: RVCCLEANM.S.C01.Tx - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [1] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_RVCOPSTATE_1_1.yaml b/src/app/tests/suites/certification/Test_TC_RVCOPSTATE_1_1.yaml deleted file mode 100644 index ce4e4e35b87467..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_RVCOPSTATE_1_1.yaml +++ /dev/null @@ -1,162 +0,0 @@ -# Copyright (c) 2023 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. - -name: 224.1.1. [TC-RVCOPSTATE-1.1] Global attributes [DUT as Server] - -PICS: - - RVCOPSTATE.S - -config: - nodeId: 0x12344321 - cluster: "RVC Operational State" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [0, 1, 3, 4, 5, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 3, 4, 5, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads from the DUT the optional attribute(CountdownTime) - in the AttributeList from the DUT" - PICS: RVCOPSTATE.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 5a: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0x00] - - - label: - "Step 5b: TH reads from the DUT the optional - event(OperationCompletion) in EventList." - PICS: PICS_EVENT_LIST_ENABLED && RVCOPSTATE.S.E01 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0x01] - - - label: - "Step 6a: TH reads the optional command(Pause) in AcceptedCommandList" - PICS: RVCOPSTATE.S.C00.Rsp || RVCOPSTATE.S.C03.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 3] - - - label: - "Step 6b: TH reads the optional command(Stop) in AcceptedCommandList" - PICS: RVCOPSTATE.S.C01.Rsp || RVCOPSTATE.S.C02.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [1, 2] - - - label: - "Step 6c: TH reads the optional command(Start) in AcceptedCommandList" - PICS: RVCOPSTATE.S.C02.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 6d: TH reads the optional command(Resume) in AcceptedCommandList" - PICS: RVCOPSTATE.S.C03.Rsp || RVCOPSTATE.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 3] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute" - PICS: - " !RVCOPSTATE.S.C00.Rsp && !RVCOPSTATE.S.C01.Rsp && - !RVCOPSTATE.S.C02.Rsp && !RVCOPSTATE.S.C03.Rsp " - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute" - PICS: - " RVCOPSTATE.S.C00.Rsp || RVCOPSTATE.S.C01.Rsp || RVCOPSTATE.S.C02.Rsp - || RVCOPSTATE.S.C03.Rsp " - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [4] diff --git a/src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml deleted file mode 100644 index f9b4aed3db30c3..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (c) 2023 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. - -name: 78.1.1. [TC-RVCRUNM-1.1] Global attributes with DUT as Server - -PICS: - - RVCRUNM.S - -config: - nodeId: 0x12344321 - cluster: "RVC Run Mode" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: - "Step 6: TH reads from the DUT the AcceptedCommandList attribute. - Check if it contains id 0x0 (ChangeToMode)" - PICS: RVCRUNM.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [0] - constraints: - type: list - - - label: - "Step 7: TH reads from the DUT the GeneratedCommandList attribute. - Check if it contains id 0x1 (ChangeToModeResponse)" - PICS: RVCRUNM.S.C01.Tx - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [1] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml deleted file mode 100644 index c8a8c359e1cdc8..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml +++ /dev/null @@ -1,132 +0,0 @@ -# Copyright (c) 2021 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. - -name: 123.1.1. [TC-S-1.1] Global attributes with DUT as Server - -PICS: - - S.S - -config: - nodeId: 0x12344321 - cluster: "Scenes Management" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: - "Step 3: TH reads FeatureMap NameSupport bit (global attribute 65532)" - PICS: (!S.S.F00) - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksClear: [0x1] - - - label: - "Step 3: TH reads FeatureMap NameSupport bit (global attribute 65532)" - PICS: (S.S.F00) - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 4a: TH reads AttributeList mandatory attributes(global attribute - 65531)" - PICS: S.S - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1, 2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the LastConfiguredBy optional attribute from the - AttributeList (global attribute 65531)" - PICS: S.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5: TH reads from the DUT the EventList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [] - - - label: "Step 6a: TH reads from the DUT the AcceptedCommandList attribute" - PICS: S.S - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 4, 5, 6] - - - label: - "Step 6b: TH reads optional command(CopySceneResponse) - AcceptedCommandList (global attribute 65529)" - PICS: S.S.C40.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [64] - - - label: "Step 7a: TH reads from the DUT the GeneratedCommandList attribute" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [0, 1, 2, 3, 4, 6] - - - label: - "Step 7b: TH reads Read optional command(CopySceneResponse) in - GeneratedCommandList (global attribute 65528)" - PICS: S.S.C40.Rsp - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [64] diff --git a/src/app/tests/suites/certification/Test_TC_TCCM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TCCM_1_1.yaml deleted file mode 100644 index 4ee0ba303a1c61..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_TCCM_1_1.yaml +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2023 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. - -name: 219.1.1. [TC-TCCM-1.1] Global attributes with DUT as Server - -PICS: - - TCCM.S - -config: - nodeId: 0x12344321 - cluster: "Refrigerator And Temperature Controlled Cabinet Mode" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - #Issue https://github.com/project-chip/connectedhomeip/issues/31551 - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - PICS: "!TCCM.S.F00" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3: TH reads from the DUT the FeatureMap attribute, bit 0: SHALL - be 1 if and only if TCCM.S.F00" - command: "readAttribute" - attribute: "FeatureMap" - PICS: TCCM.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads from the DUT the AttributeList attribute. 0x0002: - SHALL be included if and only if TCCM.S.A0002(StartUpMode)" - PICS: TCCM.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - #Issue https://github.com/project-chip/connectedhomeip/issues/31551 - - label: - "Step 4c: TH reads from the DUT the AttributeList attribute. 0x0003 - SHALL be included if and only if TCCM.S.F00" - PICS: TCCM.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1] diff --git a/src/app/tests/suites/certification/Test_TC_TGTNAV_1_9.yaml b/src/app/tests/suites/certification/Test_TC_TGTNAV_1_9.yaml deleted file mode 100644 index 55d7d295e4369e..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_TGTNAV_1_9.yaml +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.9. [TC-TGTNAV-1.9] Global attributes - Target Navigator Cluster (DUT as - Server) - -PICS: - - TGTNAV.S - -config: - nodeId: 0x12344321 - cluster: "Target Navigator" - endpoint: 1 - -tests: - - label: "Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 2: TH reads the FeatureMap attribute from the DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 3b: TH reads the optional attribute(CurrentTarget) in - AttributeList" - PICS: TGTNAV.S.A0001 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 4: TH reads the AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5: TH reads the GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 6: TH reads the EventList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_TIMESYNC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TIMESYNC_1_1.yaml deleted file mode 100644 index f9384780f54269..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_TIMESYNC_1_1.yaml +++ /dev/null @@ -1,400 +0,0 @@ -# Copyright (c) 2023 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. - -name: 133.1.1. [TC-TIMESYNC-1.1] Global attributes with server as DUT - -PICS: - - TIMESYNC.S - -config: - nodeId: 0x12344321 - cluster: "Time Synchronization" - endpoint: 0 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - ########################## - # TS 2: Cluster revision - ########################## - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - - ########################## - # TS 3: Feature map - ########################## - # TZ - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: TIMESYNC.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3b: Given !TIMESYNC.S.F00(TZ) ensure featuremap has the correct - bit clear" - PICS: "!TIMESYNC.S.F00" - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksClear: [0x1] - # NTPC - - label: - "Step 3c: Given TIMESYNC.S.F01(NTPC) ensure featuremap has the correct - bit set" - PICS: TIMESYNC.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: - "Step 3d: Given !TIMESYNC.S.F01(NTPC) ensure featuremap has the - correct bit clear" - PICS: "!TIMESYNC.S.F01" - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksClear: [0x2] - - # NTPS - - label: - "Step 3e: Given TIMESYNC.S.F02(NTPS) ensure featuremap has the correct - bit set" - PICS: TIMESYNC.S.F02 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x4] - - - label: - "Step 3f: Given !TIMESYNC.S.F02(NTPS) ensure featuremap has the - correct bit clear" - PICS: "!TIMESYNC.S.F02" - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksClear: [0x4] - - # TSC - - label: - "Step 3g: Given TIMESYNC.S.F03(TSC) ensure featuremap has the correct - bit set" - PICS: TIMESYNC.S.F03 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x8] - - - label: - "Step 3h: Given !TIMESYNC.S.F03(TSC) ensure featuremap has the correct - bit clear" - PICS: "!TIMESYNC.S.F03" - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksClear: [0x8] - - ########################## - # TS 3: Feature map - ########################## - # Mandatory entries - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - contains: - [ - 0x0000, - 0x0001, - 0xFFF8, - 0xFFF9, - 0xFFFA, - 0xFFFB, - 0xFFFC, - 0xFFFD, - ] - - - label: "Step 4b: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - contains: [0x0000, 0x0001, 0xFFF8, 0xFFF9, 0xFFFB, 0xFFFC, 0xFFFD] - - # Optional - - label: "Step 4c: Check for optional attribute TimeSource in AttributeList" - PICS: TIMESYNC.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - contains: [0x0002] - - - label: - "Step 4d: Check for optional attribute TimeSource not in AttributeList" - PICS: "!TIMESYNC.S.A0002" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - excludes: [0x0002] - - # Feature TZ - - label: "Step 4e: Check for TZ feature-based attributes in AttributeList" - PICS: TIMESYNC.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - contains: [0x0005, 0x0006, 0x0007, 0x0008, 0x000A, 0x000B] - - - label: - "Step 4f: Check for TZ feature-based attributes not in AttributeList" - PICS: "!TIMESYNC.S.F00" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - excludes: [0x0005, 0x0006, 0x0007, 0x0008, 0x000A, 0x000B] - - # Feature NTPC - - label: "Step 4g: Check for NTPC feature-based attributes in AttributeList" - PICS: TIMESYNC.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - contains: [0x0004, 0x000C] - - - label: - "Step 4h: Check for NTPC feature-based attributes not in AttributeList" - PICS: "!TIMESYNC.S.F01" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - excludes: [0x0004, 0x000C] - - # Feature NTPS - - label: "Step 4i: Check for NTPS feature-based attributes in AttributeList" - PICS: TIMESYNC.S.F02 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - contains: [0x0009] - - - label: - "Step 4j: Check for NTPS feature-based attributes not in AttributeList" - PICS: "!TIMESYNC.S.F02" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - excludes: [0x0009] - - # Feature TSC - - label: "Step 4k: Check for TSC feature-based attributes in AttributeList" - PICS: TIMESYNC.S.F03 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - contains: [0x0003] - - - label: - "Step 4l: Check for TSC feature-based attributes not in AttributeList" - PICS: "!TIMESYNC.S.F03" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - excludes: [0x0003] - - # Note - additional exclusions not handled here - - ########################## - # TS 5: Event list - NOTE: disabled - ########################## - # mandatory - - label: "Step 5a: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - contains: [0x03] - - #Feature TZ - - label: "Step 5b: Check for TZ feature-based events in EventList" - PICS: PICS_EVENT_LIST_ENABLED && TIMESYNC.S.F00 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - contains: [0x00, 0x01, 0x02] - - - label: "Step 5c: Check for TZ feature-based events not in EventList" - PICS: "PICS_EVENT_LIST_ENABLED && !TIMESYNC.S.F00" - command: "readAttribute" - attribute: "EventList" - response: - constraints: - excludes: [0x00, 0x01, 0x02] - - #Feature TSC - - label: "Step 5d: Check for TSC feature-based events in EventList" - PICS: PICS_EVENT_LIST_ENABLED && TIMESYNC.S.F03 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - contains: [0x04] - - - label: "Step 5e: Check for TSC feature-based events not in EventList" - PICS: "PICS_EVENT_LIST_ENABLED && !TIMESYNC.S.F03" - command: "readAttribute" - attribute: "EventList" - response: - constraints: - excludes: [0x04] - - # Note - additional exclusions not handled here - - ########################## - # TS 6: AcceptedCommandList - ########################## - # mandatory - - label: "Step 6a: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - contains: [0x00] - - # Feature TZ - - label: - "Step 6b: Check for TZ feature-based commands in AcceptedCommandList" - PICS: TIMESYNC.S.F00 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - contains: [0x02, 0x04] - - - label: - "Step 6c: Check for TZ feature-based commands in not - AcceptedCommandList" - PICS: "!TIMESYNC.S.F00" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - excludes: [0x02, 0x04] - - # Feature NTPC - - label: - "Step 6d: Check for NTPC feature-based commands in AcceptedCommandList" - PICS: TIMESYNC.S.F01 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - contains: [0x05] - - - label: - "Step 6e: Check for NTPC feature-based commands in not - AcceptedCommandList" - PICS: "!TIMESYNC.S.F01" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - excludes: [0x05] - - # Feature TSC - - label: - "Step 6f: Check for TSC feature-based commands in AcceptedCommandList" - PICS: TIMESYNC.S.F03 - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - contains: [0x01] - - - label: - "Step 6g: Check for TSC feature-based commands in not - AcceptedCommandList" - PICS: "!TIMESYNC.S.F03" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - excludes: [0x01] - - # NOTE: exclusions not checked - - ########################## - # TS 7: GeneratedCommandList - ########################## - # Feature TZ - - label: "Step 7a: TH reads from the DUT the GeneratedCommandList attribute" - PICS: TIMESYNC.S.F00 - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - contains: [0x03] - - - label: - "Step 7b: Check for TZ feature-based commands in not - GeneratedCommandList" - PICS: "!TIMESYNC.S.F00" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - excludes: [0x03] diff --git a/src/app/tests/suites/certification/Test_TC_TMP_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TMP_1_1.yaml deleted file mode 100644 index 48eea5b8d29552..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_TMP_1_1.yaml +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright (c) 2021 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. - -name: 7.1.1. [TC-TMP-1.1] Global attributes with server as DUT - -PICS: - - TMP.S - -config: - nodeId: 0x12344321 - cluster: "Temperature Measurement" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 4 - constraints: - type: int16u - - - label: "Step 3: TH reads FeatureMap attribute from the DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads the global attribute: AttributeList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads the global attribute: AttributeList" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 2, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the optional attribute(Tolerance) in AttributeList" - PICS: TMP.S.A0003 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: "Step 5: TH reads AcceptedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads GeneratedCommandList attribute from the DUT" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads EventList attribute from the DUT." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_TSUIC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TSUIC_1_1.yaml deleted file mode 100644 index 333a81dc7b71a8..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_TSUIC_1_1.yaml +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (c) 2021 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. - -name: 12.1.1. [TC-TSUIC-1.1] Global attributes with DUT as Server - -PICS: - - TSUIC.S - -config: - nodeId: 0x12344321 - cluster: "Thermostat User Interface Configuration" - endpoint: 1 - -tests: - - label: "Step 1: Commission DUT to TH" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads optional attribute(ScheduleProgrammingVisibility) - in AttributeList" - PICS: TSUIC.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_ULABEL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ULABEL_1_1.yaml deleted file mode 100644 index e78f650215c24f..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_ULABEL_1_1.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2021 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. - -name: 95.1.1. [TC-ULABEL-1.1] Global Attributes with DUT as Server - -PICS: - - ULABEL.S - -config: - nodeId: 0x12344321 - cluster: "User Label" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 65528, 65529, 65531, 65532, 65533] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_VALCC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_VALCC_1_1.yaml deleted file mode 100644 index cf00d40a21a02f..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_VALCC_1_1.yaml +++ /dev/null @@ -1,186 +0,0 @@ -# Copyright (c) 2024 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. - -name: 62.1.1. [TC-VALCC-1.1] Global attributes with server as DUT - -PICS: - - VALCC.S - -config: - nodeId: 0x12344321 - cluster: "Valve Configuration and Control" - endpoint: 1 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: Read the global attribute: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3a: Read the global attribute: FeatureMap" - command: "readAttribute" - attribute: "FeatureMap" - PICS: ( !VALCC.S.F00 && !VALCC.S.F01 ) - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3b: Given VALCC.S.F00(TS) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: VALCC.S.F00 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3c: Given VALCC.S.F01(LVL) ensure featuremap has the correct bit - set" - command: "readAttribute" - attribute: "FeatureMap" - PICS: VALCC.S.F01 - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: "Step 4a: Read the global attribute: AttributeList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 3, 4, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: Read the global attribute: AttributeList" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 3, 4, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: Read the feature dependent(VALCC.S.F00) attribute in - AttributeList" - PICS: VALCC.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: - "Step 4c: Read the feature dependent(VALCC.S.F01) attribute in - AttributeList" - PICS: VALCC.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [6, 7] - - - label: - "Step 4d: Read the feature dependent(VALCC.S.F01) optional attribute - in AttributeList" - PICS: VALCC.S.F01 && VALCC.S.A0008 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [8] - - - label: - "Step 4e: Read the feature dependent(VALCC.S.F01) optional attribute - in AttributeList" - PICS: VALCC.S.F01 && VALCC.S.A000a - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [10] - - - label: - "Step 4f: TH reads optional (ValveFault) attribute in AttributeList" - PICS: VALCC.S.A0009 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [9] - - - label: "Step 5a: Read the global attribute: EventList" - PICS: PICS_EVENT_LIST_ENABLED && !VALCC.S.E00 && !VALCC.S.E01 - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 5b: Read the optional (ValveStateChanged) event in EventList" - PICS: PICS_EVENT_LIST_ENABLED && VALCC.S.E00 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 5c: Read the optional (ValveFault) event in EventList" - PICS: PICS_EVENT_LIST_ENABLED && VALCC.S.E01 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [1] - - - label: "Step 6: Read the global attribute: AcceptedCommandList" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 1] - - - label: "Step 7: Read the global attribute: GeneratedCommandList" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_WAKEONLAN_1_5.yaml b/src/app/tests/suites/certification/Test_TC_WAKEONLAN_1_5.yaml deleted file mode 100644 index 59de9edbd7a636..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_WAKEONLAN_1_5.yaml +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (c) 2021 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. - -name: - 19.1.5. [TC-WAKEONLAN-1.5] Global attributes - Wake on LAN Cluster (DUT as - Server) - -PICS: - - WAKEONLAN.S - -config: - nodeId: 0x12344321 - cluster: "Wake on LAN" - endpoint: 1 - -tests: - - label: - "Commission DUT to TH (can be skipped if done in a preceding test)." - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 1: TH reads the ClusterRevision attribute from the DUT" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 2: TH reads the FeatureMap attribute from the DUT" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 3a: TH reads the AttributeList attribute from the DUT" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: - "Step 3b: TH reads the optional attribute(MACAddress) in AttributeList" - PICS: WAKEONLAN.S.A0000 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0] - - - label: "Step 4: TH reads the global attribute: AcceptedCommandList" - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 5: TH reads the global attribute: GeneratedCommandList" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads the global attribute: EventList" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/certification/Test_TC_WASHERCTRL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_WASHERCTRL_1_1.yaml deleted file mode 100644 index 61e4f130dca7dd..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_WASHERCTRL_1_1.yaml +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright (c) 2023 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. - -name: 186.1.1. [TC-WASHERCTRL-1.1] Global Attributes with DUT as Server - -PICS: - - WASHERCTRL.S - -config: - nodeId: 0x12344321 - cluster: "Laundry Washer Controls" - endpoint: 1 - -tests: - - label: "Commission DUT to TH" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: - "Step 3: TH reads from the DUT the FeatureMap attribute. If - WASHERCTRL.S.F00(SPIN) & WASHERCTRL.S.F01(RINSE) are false" - PICS: "!WASHERCTRL.S.F00 && !WASHERCTRL.S.F01" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: - "Step 3: TH reads from the DUT the FeatureMap attribute, bit 0 set to - 1 if the DUT is capable of controlling the washer using the spin - attributes (WASHERCTRL.S.F00(SPIN) is true)" - PICS: WASHERCTRL.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - - label: - "Step 3: TH reads from the DUT the FeatureMap attribute, bit 1 set to - 1 if the DUT supports rinse attributes (WASHERCTRL.S.F01(RINSE) is - true)" - PICS: WASHERCTRL.S.F01 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x2] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads the feature dependent(WASHERCTRL.S.F00) attributes - in AttributeList from DUT." - PICS: WASHERCTRL.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1] - - - label: - "Step 4c: TH reads the feature dependent(WASHERCTRL.S.F01) attributes - in AttributeList from DUT." - PICS: WASHERCTRL.S.F01 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2, 3] - - - label: "Step 5: TH reads from the DUT the EventList attribute." - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - value: [] - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 26efd799ad7efd..a77ecb9a3b2838 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -1,7 +1,6 @@ { "AccessControl": [ "TestAccessControlCluster", - "Test_TC_ACL_1_1", "Test_TC_ACL_2_1", "Test_TC_ACL_2_3", "Test_TC_ACL_2_4", @@ -14,12 +13,11 @@ ], "ContentAppObserver": [], "AccessControlEnforcement": ["Test_TC_ACE_1_1", "Test_TC_ACE_1_5"], - "BooleanState": ["Test_TC_BOOL_1_1", "Test_TC_BOOL_2_1"], - "Binding": ["Test_TC_BIND_1_1"], - "BridgedDeviceBasicInformation": ["Test_TC_BRBINFO_1_1"], - "Actions": ["Test_TC_ACT_1_1"], + "BooleanState": ["Test_TC_BOOL_2_1"], + "Binding": [], + "BridgedDeviceBasicInformation": [], + "Actions": [], "ColorControl": [ - "Test_TC_CC_1_1", "Test_TC_CC_2_1", "Test_TC_CC_3_2", "Test_TC_CC_3_3", @@ -42,65 +40,43 @@ "TestColorControl_9_2" ], "DeviceManagement": [ - "Test_TC_OPCREDS_1_2", "Test_TC_OPCREDS_3_7", - "Test_TC_BINFO_1_1", "Test_TC_BINFO_2_1", "Test_TC_BINFO_2_2", "Test_TC_CNET_1_3" ], - "Descriptor": ["Test_TC_DESC_1_1"], - "DeviceEnergyManagementMode": ["Test_TC_DEMM_1_1", "Test_TC_DEMM_2_1"], - "EthernetNetworkDiagnostics": [ - "Test_TC_DGETH_1_1", - "Test_TC_DGETH_2_1", - "Test_TC_DGETH_2_2" - ], - "DiagnosticsLogs": ["Test_TC_DLOG_1_1"], - "EnergyEVSE": ["Test_TC_EEVSE_1_1", "Test_TC_EEVSE_2_1"], + "Descriptor": [], + "DeviceEnergyManagementMode": ["Test_TC_DEMM_2_1"], + "EthernetNetworkDiagnostics": ["Test_TC_DGETH_2_1", "Test_TC_DGETH_2_2"], + "DiagnosticsLogs": [], + "EnergyEVSE": ["Test_TC_EEVSE_2_1"], "EnergyEVSEMode": [ - "Test_TC_EEVSEM_1_1", "Test_TC_EEVSEM_2_1", "Test_TC_EEVSEM_3_1", "Test_TC_EEVSEM_3_2", "Test_TC_EEVSEM_3_3" ], - "FlowMeasurement": ["Test_TC_FLW_1_1", "Test_TC_FLW_2_1"], - "FixedLabel": ["Test_TC_FLABEL_1_1", "Test_TC_FLABEL_2_1"], + "FlowMeasurement": ["Test_TC_FLW_2_1"], + "FixedLabel": ["Test_TC_FLABEL_2_1"], "FanControl": [ - "Test_TC_FAN_1_1", "Test_TC_FAN_2_1", "Test_TC_FAN_2_2", "Test_TC_FAN_2_3", "Test_TC_FAN_2_4", "Test_TC_FAN_3_6" ], - "GeneralCommissioning": ["Test_TC_CGEN_1_1", "Test_TC_CGEN_2_1"], - "GeneralDiagnostics": ["Test_TC_DGGEN_1_1"], - "GroupKeyManagement": ["Test_TC_GRPKEY_1_1", "Test_TC_GRPKEY_2_2"], + "GeneralCommissioning": ["Test_TC_CGEN_2_1"], + "GeneralDiagnostics": [], + "GroupKeyManagement": ["Test_TC_GRPKEY_2_2"], "IcdManagement": [ "TestIcdManagementCluster", "Test_TC_ICDM_1_1", "Test_TC_ICDM_3_4" ], - "Identify": [ - "Test_TC_I_1_1", - "Test_TC_I_2_1", - "Test_TC_I_2_2", - "Test_TC_I_2_3" - ], - "IlluminanceMeasurement": [ - "Test_TC_ILL_1_1", - "Test_TC_ILL_2_1", - "Test_TC_ILL_2_2" - ], - "OccupancySensing": [ - "Test_TC_OCC_1_1", - "Test_TC_OCC_2_1", - "Test_TC_OCC_2_3" - ], + "Identify": ["Test_TC_I_2_1", "Test_TC_I_2_2", "Test_TC_I_2_3"], + "IlluminanceMeasurement": ["Test_TC_ILL_2_1", "Test_TC_ILL_2_2"], + "OccupancySensing": ["Test_TC_OCC_2_1", "Test_TC_OCC_2_3"], "LevelControl": [ - "Test_TC_LVL_1_1", "Test_TC_LVL_2_1", "Test_TC_LVL_2_2", "Test_TC_LVL_3_1", @@ -109,50 +85,34 @@ "Test_TC_LVL_6_1", "Test_TC_LVL_7_1" ], - "LocalizationConfiguration": ["Test_TC_LCFG_1_1"], + "LocalizationConfiguration": [], "TimeFormatLocalization": ["Test_TC_LTIME_1_2", "Test_TC_LTIME_3_1"], - "UnitLocalization": ["Test_TC_LUNIT_1_2", "Test_TC_LUNIT_3_1"], + "UnitLocalization": ["Test_TC_LUNIT_3_1"], "UserLabel": [ - "Test_TC_ULABEL_1_1", "Test_TC_ULABEL_2_1", "Test_TC_ULABEL_2_2", "Test_TC_ULABEL_2_3", "Test_TC_ULABEL_2_4" ], "LaundryWasherMode": [ - "Test_TC_LWM_1_1", "Test_TC_LWM_2_1", "Test_TC_LWM_3_1", "Test_TC_LWM_3_2", "Test_TC_LWM_3_3" ], "LaundryWasherControl": [ - "Test_TC_WASHERCTRL_1_1", "Test_TC_WASHERCTRL_2_1", "Test_TC_WASHERCTRL_2_2" ], "OvenMode": [ - "Test_TC_OTCCM_1_1", "Test_TC_OTCCM_2_1", "Test_TC_OTCCM_3_1", "Test_TC_OTCCM_3_2", "Test_TC_OTCCM_3_3" ], - "LaundryDryerControl": ["Test_TC_DRYERCTRL_1_1", "Test_TC_DRYERCTRL_2_1"], + "LaundryDryerControl": ["Test_TC_DRYERCTRL_2_1"], "MediaControl": [ - "Test_TC_LOWPOWER_1_1", - "Test_TC_KEYPADINPUT_1_2", - "Test_TC_APPLAUNCHER_1_3", - "Test_TC_MEDIAINPUT_1_4", - "Test_TC_WAKEONLAN_1_5", - "Test_TC_CHANNEL_1_6", - "Test_TC_MEDIAPLAYBACK_1_7", - "Test_TC_AUDIOOUTPUT_1_8", - "Test_TC_TGTNAV_1_9", - "Test_TC_APBSC_1_10", - "Test_TC_CONTENTLAUNCHER_1_11", - "Test_TC_ALOGIN_1_12", "Test_TC_LOWPOWER_2_1", "Test_TC_KEYPADINPUT_3_2", "Test_TC_KEYPADINPUT_3_3", @@ -181,22 +141,13 @@ "Test_TC_CONTENTLAUNCHER_10_5", "Test_TC_CONTENTLAUNCHER_10_7" ], - "ModeSelect": ["Test_TC_MOD_1_1"], + "ModeSelect": [], "MultipleFabrics": [], "OTASoftwareUpdate": ["OTA_SuccessfulTransfer"], - "OnOff": [ - "Test_TC_OO_1_1", - "Test_TC_OO_2_1", - "Test_TC_OO_2_2", - "Test_TC_OO_2_4" - ], - "PowerSource": ["Test_TC_PS_1_1", "Test_TC_PS_2_1"], + "OnOff": ["Test_TC_OO_2_1", "Test_TC_OO_2_2", "Test_TC_OO_2_4"], + "PowerSource": ["Test_TC_PS_2_1"], "PowerTopology": ["Test_TC_PWRTL_1_1"], - "PressureMeasurement": [ - "Test_TC_PRS_1_1", - "Test_TC_PRS_2_1", - "Test_TC_PRS_2_2" - ], + "PressureMeasurement": ["Test_TC_PRS_2_1", "Test_TC_PRS_2_2"], "PumpConfigurationControl": [ "Test_TC_PCC_1_1", "Test_TC_PCC_2_1", @@ -204,15 +155,10 @@ "Test_TC_PCC_2_3", "Test_TC_PCC_2_4" ], - "PowerSourceConfiguration": ["Test_TC_PSCFG_1_1", "Test_TC_PSCFG_2_1"], - "RefrigeratorAlarm": ["Test_TC_REFALM_1_1", "Test_TC_REFALM_2_1"], - "RelativeHumidityMeasurement": ["Test_TC_RH_1_1", "Test_TC_RH_2_1"], - "RoboticVacuumCleaner": [ - "Test_TC_RVCCLEANM_1_1", - "Test_TC_RVCRUNM_1_1", - "Test_TC_RVCRUNM_3_1", - "Test_TC_RVCOPSTATE_1_1" - ], + "PowerSourceConfiguration": ["Test_TC_PSCFG_2_1"], + "RefrigeratorAlarm": ["Test_TC_REFALM_2_1"], + "RelativeHumidityMeasurement": ["Test_TC_RH_2_1"], + "RoboticVacuumCleaner": ["Test_TC_RVCRUNM_3_1"], "SecureChannel": [], "SmokeCOAlarm": [ "Test_TC_SMOKECO_1_1", @@ -225,7 +171,6 @@ ], "Switch": ["Test_TC_SWTCH_1_1", "Test_TC_SWTCH_2_1"], "TemperatureControlledCabinetMode": [ - "Test_TC_TCCM_1_1", "Test_TC_TCCM_3_1", "Test_TC_TCCM_3_2", "Test_TC_TCCM_3_3" @@ -238,26 +183,17 @@ "Test_TC_TCTL_3_2", "Test_TC_TCTL_3_3" ], - "TemperatureMeasurement": ["Test_TC_TMP_1_1", "Test_TC_TMP_2_1"], + "TemperatureMeasurement": ["Test_TC_TMP_2_1"], "Thermostat": ["Test_TC_TSTAT_1_1", "Test_TC_TSTAT_2_1"], - "ThermostatUserConfiguration": [ - "Test_TC_TSUIC_1_1", - "Test_TC_TSUIC_2_1", - "Test_TC_TSUIC_2_2" - ], + "ThermostatUserConfiguration": ["Test_TC_TSUIC_2_1", "Test_TC_TSUIC_2_2"], "ThreadNetworkDiagnostics": [ - "Test_TC_DGTHREAD_1_1", "Test_TC_DGTHREAD_2_1", "Test_TC_DGTHREAD_2_2", "Test_TC_DGTHREAD_2_3", "Test_TC_DGTHREAD_2_4" ], - "TimeSynchronization": ["Test_TC_TIMESYNC_1_1", "Test_TC_TIMESYNC_2_3"], - "WiFiNetworkDiagnostics": [ - "Test_TC_DGWIFI_1_1", - "Test_TC_DGWIFI_2_1", - "Test_TC_DGWIFI_2_3" - ], + "TimeSynchronization": ["Test_TC_TIMESYNC_2_3"], + "WiFiNetworkDiagnostics": ["Test_TC_DGWIFI_2_1", "Test_TC_DGWIFI_2_3"], "WindowCovering": [ "Test_TC_WNCV_1_1", "Test_TC_WNCV_2_1", @@ -326,7 +262,7 @@ "Test_AddNewFabricFromExistingFabric" ], "MultiAdmin": ["TestMultiAdmin"], - "SoftwareDiagnostics": ["Test_TC_DGSW_1_1"], + "SoftwareDiagnostics": [], "Subscriptions": [ "TestSubscribe_OnOff", "TestSubscribe_AdministratorCommissioning" @@ -335,7 +271,6 @@ "DL_UsersAndCredentials", "DL_LockUnlock", "DL_Schedules", - "Test_TC_DRLK_1_1", "Test_TC_DRLK_2_4", "Test_TC_DRLK_2_5", "Test_TC_DRLK_2_6", @@ -343,18 +278,12 @@ "Test_TC_DRLK_2_8", "Test_TC_DRLK_2_11" ], - "Groups": [ - "TestGroupMessaging", - "TestGroupsCluster", - "Test_TC_G_1_1", - "Test_TC_G_2_1" - ], + "Groups": ["TestGroupMessaging", "TestGroupsCluster", "Test_TC_G_2_1"], "ScenesManagement": [ "TestScenesFabricRemoval", "TestScenesFabricSceneInfo", "TestScenesMultiFabric", "TestScenesMaxCapacity", - "Test_TC_S_1_1", "Test_TC_S_2_1", "Test_TC_S_2_2", "Test_TC_S_2_3", @@ -363,12 +292,10 @@ "ResourceMonitoring": [ "TestActivatedCarbonFilterMonitoring", "TestHepaFilterMonitoring", - "Test_TC_ACFREMON_1_1", "Test_TC_ACFREMON_2_1", - "Test_TC_HEPAFREMON_1_1", "Test_TC_HEPAFREMON_2_1" ], - "AirQuality": ["Test_TC_AIRQUAL_1_1", "Test_TC_AIRQUAL_2_1"], + "AirQuality": ["Test_TC_AIRQUAL_2_1"], "ConcentrationMeasurement": [ "Test_TC_CDOCONC_1_1", "Test_TC_CDOCONC_2_1", diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index 0331f9eba773df..a12d2b75b8a90f 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -64,7 +64,6 @@ "Test_TC_DA_1_8" ], "DishwasherAlarm": [ - "Test_TC_DISHALM_1_1", "Test_TC_DISHALM_2_1", "Test_TC_DISHALM_3_1", "Test_TC_DISHALM_3_2", @@ -74,7 +73,6 @@ "Test_TC_DISHALM_3_6" ], "DishwasherMode": [ - "Test_TC_DISHM_1_1", "Test_TC_DISHM_1_2", "Test_TC_DISHM_2_1", "Test_TC_DISHM_3_1", @@ -170,10 +168,8 @@ "Test_TC_MC_11_2", "Test_TC_ALOGIN_12_2", "Test_TC_TGTNAV_8_2", - "Test_TC_APPOBSERVER_1_13", "Test_TC_APPOBSERVER_13_1", - "Test_TC_APPOBSERVER_13_2", - "Test_TC_CONCON_1_14" + "Test_TC_APPOBSERVER_13_2" ], "MultipleFabrics": [ "Test_TC_CADMIN_1_1", diff --git a/src/python_testing/TC_OPSTATE_1_1.py b/src/python_testing/TC_OPSTATE_1_1.py deleted file mode 100644 index 67caefc85862b5..00000000000000 --- a/src/python_testing/TC_OPSTATE_1_1.py +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright (c) 2024 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. -# - - -import chip.clusters as Clusters -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo - - -class TC_OPSTATE_1_1(MatterBaseTest, TC_OPSTATE_BASE): - def __init__(self, *args): - super().__init__(*args) - - test_info = TestInfo( - pics_code="OPSTATE", - cluster=Clusters.OperationalState - ) - - super().setup_base(test_info=test_info) - - def steps_TC_OPSTATE_1_1(self) -> list[TestStep]: - return self.STEPS_TC_OPSTATE_BASE_1_1() - - def pics_TC_OPSTATE_1_1(self) -> list[str]: - return ["OPSTATE.S"] - - @async_test_body - async def test_TC_OPSTATE_1_1(self): - endpoint = self.matter_test_config.endpoint - cluster_revision = 2 - feature_map = 0 - - await self.TEST_TC_OPSTATE_BASE_1_1(endpoint=endpoint, - cluster_revision=cluster_revision, - feature_map=feature_map) - - -if __name__ == "__main__": - default_matter_test_main() diff --git a/src/python_testing/TC_OVENOPSTATE_1_1.py b/src/python_testing/TC_OVENOPSTATE_1_1.py deleted file mode 100644 index 3e6b0a27fbab5d..00000000000000 --- a/src/python_testing/TC_OVENOPSTATE_1_1.py +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright (c) 2024 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. -# - - -import chip.clusters as Clusters -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo - - -class TC_OVENOPSTATE_1_1(MatterBaseTest, TC_OPSTATE_BASE): - def __init__(self, *args): - super().__init__(*args) - - test_info = TestInfo( - pics_code="OVENOPSTATE", - cluster=Clusters.OvenCavityOperationalState - ) - - super().setup_base(test_info=test_info) - - def steps_TC_OVENOPSTATE_1_1(self) -> list[TestStep]: - return self.STEPS_TC_OPSTATE_BASE_1_1() - - def pics_TC_OVENOPSTATE_1_1(self) -> list[str]: - return ["OVENOPSTATE.S"] - - @async_test_body - async def test_TC_OVENOPSTATE_1_1(self): - endpoint = self.matter_test_config.endpoint - cluster_revision = 1 - feature_map = 0 - - await self.TEST_TC_OPSTATE_BASE_1_1(endpoint=endpoint, - cluster_revision=cluster_revision, - feature_map=feature_map) - - -if __name__ == "__main__": - default_matter_test_main() From b790232baf1a257a396e9f7b598584896fc38365 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 31 May 2024 15:24:42 +0200 Subject: [PATCH 015/162] [Python] Add "automation" level to log defines (#33670) So far the automation log level was missing. Add it to the log level defines in the logging module. While at it, also rename to LOG_CATEGORY (instead of ERROR_CATEGORY) and remove duplicated log level definitions in ChipStack. --- src/controller/python/chip/ChipStack.py | 16 ++++------------ src/controller/python/chip/logging/__init__.py | 17 +++++++++-------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index 3a167bb6bc0a7a..beeaedd6ae3327 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -36,6 +36,7 @@ from threading import Condition, Event, Lock import chip.native +from chip.logging import LOG_CATEGORY_AUTOMATION, LOG_CATEGORY_DETAIL, LOG_CATEGORY_ERROR, LOG_CATEGORY_PROGRESS from chip.native import PyChipError from .ChipUtility import ChipUtility @@ -78,23 +79,14 @@ class DeviceStatusStruct(Structure): class LogCategory(object): """Debug logging categories used by chip.""" - # NOTE: These values must correspond to those used in the chip C++ code. - Disabled = 0 - Error = 1 - Progress = 2 - Detail = 3 - Retain = 4 - @staticmethod def categoryToLogLevel(cat): - if cat == LogCategory.Error: + if cat == LOG_CATEGORY_ERROR: return logging.ERROR - elif cat == LogCategory.Progress: + elif cat == LOG_CATEGORY_PROGRESS: return logging.INFO - elif cat == LogCategory.Detail: + elif cat in (LOG_CATEGORY_DETAIL, LOG_CATEGORY_AUTOMATION): return logging.DEBUG - elif cat == LogCategory.Retain: - return logging.CRITICAL else: return logging.NOTSET diff --git a/src/controller/python/chip/logging/__init__.py b/src/controller/python/chip/logging/__init__.py index 047d3f4f8e97f5..aca671997d7299 100644 --- a/src/controller/python/chip/logging/__init__.py +++ b/src/controller/python/chip/logging/__init__.py @@ -19,11 +19,12 @@ from chip.logging.library_handle import _GetLoggingLibraryHandle from chip.logging.types import LogRedirectCallback_t -# Defines match support/logging/Constants.h (LogCategory enum) -ERROR_CATEGORY_NONE = 0 -ERROR_CATEGORY_ERROR = 1 -ERROR_CATEGORY_PROGRESS = 2 -ERROR_CATEGORY_DETAIL = 3 +# Defines match src/lib/support/logging/Constants.h (LogCategory enum) +LOG_CATEGORY_NONE = 0 +LOG_CATEGORY_ERROR = 1 +LOG_CATEGORY_PROGRESS = 2 +LOG_CATEGORY_DETAIL = 3 +LOG_CATEGORY_AUTOMATION = 4 @LogRedirectCallback_t @@ -34,11 +35,11 @@ def _RedirectToPythonLogging(category, module, message): logger = logging.getLogger('chip.native.%s' % module) - if category == ERROR_CATEGORY_ERROR: + if category == LOG_CATEGORY_ERROR: logger.error("%s", message) - elif category == ERROR_CATEGORY_PROGRESS: + elif category == LOG_CATEGORY_PROGRESS: logger.info("%s", message) - elif category == ERROR_CATEGORY_DETAIL: + elif category in (LOG_CATEGORY_DETAIL, LOG_CATEGORY_AUTOMATION): logger.debug("%s", message) else: # All logs are expected to have some reasonable category. This treats From f5fad3d48d09cebd6160cd8e4f3c3deab78ee663 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 31 May 2024 17:31:38 -0400 Subject: [PATCH 016/162] TC-RVCRUNM-2.2: make error more verbose (#33643) * TC-RVCRUNM-2.2: make error more verbose * Restyled by autopep8 * more verboser --------- Co-authored-by: Restyled.io --- src/python_testing/TC_RVCRUNM_2_2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index d85d1ae53cb928..6680ada707a85e 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -154,7 +154,8 @@ async def test_TC_RVCRUNM_2_2(self): if self.mode_a not in self.supported_run_modes_dut or \ self.mode_b not in self.supported_run_modes_dut: - asserts.fail("PIXIT.RVCRUNM.MODE_A and PIXIT.RVCRUNM.MODE_B must be valid supported modes.") + asserts.fail( + f"PIXIT.RVCRUNM.MODE_A and PIXIT.RVCRUNM.MODE_B must be valid supported modes. Valid modes: {self.supported_run_modes_dut}, MODE_A: {self.mode_a}, MODE_B: {self.mode_b}") for tag in self.supported_run_modes[self.mode_a].modeTags: if tag.value == Clusters.RvcRunMode.Enums.ModeTag.kIdle: From 7ebc71fc584659d7e59a9c16e07caa421623e28a Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 31 May 2024 17:52:15 -0400 Subject: [PATCH 017/162] Python testing: id range check functions (#33510) * Python testing: id range check functions * add test to workflow * use range more directly * change to enums * isort * fix workflow --- .github/workflows/tests.yaml | 2 + src/python_testing/TestIdChecks.py | 214 +++++++++++++++++++++ src/python_testing/global_attribute_ids.py | 109 ++++++++++- 3 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 src/python_testing/TestIdChecks.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 8b3588c6fdf13c..678b7b18195aa0 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -561,6 +561,8 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_DA_1_2.py' scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_ICDM_2_1.py' + scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestIdChecks.py' + - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} diff --git a/src/python_testing/TestIdChecks.py b/src/python_testing/TestIdChecks.py new file mode 100644 index 00000000000000..8969807d5819e3 --- /dev/null +++ b/src/python_testing/TestIdChecks.py @@ -0,0 +1,214 @@ +# +# Copyright (c) 2024 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. +# + +from global_attribute_ids import (AttributeIdType, ClusterIdType, DeviceTypeIdType, attribute_id_type, cluster_id_type, + device_type_id_type, is_valid_attribute_id, is_valid_cluster_id, is_valid_device_type_id) +from matter_testing_support import MatterBaseTest, default_matter_test_main +from mobly import asserts + + +class TestIdChecks(MatterBaseTest): + def test_device_type_ids(self): + standard_good = [0x0000_0000, 0x0000_BFFF] + standard_bad = [0x0000_C000] + + manufacturer_good = [0x0001_0000, 0x0001_BFFF, 0xFFF0_0000, 0xFFF0_BFFF] + manufacturer_bad = [0x0001_C000, 0xFFF0_C000] + + test_good = [0xFFF1_0000, 0xFFF1_BFFF, 0xFFF4_0000, 0xFFF4_BFFF] + test_bad = [0xFFF1_C000, 0xFFF4_C000] + + prefix_bad = [0xFFF5_0000, 0xFFF5_BFFFF, 0xFFF5_C000] + + def check_standard(id): + id_type = device_type_id_type(id) + msg = f"Incorrect device type range assessment, expecting standard {id:08x}, type = {id_type}" + asserts.assert_equal(device_type_id_type(id), DeviceTypeIdType.kStandard, msg) + asserts.assert_true(is_valid_device_type_id(id_type, allow_test=True), msg) + asserts.assert_true(is_valid_device_type_id(id_type, allow_test=False), msg) + + def check_manufacturer(id): + id_type = device_type_id_type(id) + msg = f"Incorrect device type range assessment, expecting manufacturer {id:08x}, type = {id_type}" + asserts.assert_equal(device_type_id_type(id), DeviceTypeIdType.kManufacturer, msg) + asserts.assert_true(is_valid_device_type_id(id_type, allow_test=True), msg) + asserts.assert_true(is_valid_device_type_id(id_type, allow_test=False), msg) + + def check_test(id): + id_type = device_type_id_type(id) + msg = f"Incorrect device type range assessment, expecting test {id:08x}, type = {id_type}" + asserts.assert_equal(device_type_id_type(id), DeviceTypeIdType.kTest, msg) + asserts.assert_true(is_valid_device_type_id(id_type, allow_test=True), msg) + asserts.assert_false(is_valid_device_type_id(id_type, allow_test=False), msg) + + def check_all_bad(id): + id_type = device_type_id_type(id) + msg = f"Incorrect device type range assessment, expecting invalid {id:08x}, type = {id_type}" + asserts.assert_equal(device_type_id_type(id), DeviceTypeIdType.kInvalid, msg) + asserts.assert_false(is_valid_device_type_id(id_type, allow_test=True), msg) + asserts.assert_false(is_valid_device_type_id(id_type, allow_test=False), msg) + + for id in standard_good: + check_standard(id) + + for id in standard_bad: + check_all_bad(id) + + for id in manufacturer_good: + check_manufacturer(id) + + for id in manufacturer_bad: + check_all_bad(id) + + for id in test_good: + check_test(id) + + for id in test_bad: + check_all_bad(id) + + for id in prefix_bad: + check_all_bad(id) + + def test_cluster_ids(self): + standard_good = [0x0000_0000, 0x0000_7FFF] + standard_bad = [0x0000_8000] + + manufacturer_good = [0x0001_FC00, 0x0001_FFFE, 0xFFF0_FC00, 0xFFF0_FFFE] + manufacturer_bad = [0x0001_0000, 0x0001_7FFF, 0x0001_FFFF, 0xFFF0_0000, 0xFFF0_7FFF, 0xFFF0_FFFF] + + test_good = [0xFFF1_FC00, 0xFFF1_FFFE, 0xFFF4_FC00, 0xFFF4_FFFE] + test_bad = [0xFFF1_0000, 0xFFF1_7FFF, 0xFFF1_FFFF, 0xFFF4_0000, 0xFFF4_7FFF, 0xFFF4_FFFF] + + prefix_bad = [0xFFF5_0000, 0xFFF5_FC00, 0xFFF5_FFFF] + + def check_standard(id): + id_type = cluster_id_type(id) + msg = f"Incorrect cluster range assessment, expecting standard {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, ClusterIdType.kStandard, msg) + asserts.assert_true(is_valid_cluster_id(id_type, allow_test=True), msg) + asserts.assert_true(is_valid_cluster_id(id_type, allow_test=False), msg) + + def check_manufacturer(id): + id_type = cluster_id_type(id) + msg = f"Incorrect cluster range assessment, expecting manufacturer {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, ClusterIdType.kManufacturer, msg) + asserts.assert_true(is_valid_cluster_id(id_type, allow_test=True), msg) + asserts.assert_true(is_valid_cluster_id(id_type, allow_test=False), msg) + + def check_test(id): + id_type = cluster_id_type(id) + msg = f"Incorrect cluster range assessment, expecting test {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, ClusterIdType.kTest, msg) + asserts.assert_true(is_valid_cluster_id(id_type, allow_test=True), msg) + asserts.assert_false(is_valid_cluster_id(id_type, allow_test=False), msg) + + def check_all_bad(id): + id_type = cluster_id_type(id) + msg = f"Incorrect cluster range assessment, expecting invalid {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, ClusterIdType.kInvalid, msg) + asserts.assert_false(is_valid_cluster_id(id_type, allow_test=True), msg) + asserts.assert_false(is_valid_cluster_id(id_type, allow_test=False), msg) + + for id in standard_good: + check_standard(id) + + for id in standard_bad: + check_all_bad(id) + + for id in manufacturer_good: + check_manufacturer(id) + + for id in manufacturer_bad: + check_all_bad(id) + + for id in test_good: + check_test(id) + + for id in test_bad: + check_all_bad(id) + + for id in prefix_bad: + check_all_bad(id) + + def test_attribute_ids(self): + standard_global_good = [0x0000_F000, 0x0000_FFFE] + standard_global_bad = [0x0000_FFFF] + standard_non_global_good = [0x0000_0000, 0x0000_4FFF] + standard_non_global_bad = [0x0000_5000] + manufacturer_good = [0x0001_0000, 0x0001_4FFF, 0xFFF0_0000, 0xFFF0_4FFF] + manufacturer_bad = [0x0001_5000, 0x0001_F000, 0x0001_FFFFF, 0xFFF0_5000, 0xFFF0_F000, 0xFFF0_FFFF] + test_good = [0xFFF1_0000, 0xFFF1_4FFF, 0xFFF4_0000, 0xFFF4_4FFF] + test_bad = [0xFFF1_5000, 0xFFF1_F000, 0xFFF1_FFFFF, 0xFFF4_5000, 0xFFF4_F000, 0xFFF4_FFFF] + prefix_bad = [0xFFF5_0000, 0xFFF5_4FFF, 0xFFF5_5000, 0xFFF5_F000, 0xFFF5_FFFF] + + def check_standard_global(id): + id_type = attribute_id_type(id) + msg = f"Incorrect attribute range assessment, expecting standard global {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, AttributeIdType.kStandardGlobal, msg) + asserts.assert_true(is_valid_attribute_id(id_type, allow_test=True), msg) + asserts.assert_true(is_valid_attribute_id(id_type, allow_test=False), msg) + + def check_standard_non_global(id): + id_type = attribute_id_type(id) + msg = f"Incorrect attribute range assessment, expecting standard non-global {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, AttributeIdType.kStandardNonGlobal, msg) + asserts.assert_true(is_valid_attribute_id(id_type, allow_test=True), msg) + asserts.assert_true(is_valid_attribute_id(id_type, allow_test=False), msg) + + def check_manufacturer(id): + id_type = attribute_id_type(id) + msg = f"Incorrect attribute range assessment, expecting manufacturer {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, AttributeIdType.kManufacturer, msg) + asserts.assert_true(is_valid_attribute_id(id_type, allow_test=True), msg) + asserts.assert_true(is_valid_attribute_id(id_type, allow_test=False), msg) + + def check_test(id): + id_type = attribute_id_type(id) + msg = f"Incorrect attribute range assessment, expecting test {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, AttributeIdType.kTest, msg) + asserts.assert_true(is_valid_attribute_id(id_type, allow_test=True), msg) + asserts.assert_false(is_valid_attribute_id(id_type, allow_test=False), msg) + + def check_all_bad(id): + id_type = attribute_id_type(id) + msg = f"Incorrect attribute range assessment, expecting invalid {id:08x}, type = {id_type}" + asserts.assert_equal(id_type, AttributeIdType.kInvalid, msg) + asserts.assert_false(is_valid_attribute_id(id_type, allow_test=True), msg) + asserts.assert_false(is_valid_attribute_id(id_type, allow_test=False), msg) + + for id in standard_global_good: + check_standard_global(id) + for id in standard_global_bad: + check_all_bad(id) + for id in standard_non_global_good: + check_standard_non_global(id) + for id in standard_non_global_bad: + check_all_bad(id) + for id in manufacturer_good: + check_manufacturer(id) + for id in manufacturer_bad: + check_all_bad(id) + for id in test_good: + check_test(id) + for id in test_bad: + check_all_bad(id) + for id in prefix_bad: + check_all_bad(id) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/global_attribute_ids.py b/src/python_testing/global_attribute_ids.py index 851148bd8f290f..e692adfdfb5a10 100644 --- a/src/python_testing/global_attribute_ids.py +++ b/src/python_testing/global_attribute_ids.py @@ -17,7 +17,7 @@ # This file should be removed once we have a good way to get this from the codegen or XML -from enum import IntEnum +from enum import Enum, IntEnum, auto class GlobalAttributeIds(IntEnum): @@ -38,3 +38,110 @@ def to_name(self) -> str: return "FeatureMap" if self == GlobalAttributeIds.CLUSTER_REVISION_ID: return "ClusterRevision" + + +class DeviceTypeIdType(Enum): + kInvalid = auto(), + kStandard = auto(), + kManufacturer = auto(), + kTest = auto(), + + +class ClusterIdType(Enum): + kInvalid = auto() + kStandard = auto(), + kManufacturer = auto(), + kTest = auto(), + + +class AttributeIdType(Enum): + kInvalid = auto() + kStandardGlobal = auto(), + kStandardNonGlobal = auto(), + kManufacturer = auto(), + kTest = auto(), + +# ID helper classes - this allows us to use the values from the prefix and suffix table directly +# because the class handles the non-inclusive range. + + +class IdRange(): + def __init__(self, min, max): + self.min_max = range(min, max+1) + + def __contains__(self, key): + return key in self.min_max + + +class PrefixIdRange(IdRange): + def __contains__(self, id: int): + return super().__contains__(id >> 16) + + +class SuffixIdRange(IdRange): + def __contains__(self, id: int): + return super().__contains__(id & 0xFFFF) + + +STANDARD_PREFIX = PrefixIdRange(0x0000, 0x0000) +MANUFACTURER_PREFIX = PrefixIdRange(0x0001, 0xFFF0) +TEST_PREFIX = PrefixIdRange(0xFFF1, 0xFFF4) + +DEVICE_TYPE_ID_RANGE_SUFFIX = SuffixIdRange(0x0000, 0xBFFF) +CLUSTER_ID_STANDARD_RANGE_SUFFIX = SuffixIdRange(0x0000, 0x7FFF) +CLUSTER_ID_MANUFACTURER_RANGE_SUFFIX = SuffixIdRange(0xFC00, 0xFFFE) +ATTRIBUTE_ID_GLOBAL_RANGE_SUFFIX = SuffixIdRange(0xF000, 0xFFFE) +ATTRIBUTE_ID_NON_GLOBAL_RANGE_SUFFIX = SuffixIdRange(0x0000, 0x4FFF) + + +def device_type_id_type(id: int) -> DeviceTypeIdType: + if id in STANDARD_PREFIX and id in DEVICE_TYPE_ID_RANGE_SUFFIX: + return DeviceTypeIdType.kStandard + if id in MANUFACTURER_PREFIX and id in DEVICE_TYPE_ID_RANGE_SUFFIX: + return DeviceTypeIdType.kManufacturer + if id in TEST_PREFIX and id in DEVICE_TYPE_ID_RANGE_SUFFIX: + return DeviceTypeIdType.kTest + return DeviceTypeIdType.kInvalid + + +def is_valid_device_type_id(id_type: DeviceTypeIdType, allow_test=False) -> bool: + valid = [DeviceTypeIdType.kStandard, DeviceTypeIdType.kManufacturer] + if allow_test: + valid.append(DeviceTypeIdType.kTest) + return id_type in valid + + +def cluster_id_type(id: int) -> ClusterIdType: + if id in STANDARD_PREFIX and id in CLUSTER_ID_STANDARD_RANGE_SUFFIX: + return ClusterIdType.kStandard + if id in MANUFACTURER_PREFIX and id in CLUSTER_ID_MANUFACTURER_RANGE_SUFFIX: + return ClusterIdType.kManufacturer + if id in TEST_PREFIX and id in CLUSTER_ID_MANUFACTURER_RANGE_SUFFIX: + return ClusterIdType.kTest + return ClusterIdType.kInvalid + + +def is_valid_cluster_id(id_type: ClusterIdType, allow_test: bool = False) -> bool: + valid = [ClusterIdType.kStandard, ClusterIdType.kManufacturer] + if allow_test: + valid.append(ClusterIdType.kTest) + return id_type in valid + + +def attribute_id_type(id: int) -> AttributeIdType: + if id in STANDARD_PREFIX and id in ATTRIBUTE_ID_NON_GLOBAL_RANGE_SUFFIX: + return AttributeIdType.kStandardNonGlobal + if id in STANDARD_PREFIX and id in ATTRIBUTE_ID_GLOBAL_RANGE_SUFFIX: + return AttributeIdType.kStandardGlobal + if id in MANUFACTURER_PREFIX and id in ATTRIBUTE_ID_NON_GLOBAL_RANGE_SUFFIX: + return AttributeIdType.kManufacturer + if id in TEST_PREFIX and id in ATTRIBUTE_ID_NON_GLOBAL_RANGE_SUFFIX: + return AttributeIdType.kTest + return AttributeIdType.kInvalid + + +def is_valid_attribute_id(id_type: AttributeIdType, allow_test: bool = False): + valid = [AttributeIdType.kStandardGlobal, AttributeIdType.kStandardNonGlobal, AttributeIdType.kManufacturer] + if allow_test: + valid.append(AttributeIdType.kTest) + return id_type in valid From de5a9618aed651f3a7d919f708a3820e4f196995 Mon Sep 17 00:00:00 2001 From: shripad621git <79364691+shripad621git@users.noreply.github.com> Date: Sat, 1 Jun 2024 06:55:37 +0530 Subject: [PATCH 018/162] [ESP32] Unregistering wifi and IP event handlers before factory reset to avoid random crashes due to PostEventQueue failure. (#33684) * Unregistering wifi and IP event handlers before factory reset to avoid random crashes due to post event queue failure * Restyled by clang-format * Fix the CI failure in lit-icd app --------- Co-authored-by: Restyled.io --- src/platform/ESP32/ConfigurationManagerImpl.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index 55c8758bb85fe7..e03ec70ce8192b 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET @@ -404,6 +405,22 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) { CHIP_ERROR err; + // Unregistering the wifi and IP event handlers from the esp_default_event_loop() + err = ESP32Utils::MapError(esp_event_handler_unregister(IP_EVENT, ESP_EVENT_ANY_ID, PlatformManagerImpl::HandleESPSystemEvent)); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to unregister IP event handler"); + } + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI + err = + ESP32Utils::MapError(esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, PlatformManagerImpl::HandleESPSystemEvent)); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to unregister wifi event handler"); + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI + ChipLogProgress(DeviceLayer, "Performing factory reset"); // Erase all values in the chip-config NVS namespace. From a23560db4796f90e73276f065080470590455ac3 Mon Sep 17 00:00:00 2001 From: shripad621git <79364691+shripad621git@users.noreply.github.com> Date: Sat, 1 Jun 2024 07:24:57 +0530 Subject: [PATCH 019/162] Removind Schedule Lammda function from ConnectivityManagerWifi implementation (#33542) --- src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp b/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp index a3e369a85917aa..bbeaf6cdbc7169 100644 --- a/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp +++ b/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp @@ -780,7 +780,7 @@ void ConnectivityManagerImpl::ChangeWiFiStationState(WiFiStationState newState) ChipLogProgress(DeviceLayer, "WiFi station state change: %s -> %s", WiFiStationStateToStr(mWiFiStationState), WiFiStationStateToStr(newState)); mWiFiStationState = newState; - SystemLayer().ScheduleLambda([]() { NetworkCommissioning::ESPWiFiDriver::GetInstance().OnNetworkStatusChange(); }); + NetworkCommissioning::ESPWiFiDriver::GetInstance().OnNetworkStatusChange(); } } From c1e1e6ebfbafbd7c39c6256f5ed7e81740f8eea7 Mon Sep 17 00:00:00 2001 From: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> Date: Fri, 31 May 2024 21:58:00 -0700 Subject: [PATCH 020/162] =?UTF-8?q?Add=20support=20to=20intercept=20attrib?= =?UTF-8?q?ute=20report=20and=20prune=20any=20removed=E2=80=A6=20(#33523)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support to intercept attribute report and prune any removed endpoints and clusters and attributes from both persisted clusters data and data storage - When an attribute report is received, check if there are any changes to parts list or server list for the descriptor cluster or attribute list for any cluster. - If any endpoints were removed, make sure to delete the cluster index for the endpoint and all cluster data for that endpoint should be deleted. - If any clusters were removed from an endpoint, make sure to delete the cluster from the cluster index for that endpoint and also clear the cluster data for that cluster. - If any attributes were removed from a cluster, make sure to update the cluster data and delete the entry for the attribute that was removed. * Restyled by whitespace * Restyled by clang-format * fixes * Fix the check for the cluster paths * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Address review comments * Restyled by whitespace * Restyled by clang-format * Added helpers for removing endpoints, clusters and attributes * Restyled by clang-format * Clean up the tests * Remove addition of extra line * Restyled by clang-format * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Addressed review comments * Restyled by whitespace * Uncomment subscription pool tests * More clean up * Restyled by clang-format * Add few more strong types for data structures * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Restyled by whitespace * Restyled by clang-format * Update src/darwin/Framework/CHIP/MTRDevice.mm --------- Co-authored-by: Restyled.io Co-authored-by: Boris Zbarsky Co-authored-by: Justin Wood --- src/darwin/Framework/CHIP/MTRDevice.mm | 151 +++++- .../CHIP/MTRDeviceControllerDataStore.h | 3 + .../CHIP/MTRDeviceControllerDataStore.mm | 87 ++++ .../Framework/CHIP/MTRDevice_Internal.h | 1 + .../CHIPTests/MTRPerControllerStorageTests.m | 483 ++++++++++++++++++ .../TestHelpers/MTRTestDeclarations.h | 6 + 6 files changed, 728 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 98af8fb4ab16c2..eb16b511e2a7b1 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -209,6 +209,11 @@ - (void)storeValue:(MTRDeviceDataValueDictionary _Nullable)value forAttribute:(N _attributes[attribute] = value; } +- (void)removeValueForAttribute:(NSNumber *)attribute +{ + [_attributes removeObjectForKey:attribute]; +} + - (NSDictionary *)attributes { return _attributes; @@ -670,7 +675,7 @@ - (void)_setDSTOffsets:(NSArray completion:setDSTOffsetResponseHandler]; } -- (NSMutableArray *)arrayOfNumbersFromAttributeValue:(NSDictionary *)dataDictionary +- (NSMutableArray *)arrayOfNumbersFromAttributeValue:(MTRDeviceDataValueDictionary)dataDictionary { if (![MTRArrayValueType isEqual:dataDictionary[MTRTypeKey]]) { return nil; @@ -1892,6 +1897,17 @@ - (void)_setCachedAttributeValue:(MTRDeviceDataValueDictionary _Nullable)value f _clusterDataToPersist[clusterPath] = clusterData; } +- (void)_removeCachedAttribute:(NSNumber *)attributeID fromCluster:(MTRClusterPath *)clusterPath +{ + os_unfair_lock_assert_owner(&self->_lock); + + if (_clusterDataToPersist == nil) { + return; + } + auto * clusterData = _clusterDataToPersist[clusterPath]; + [clusterData removeValueForAttribute:attributeID]; +} + - (void)_createDataVersionFilterListFromDictionary:(NSDictionary *)dataVersions dataVersionFilterList:(DataVersionFilter **)dataVersionFilterList count:(size_t *)count sizeReduction:(size_t)sizeReduction { size_t maxDataVersionFilterSize = dataVersions.count; @@ -2956,7 +2972,7 @@ - (BOOL)_attributeDataValue:(NSDictionary *)one isEqualToDataValue:(NSDictionary } // Utility to return data value dictionary without data version -- (NSDictionary *)_dataValueWithoutDataVersion:(NSDictionary *)attributeValue; +- (NSDictionary *)_dataValueWithoutDataVersion:(NSDictionary *)attributeValue { // Sanity check for nil - return the same input to fail gracefully if (!attributeValue || !attributeValue[MTRTypeKey]) { @@ -3018,6 +3034,116 @@ - (BOOL)_attributeAffectsDeviceConfiguration:(MTRAttributePath *)attributePath return NO; } +- (void)_removeClusters:(NSSet *)clusterPathsToRemove + doRemoveFromDataStore:(BOOL)doRemoveFromDataStore +{ + os_unfair_lock_assert_owner(&self->_lock); + + [_persistedClusters minusSet:clusterPathsToRemove]; + + for (MTRClusterPath * path in clusterPathsToRemove) { + [_persistedClusterData removeObjectForKey:path]; + [_clusterDataToPersist removeObjectForKey:path]; + if (doRemoveFromDataStore) { + [self.deviceController.controllerDataStore clearStoredClusterDataForNodeID:self.nodeID endpointID:path.endpoint clusterID:path.cluster]; + } + } +} + +- (void)_removeAttributes:(NSSet *)attributes fromCluster:(MTRClusterPath *)clusterPath +{ + os_unfair_lock_assert_owner(&self->_lock); + + for (NSNumber * attribute in attributes) { + [self _removeCachedAttribute:attribute fromCluster:clusterPath]; + } + // Just clear out the NSCache entry for this cluster, so we'll load it from storage as needed. + [_persistedClusterData removeObjectForKey:clusterPath]; + [self.deviceController.controllerDataStore removeAttributes:attributes fromCluster:clusterPath forNodeID:self.nodeID]; +} + +- (void)_pruneEndpointsIn:(MTRDeviceDataValueDictionary)previousPartsListValue + missingFrom:(MTRDeviceDataValueDictionary)newPartsListValue +{ + // If the parts list changed and one or more endpoints were removed, remove all the + // clusters for all those endpoints from our data structures. + // Also remove those endpoints from the data store. + NSMutableSet * toBeRemovedEndpoints = [NSMutableSet setWithArray:[self arrayOfNumbersFromAttributeValue:previousPartsListValue]]; + NSSet * endpointsOnDevice = [NSSet setWithArray:[self arrayOfNumbersFromAttributeValue:newPartsListValue]]; + [toBeRemovedEndpoints minusSet:endpointsOnDevice]; + + for (NSNumber * endpoint in toBeRemovedEndpoints) { + NSMutableSet * clusterPathsToRemove = [[NSMutableSet alloc] init]; + for (MTRClusterPath * path in _persistedClusters) { + if ([path.endpoint isEqualToNumber:endpoint]) { + [clusterPathsToRemove addObject:path]; + } + } + [self _removeClusters:clusterPathsToRemove doRemoveFromDataStore:NO]; + [self.deviceController.controllerDataStore clearStoredClusterDataForNodeID:self.nodeID endpointID:endpoint]; + } +} + +- (void)_pruneClustersIn:(MTRDeviceDataValueDictionary)previousServerListValue + missingFrom:(MTRDeviceDataValueDictionary)newServerListValue + forEndpoint:(NSNumber *)endpointID +{ + // If the server list changed and clusters were removed, remove those clusters from our data structures. + // Also remove them from the data store. + NSMutableSet * toBeRemovedClusters = [NSMutableSet setWithArray:[self arrayOfNumbersFromAttributeValue:previousServerListValue]]; + NSSet * clustersStillOnEndpoint = [NSSet setWithArray:[self arrayOfNumbersFromAttributeValue:newServerListValue]]; + [toBeRemovedClusters minusSet:clustersStillOnEndpoint]; + + NSMutableSet * clusterPathsToRemove = [[NSMutableSet alloc] init]; + for (MTRClusterPath * path in _persistedClusters) { + if ([path.endpoint isEqualToNumber:endpointID] && [toBeRemovedClusters containsObject:path.cluster]) + [clusterPathsToRemove addObject:path]; + } + [self _removeClusters:clusterPathsToRemove doRemoveFromDataStore:YES]; +} + +- (void)_pruneAttributesIn:(MTRDeviceDataValueDictionary)previousAttributeListValue + missingFrom:(MTRDeviceDataValueDictionary)newAttributeListValue + forCluster:(MTRClusterPath *)clusterPath +{ + // If the attribute list changed and attributes were removed, remove the attributes from our + // data structures. + NSMutableSet * toBeRemovedAttributes = [NSMutableSet setWithArray:[self arrayOfNumbersFromAttributeValue:previousAttributeListValue]]; + NSSet * attributesStillInCluster = [NSSet setWithArray:[self arrayOfNumbersFromAttributeValue:newAttributeListValue]]; + + [toBeRemovedAttributes minusSet:attributesStillInCluster]; + [self _removeAttributes:toBeRemovedAttributes fromCluster:clusterPath]; +} + +- (void)_pruneStoredDataForPath:(MTRAttributePath *)attributePath + missingFrom:(MTRDeviceDataValueDictionary)newAttributeDataValue +{ + os_unfair_lock_assert_owner(&self->_lock); + + if (![self _dataStoreExists] && !_clusterDataToPersist.count) { + MTR_LOG_DEBUG("%@ No data store to prune from", self); + return; + } + + // Check if parts list changed or server list changed for the descriptor cluster or the attribute list changed for a cluster. + // If yes, we might need to prune any deleted endpoints, clusters or attributes from the storage and persisted cluster data. + if (attributePath.cluster.unsignedLongValue == MTRClusterIDTypeDescriptorID) { + if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributePartsListID && [attributePath.endpoint isEqualToNumber:@(kRootEndpointId)]) { + [self _pruneEndpointsIn:[self _cachedAttributeValueForPath:attributePath] missingFrom:newAttributeDataValue]; + return; + } + + if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributeServerListID) { + [self _pruneClustersIn:[self _cachedAttributeValueForPath:attributePath] missingFrom:newAttributeDataValue forEndpoint:attributePath.endpoint]; + return; + } + } + + if (attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeGlobalAttributeAttributeListID) { + [self _pruneAttributesIn:[self _cachedAttributeValueForPath:attributePath] missingFrom:newAttributeDataValue forCluster:[MTRClusterPath clusterPathWithEndpointID:attributePath.endpoint clusterID:attributePath.cluster]]; + } +} + // assume lock is held - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray *> *)reportedAttributeValues fromSubscription:(BOOL)isFromSubscription { @@ -3071,13 +3197,16 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray *)clusterData forNodeID:(NSNumber *)nodeID; - (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID; +- (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID; +- (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID; +- (void)removeAttributes:(NSSet *)attributes fromCluster:(MTRClusterPath *)path forNodeID:(NSNumber *)nodeID; - (void)clearAllStoredClusterData; /** diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm index c96de65d39eb84..d38712c00a5151 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm @@ -446,6 +446,23 @@ - (BOOL)_storeEndpointIndex:(NSArray *)endpointIndex forNodeID:(NSNu return [self _storeAttributeCacheValue:endpointIndex forKey:[self _endpointIndexKeyForNodeID:nodeID]]; } +- (BOOL)_removeEndpointFromEndpointIndex:(NSNumber *)endpointID forNodeID:(NSNumber *)nodeID +{ + dispatch_assert_queue(_storageDelegateQueue); + if (!endpointID || !nodeID) { + MTR_LOG_ERROR("%s: unexpected nil input", __func__); + return NO; + } + + NSMutableArray * endpointIndex = [[self _fetchEndpointIndexForNodeID:nodeID] mutableCopy]; + if (endpointIndex == nil) { + return NO; + } + + [endpointIndex removeObject:endpointID]; + return [self _storeEndpointIndex:endpointIndex forNodeID:nodeID]; +} + - (BOOL)_deleteEndpointIndexForNodeID:(NSNumber *)nodeID { dispatch_assert_queue(_storageDelegateQueue); @@ -699,6 +716,76 @@ - (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID }); } +- (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID +{ + dispatch_async(_storageDelegateQueue, ^{ + NSArray * clusterIndex = [self _fetchClusterIndexForNodeID:nodeID endpointID:endpointID]; + NSMutableArray * clusterIndexCopy = [clusterIndex mutableCopy]; + [clusterIndexCopy removeObject:clusterID]; + + BOOL success; + if (clusterIndexCopy.count != clusterIndex.count) { + success = [self _storeClusterIndex:clusterIndexCopy forNodeID:nodeID endpointID:endpointID]; + if (!success) { + MTR_LOG_ERROR("clearStoredClusterDataForNodeID: _storeClusterIndex failed for node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); + } + } + + success = [self _deleteClusterDataForNodeID:nodeID endpointID:endpointID clusterID:clusterID]; + if (!success) { + MTR_LOG_ERROR("clearStoredClusterDataForNodeID: _deleteClusterDataForNodeID failed for node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue, clusterID.unsignedLongValue); + return; + } + + MTR_LOG("clearStoredClusterDataForNodeID: Deleted endpoint %u cluster 0x%08lX for node 0x%016llX successfully", endpointID.unsignedShortValue, clusterID.unsignedLongValue, nodeID.unsignedLongLongValue); + }); +} + +- (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID +{ + dispatch_async(_storageDelegateQueue, ^{ + BOOL success = [self _removeEndpointFromEndpointIndex:endpointID forNodeID:nodeID]; + if (!success) { + MTR_LOG_ERROR("removeEndpointFromEndpointIndex for endpointID %u failed for node 0x%016llX", endpointID.unsignedShortValue, nodeID.unsignedLongLongValue); + } + + NSArray * clusterIndex = [self _fetchClusterIndexForNodeID:nodeID endpointID:endpointID]; + + for (NSNumber * cluster in clusterIndex) { + success = [self _deleteClusterDataForNodeID:nodeID endpointID:endpointID clusterID:cluster]; + if (!success) { + MTR_LOG_ERROR("Delete failed for clusterData for node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue, cluster.unsignedLongValue); + } + } + + success = [self _deleteClusterIndexForNodeID:nodeID endpointID:endpointID]; + if (!success) { + MTR_LOG_ERROR("Delete failed for clusterIndex for node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); + } + + MTR_LOG("clearStoredClusterDataForNodeID: Deleted endpoint %u for node 0x%016llX successfully", endpointID.unsignedShortValue, nodeID.unsignedLongLongValue); + }); +} + +- (void)removeAttributes:(NSSet *)attributes fromCluster:(MTRClusterPath *)path forNodeID:(NSNumber *)nodeID +{ + MTRDeviceClusterData * clusterData = [self getStoredClusterDataForNodeID:nodeID endpointID:path.endpoint clusterID:path.cluster]; + if (clusterData == nil) { + return; + } + for (NSNumber * attribute in attributes) { + [clusterData removeValueForAttribute:attribute]; + } + + dispatch_async(_storageDelegateQueue, ^{ + BOOL success = [self _storeClusterData:clusterData forNodeID:nodeID endpointID:path.endpoint clusterID:path.cluster]; + if (!success) { + MTR_LOG_ERROR("removeAttributes: _storeClusterData failed for node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, path.endpoint.unsignedShortValue); + } + MTR_LOG("removeAttributes: Deleted attributes %@ from endpoint %u cluster 0x%08lX for node 0x%016llX successfully", attributes, path.endpoint.unsignedShortValue, path.cluster.unsignedLongValue, nodeID.unsignedLongLongValue); + }); +} + - (void)clearAllStoredClusterData { dispatch_async(_storageDelegateQueue, ^{ diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index a9647122d4fba2..2ad2f6422dd9e7 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -60,6 +60,7 @@ MTR_TESTABLE @property (nonatomic, readonly) NSDictionary * attributes; // attributeID => data-value dictionary - (void)storeValue:(MTRDeviceDataValueDictionary _Nullable)value forAttribute:(NSNumber *)attribute; +- (void)removeValueForAttribute:(NSNumber *)attribute; - (nullable instancetype)initWithDataVersion:(NSNumber * _Nullable)dataVersion attributes:(NSDictionary * _Nullable)attributes; @end diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index 52b1ae36673b28..fc233ffaebf93d 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -2298,4 +2298,487 @@ - (void)testSubscriptionPool [self doTestSubscriptionPoolWithSize:2 deviceOnboardingPayloads:deviceOnboardingPayloads]; } +- (MTRDevice *)getMTRDevice:(NSNumber *)deviceID +{ + __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; + XCTAssertNotNil(factory); + + __auto_type * rootKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(rootKeys); + + __auto_type * operationalKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(operationalKeys); + + NSNumber * nodeID = @(123); + NSNumber * fabricID = @(456); + + NSError * error; + __auto_type * storageDelegate = [[MTRTestPerControllerStorageWithBulkReadWrite alloc] initWithControllerID:[NSUUID UUID]]; + MTRPerControllerStorageTestsCertificateIssuer * certificateIssuer; + MTRDeviceController * controller = [self startControllerWithRootKeys:rootKeys + operationalKeys:operationalKeys + fabricID:fabricID + nodeID:nodeID + storage:storageDelegate + error:&error + certificateIssuer:&certificateIssuer]; + XCTAssertNil(error); + XCTAssertNotNil(controller); + XCTAssertTrue([controller isRunning]); + + XCTAssertEqualObjects(controller.controllerNodeID, nodeID); + + certificateIssuer.nextNodeID = deviceID; + [self commissionWithController:controller newNodeID:deviceID]; + + MTRDevice * device = [MTRDevice deviceWithNodeID:deviceID controller:controller]; + return device; +} + +- (NSMutableArray *)getEndpointArrayFromPartsList:(MTRDeviceDataValueDictionary)partsList forDevice:(MTRDevice *)device +{ + // Initialize the endpoint array with endpoint 0. + NSMutableArray * endpoints = [NSMutableArray arrayWithObject:@0]; + + [endpoints addObjectsFromArray:[device arrayOfNumbersFromAttributeValue:partsList]]; + return endpoints; +} + +- (void)testDataStorageUpdatesWhenRemovingEndpoints +{ + NSNumber * deviceID = @(17); + __auto_type * device = [self getMTRDevice:deviceID]; + __auto_type queue = dispatch_get_main_queue(); + __auto_type * delegate = [[MTRDeviceTestDelegate alloc] init]; + __auto_type * controller = device.deviceController; + + XCTestExpectation * subscriptionExpectation = [self expectationWithDescription:@"Subscription has been set up"]; + + __block NSNumber * dataVersionForPartsList; + __block NSNumber * rootEndpoint = @0; + + // This test will do the following - + // 1. Get the data version and attribute value of the parts list for endpoint 0 to inject a fake report. The attribute report will delete endpoint 2. + // That should cause the endpoint and its corresponding clusters to be removed from data storage. + // 2. The data store is populated with cluster index and cluster data for endpoints 0, 1 and 2 initially. + // 3. After the fake attribute report is injected with deleted endpoint 2, make sure the data store is still populated with cluster index and cluster data + // for endpoints 0 and 1 but not 2. + __block MTRDeviceDataValueDictionary testDataForPartsList; + __block id testClusterDataValueForPartsList; + delegate.onAttributeDataReceived = ^(NSArray *> * attributeReport) { + XCTAssertGreaterThan(attributeReport.count, 0); + + for (NSDictionary * attributeDict in attributeReport) { + MTRAttributePath * attributePath = attributeDict[MTRAttributePathKey]; + XCTAssertNotNil(attributePath); + + if ([attributePath.endpoint isEqualToNumber:rootEndpoint] && attributePath.cluster.unsignedLongValue == MTRClusterIDTypeDescriptorID && attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributePartsListID) { + testDataForPartsList = attributeDict[MTRDataKey]; + XCTAssertNotNil(testDataForPartsList); + dataVersionForPartsList = testDataForPartsList[MTRDataVersionKey]; + id dataValue = testDataForPartsList[MTRValueKey]; + XCTAssertNotNil(dataValue); + testClusterDataValueForPartsList = [dataValue mutableCopy]; + } + } + }; + + __block NSMutableDictionary *> * initialClusterIndex = [[NSMutableDictionary alloc] init]; + __block NSMutableArray * testEndpoints; + + delegate.onReportEnd = ^{ + XCTAssertNotNil(dataVersionForPartsList); + XCTAssertNotNil(testClusterDataValueForPartsList); + testEndpoints = [self getEndpointArrayFromPartsList:testDataForPartsList forDevice:device]; + + // Make sure that the cluster data in the data storage is populated with cluster index and cluster data for endpoints 0, 1 and 2. + // We do not need to check _persistedClusterData here. _persistedClusterData will be paged in from storage when needed so + // just checking data storage should suffice here. + dispatch_sync(self->_storageQueue, ^{ + XCTAssertTrue([[controller.controllerDataStore _fetchEndpointIndexForNodeID:deviceID] isEqualToArray:testEndpoints]); + + // Populate the initialClusterIndex to use as a reference for all cluster paths later. + for (NSNumber * endpoint in testEndpoints) { + [initialClusterIndex setObject:[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:endpoint] forKey:endpoint]; + } + + for (NSNumber * endpoint in testEndpoints) { + for (NSNumber * cluster in [initialClusterIndex objectForKey:endpoint]) { + XCTAssertNotNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:endpoint clusterID:cluster]); + } + } + }); + [subscriptionExpectation fulfill]; + }; + + [device setDelegate:delegate queue:queue]; + + [self waitForExpectations:@[ subscriptionExpectation ] timeout:60]; + + // Inject a fake attribute report deleting endpoint 2 from the parts list at the root endpoint. + dataVersionForPartsList = [NSNumber numberWithUnsignedLongLong:(dataVersionForPartsList.unsignedLongLongValue + 1)]; + + // Delete endpoint 2 from the attribute value in parts list. + NSNumber * toBeDeletedEndpoint = @2; + id endpointData = + @{ + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : toBeDeletedEndpoint, + } + }; + + [testClusterDataValueForPartsList removeObject:endpointData]; + + NSArray *> * attributeReport = @[ @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:rootEndpoint clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributePartsListID)], + MTRDataKey : @ { + MTRDataVersionKey : dataVersionForPartsList, + MTRTypeKey : MTRArrayValueType, + MTRValueKey : testClusterDataValueForPartsList, + } + } ]; + + XCTestExpectation * attributeDataReceivedExpectation = [self expectationWithDescription:@"Injected Attribute data received"]; + XCTestExpectation * reportEndExpectation = [self expectationWithDescription:@"Injected Attribute data report ended"]; + delegate.onAttributeDataReceived = ^(NSArray *> * attributeReport) { + XCTAssertGreaterThan(attributeReport.count, 0); + + for (NSDictionary * attributeDict in attributeReport) { + MTRAttributePath * attributePath = attributeDict[MTRAttributePathKey]; + XCTAssertNotNil(attributePath); + + // Get the new updated parts list value to get the new test endpoints. + if ([attributePath.endpoint isEqualToNumber:rootEndpoint] && attributePath.cluster.unsignedLongValue == MTRClusterIDTypeDescriptorID && attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributePartsListID) { + testDataForPartsList = attributeDict[MTRDataKey]; + XCTAssertNotNil(testDataForPartsList); + id dataValue = testDataForPartsList[MTRValueKey]; + XCTAssertNotNil(dataValue); + testClusterDataValueForPartsList = [dataValue mutableCopy]; + } + } + [attributeDataReceivedExpectation fulfill]; + }; + + delegate.onReportEnd = ^{ + XCTAssertNotNil(testClusterDataValueForPartsList); + testEndpoints = [self getEndpointArrayFromPartsList:testDataForPartsList forDevice:device]; + + // Make sure that the cluster data in the data storage for endpoints 0 and 1 are present but not for endpoint 2. + // We do not need to check _persistedClusterData here. _persistedClusterData will be paged in from storage when needed so + // just checking data storage should suffice here. + dispatch_sync(self->_storageQueue, ^{ + XCTAssertTrue([[controller.controllerDataStore _fetchEndpointIndexForNodeID:deviceID] isEqualToArray:testEndpoints]); + for (NSNumber * endpoint in testEndpoints) { + XCTAssertNotNil(initialClusterIndex); + for (NSNumber * cluster in [initialClusterIndex objectForKey:endpoint]) { + if ([endpoint isEqualToNumber:toBeDeletedEndpoint]) { + XCTAssertNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:endpoint clusterID:cluster]); + } else { + XCTAssertNotNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:endpoint clusterID:cluster]); + } + } + } + }); + [reportEndExpectation fulfill]; + }; + + [device unitTestInjectAttributeReport:attributeReport fromSubscription:YES]; + + [self waitForExpectations:@[ attributeDataReceivedExpectation, reportEndExpectation ] timeout:60]; + + [controller.controllerDataStore clearAllStoredClusterData]; + NSDictionary * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID]; + XCTAssertEqual(storedClusterDataAfterClear.count, 0); + + [controller removeDevice:device]; + // Reset our commissionee. + __auto_type * baseDevice = [MTRBaseDevice deviceWithNodeID:deviceID controller:controller]; + ResetCommissionee(baseDevice, queue, self, kTimeoutInSeconds); + + [controller shutdown]; + XCTAssertFalse([controller isRunning]); +} + +- (void)testDataStorageUpdatesWhenRemovingClusters +{ + NSNumber * deviceID = @(17); + __auto_type * device = [self getMTRDevice:deviceID]; + __auto_type queue = dispatch_get_main_queue(); + __auto_type * delegate = [[MTRDeviceTestDelegate alloc] init]; + __auto_type * controller = device.deviceController; + + XCTestExpectation * subscriptionExpectation = [self expectationWithDescription:@"Subscription has been set up"]; + + __block NSNumber * dataVersionForServerList; + __block NSNumber * testEndpoint = @1; + + // This test will do the following - + // 1. Get the data version and attribute value of the server list for endpoint 1 to inject a fake report. The attribute report will delete cluster ID - MTRClusterIDTypeIdentifyID. + // That should cause the cluster to be removed from cluster index for endpoint 1 and the cluster data for the removed cluster should be cleared from data storage. + // 2. The data store is populated with MTRClusterIDTypeIdentifyID in the cluster index and cluster data for endpoint 1 initially. + // 3. After the fake attribute report is injected with deleted cluster ID - MTRClusterIDTypeIdentifyID, make sure the data store is still populated with cluster index and + // cluster data for all other clusters at endpoint 1 but not the deleted cluster. + __block id testClusterDataValue; + delegate.onAttributeDataReceived = ^(NSArray *> * attributeReport) { + XCTAssertGreaterThan(attributeReport.count, 0); + + for (NSDictionary * attributeDict in attributeReport) { + MTRAttributePath * attributePath = attributeDict[MTRAttributePathKey]; + XCTAssertNotNil(attributePath); + + if ([attributePath.endpoint isEqualToNumber:testEndpoint] && attributePath.cluster.unsignedLongValue == MTRClusterIDTypeDescriptorID && attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterDescriptorAttributeServerListID) { + MTRDeviceDataValueDictionary data = attributeDict[MTRDataKey]; + XCTAssertNotNil(data); + dataVersionForServerList = data[MTRDataVersionKey]; + id dataValue = data[MTRValueKey]; + XCTAssertNotNil(dataValue); + testClusterDataValue = [dataValue mutableCopy]; + } + } + }; + + __block NSMutableArray * initialClusterIndex = [[NSMutableArray alloc] init]; + __block NSNumber * toBeDeletedCluster = @(MTRClusterIDTypeIdentifyID); + + delegate.onReportEnd = ^{ + XCTAssertNotNil(dataVersionForServerList); + XCTAssertNotNil(testClusterDataValue); + + // Make sure that the cluster data in the data storage has cluster ID - MTRClusterIDTypeIdentifyID in the cluster index for endpoint 1 + // and cluster data for MTRClusterIDTypeIdentifyID exists. + // We do not need to check _persistedClusterData here. _persistedClusterData will be paged in from storage when needed so + // just checking data storage should suffice here. + dispatch_sync(self->_storageQueue, ^{ + initialClusterIndex = [[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:testEndpoint] mutableCopy]; + XCTAssertTrue([initialClusterIndex containsObject:toBeDeletedCluster]); + for (NSNumber * cluster in initialClusterIndex) { + XCTAssertNotNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:testEndpoint clusterID:cluster]); + } + }); + [subscriptionExpectation fulfill]; + }; + + [device setDelegate:delegate queue:queue]; + + [self waitForExpectations:@[ subscriptionExpectation ] timeout:60]; + + // Inject a fake attribute report after removing cluster ID - MTRClusterIDTypeIdentifyID from endpoint 1 to the server list. + dataVersionForServerList = [NSNumber numberWithUnsignedLongLong:(dataVersionForServerList.unsignedLongLongValue + 1)]; + id identifyClusterData = + @{ + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : toBeDeletedCluster, + } + }; + [testClusterDataValue removeObject:identifyClusterData]; + + NSArray *> * attributeReport = @[ @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:testEndpoint clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeServerListID)], + MTRDataKey : @ { + MTRDataVersionKey : dataVersionForServerList, + MTRTypeKey : MTRArrayValueType, + MTRValueKey : testClusterDataValue, + } + } ]; + + XCTestExpectation * attributeDataReceivedExpectation = [self expectationWithDescription:@"Injected Attribute data received"]; + XCTestExpectation * reportEndExpectation = [self expectationWithDescription:@"Injected Attribute data report ended"]; + delegate.onAttributeDataReceived = ^(NSArray *> * attributeReport) { + XCTAssertGreaterThan(attributeReport.count, 0); + [attributeDataReceivedExpectation fulfill]; + }; + + delegate.onReportEnd = ^{ + // Make sure that the cluster data does not have cluster ID - MTRClusterIDTypeIdentifyID in the cluster index for endpoint 1 + // and cluster data for MTRClusterIDTypeIdentifyID is nil. + // We do not need to check _persistedClusterData here. _persistedClusterData will be paged in from storage when needed so + // just checking data storage should suffice here. + dispatch_sync(self->_storageQueue, ^{ + XCTAssertFalse([[controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:testEndpoint] containsObject:toBeDeletedCluster]); + for (NSNumber * cluster in initialClusterIndex) { + if ([cluster isEqualToNumber:toBeDeletedCluster]) { + XCTAssertNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:testEndpoint clusterID:cluster]); + } else { + XCTAssertNotNil([controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:testEndpoint clusterID:cluster]); + } + } + }); + [reportEndExpectation fulfill]; + }; + + [device unitTestInjectAttributeReport:attributeReport fromSubscription:YES]; + + [self waitForExpectations:@[ attributeDataReceivedExpectation, reportEndExpectation ] timeout:60]; + + [controller.controllerDataStore clearAllStoredClusterData]; + NSDictionary * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID]; + XCTAssertEqual(storedClusterDataAfterClear.count, 0); + + [controller removeDevice:device]; + // Reset our commissionee. + __auto_type * baseDevice = [MTRBaseDevice deviceWithNodeID:deviceID controller:controller]; + ResetCommissionee(baseDevice, queue, self, kTimeoutInSeconds); + + [controller shutdown]; + XCTAssertFalse([controller isRunning]); +} + +- (void)testDataStorageUpdatesWhenRemovingAttributes +{ + NSNumber * deviceID = @(17); + __auto_type * device = [self getMTRDevice:deviceID]; + __auto_type queue = dispatch_get_main_queue(); + __auto_type * delegate = [[MTRDeviceTestDelegate alloc] init]; + __auto_type * controller = device.deviceController; + + XCTestExpectation * subscriptionExpectation = [self expectationWithDescription:@"Subscription has been set up"]; + + __block NSNumber * dataVersionForIdentify; + __block NSNumber * testEndpoint = @(1); + __block NSNumber * toBeDeletedAttribute = @(1); + __block id testClusterDataValue; + + // This test will do the following - + // 1. Get the data version and attribute value of the attribute list for endpoint 1 to inject a fake report with attribute 1 removed from MTRClusterIDTypeIdentifyID. + // 2. The data store is populated with cluster data for MTRClusterIDTypeIdentifyID cluster and has all attributes including attribute 1. + // 3. After the fake attribute report is injected, make sure the data store is populated with cluster data for all attributes in MTRClusterIDTypeIdentifyID + // cluster except for attribute 1 which has been deleted. + delegate.onAttributeDataReceived = ^(NSArray *> * attributeReport) { + XCTAssertGreaterThan(attributeReport.count, 0); + + for (NSDictionary * attributeDict in attributeReport) { + MTRAttributePath * attributePath = attributeDict[MTRAttributePathKey]; + XCTAssertNotNil(attributePath); + + if ([attributePath.endpoint isEqualToNumber:testEndpoint] && attributePath.cluster.unsignedLongValue == MTRClusterIDTypeIdentifyID && attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeGlobalAttributeAttributeListID) { + MTRDeviceDataValueDictionary data = attributeDict[MTRDataKey]; + XCTAssertNotNil(data); + dataVersionForIdentify = data[MTRDataVersionKey]; + id dataValue = data[MTRValueKey]; + XCTAssertNotNil(dataValue); + testClusterDataValue = [dataValue mutableCopy]; + } + } + }; + + __block NSMutableArray * initialTestAttributes = [[NSMutableArray alloc] init]; + + delegate.onReportEnd = ^{ + XCTAssertNotNil(dataVersionForIdentify); + XCTAssertNotNil(testClusterDataValue); + + dispatch_sync(self->_storageQueue, ^{ + for (NSNumber * cluster in [controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:testEndpoint]) { + + // Make sure that the cluster data in the data storage is populated with cluster data for MTRClusterIDTypeIdentifyID cluster + // and has all attributes including attribute 1. + // We will page in the cluster data from storage to check the above. + MTRClusterPath * path = [MTRClusterPath clusterPathWithEndpointID:testEndpoint clusterID:cluster]; + + if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) { + MTRDeviceClusterData * data = [device _getClusterDataForPath:path]; + XCTAssertNotNil(data); + XCTAssertNotNil(data.attributes); + + MTRDeviceDataValueDictionary dict = [data.attributes objectForKey:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)]; + XCTAssertNotNil(dict); + + NSMutableArray * persistedAttributes = [device arrayOfNumbersFromAttributeValue:dict]; + initialTestAttributes = [device arrayOfNumbersFromAttributeValue:@ { MTRTypeKey : MTRArrayValueType, MTRValueKey : testClusterDataValue }]; + XCTAssertNotNil(persistedAttributes); + for (NSNumber * attribute in initialTestAttributes) { + XCTAssertTrue([persistedAttributes containsObject:attribute]); + } + } + } + }); + + [subscriptionExpectation fulfill]; + }; + + [device setDelegate:delegate queue:queue]; + + [self waitForExpectations:@[ subscriptionExpectation ] timeout:60]; + + dataVersionForIdentify = [NSNumber numberWithUnsignedLongLong:(dataVersionForIdentify.unsignedLongLongValue + 1)]; + id attributeData = + @{ + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : toBeDeletedAttribute, + } + }; + + [testClusterDataValue removeObject:attributeData]; + + NSArray *> * attributeReport = @[ @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:testEndpoint clusterID:@(MTRClusterIDTypeIdentifyID) attributeID:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)], + MTRDataKey : @ { + MTRDataVersionKey : dataVersionForIdentify, + MTRTypeKey : MTRArrayValueType, + MTRValueKey : testClusterDataValue, + } + } ]; + + XCTestExpectation * attributeDataReceivedExpectation = [self expectationWithDescription:@"Injected Attribute data received"]; + XCTestExpectation * reportEndExpectation = [self expectationWithDescription:@"Injected Attribute data report ended"]; + delegate.onAttributeDataReceived = ^(NSArray *> * attributeReport) { + XCTAssertGreaterThan(attributeReport.count, 0); + + [attributeDataReceivedExpectation fulfill]; + }; + + delegate.onReportEnd = ^{ + // Make sure that the cluster data in the data storage is populated with cluster data for MTRClusterIDTypeIdentifyID cluster + // and has all attributes except attribute 1 which was deleted. + // We will page in the cluster data from storage to check the above. + dispatch_sync(self->_storageQueue, ^{ + for (NSNumber * cluster in [controller.controllerDataStore _fetchClusterIndexForNodeID:deviceID endpointID:testEndpoint]) { + MTRDeviceClusterData * clusterData = [controller.controllerDataStore _fetchClusterDataForNodeID:deviceID endpointID:testEndpoint clusterID:cluster]; + XCTAssertNotNil(clusterData); + MTRClusterPath * path = [MTRClusterPath clusterPathWithEndpointID:testEndpoint clusterID:cluster]; + + if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) { + MTRDeviceClusterData * data = [device _getClusterDataForPath:path]; + XCTAssertNotNil(data); + XCTAssertNotNil(data.attributes); + + MTRDeviceDataValueDictionary attributeListValue = [data.attributes objectForKey:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)]; + XCTAssertNotNil(attributeListValue); + + NSMutableArray * persistedAttributes = [device arrayOfNumbersFromAttributeValue:attributeListValue]; + XCTAssertNotNil(persistedAttributes); + for (NSNumber * attribute in initialTestAttributes) { + if ([attribute isEqualToNumber:toBeDeletedAttribute]) { + XCTAssertFalse([persistedAttributes containsObject:attribute]); + } else { + XCTAssertTrue([persistedAttributes containsObject:attribute]); + } + } + } + } + }); + + [reportEndExpectation fulfill]; + }; + + [device unitTestInjectAttributeReport:attributeReport fromSubscription:YES]; + + [self waitForExpectations:@[ attributeDataReceivedExpectation, reportEndExpectation ] timeout:60]; + + [controller.controllerDataStore clearAllStoredClusterData]; + NSDictionary * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID]; + XCTAssertEqual(storedClusterDataAfterClear.count, 0); + + [controller removeDevice:device]; + // Reset our commissionee. + __auto_type * baseDevice = [MTRBaseDevice deviceWithNodeID:deviceID controller:controller]; + ResetCommissionee(baseDevice, queue, self, kTimeoutInSeconds); + + [controller shutdown]; + XCTAssertFalse([controller isRunning]); +} + @end diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h index 5c55685d6db741..c18daf6199d8e3 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h @@ -33,6 +33,9 @@ NS_ASSUME_NONNULL_BEGIN - (NSString *)_endpointIndexKeyForNodeID:(NSNumber *)nodeID; - (NSString *)_clusterIndexKeyForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID; - (NSString *)_clusterDataKeyForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID; +- (nullable NSArray *)_fetchEndpointIndexForNodeID:(NSNumber *)nodeID; +- (nullable NSArray *)_fetchClusterIndexForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID; +- (nullable MTRDeviceClusterData *)_fetchClusterDataForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID; @end // Declare internal methods for testing @@ -44,6 +47,9 @@ NS_ASSUME_NONNULL_BEGIN @interface MTRDevice (Test) - (BOOL)_attributeDataValue:(NSDictionary *)one isEqualToDataValue:(NSDictionary *)theOther; +- (MTRDeviceClusterData *)_getClusterDataForPath:(MTRClusterPath *)path; +- (BOOL)_clusterHasBeenPersisted:(MTRClusterPath *)path; +- (NSMutableArray *)arrayOfNumbersFromAttributeValue:(MTRDeviceDataValueDictionary)dataDictionary; @end #pragma mark - Declarations for items compiled only for DEBUG configuration From defde893138e0fd483ff0c189d68c9348fc9ddae Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Sat, 1 Jun 2024 09:04:26 -0700 Subject: [PATCH 021/162] Fixing crash in darwin framework (#33698) * Fixing crash * Restyled by clang-format * Reminder for future me * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/darwin/Framework/CHIP/MTRDevice.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index eb16b511e2a7b1..2e2acd3069aa6e 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -963,6 +963,7 @@ - (void)_changeInternalState:(MTRInternalDeviceState)state MTR_LOG("%@ internal state change %lu => %lu", self, static_cast(lastState), static_cast(state)); /* BEGIN DRAGONS: This is a huge hack for a specific use case, do not rename, remove or modify behavior here */ + // TODO: This should only be called for thread devices id delegate = _weakDelegate.strongObject; if ([delegate respondsToSelector:@selector(_deviceInternalStateChanged:)]) { dispatch_async(_delegateQueue, ^{ @@ -3650,17 +3651,18 @@ - (BOOL)_deviceHasActiveSubscription { std::lock_guard lock(_lock); + // TODO: This should always return YES for thread devices return HaveSubscriptionEstablishedRightNow(_internalDeviceState); } - (void)_deviceMayBeReachable { - assertChipStackLockedByCurrentThread(); - MTR_LOG("%@ _deviceMayBeReachable called", self); - - [self _triggerResubscribeWithReason:@"SPI client indicated the device may now be reachable" - nodeLikelyReachable:YES]; + // TODO: This should only be allowed for thread devices + [_deviceController asyncDispatchToMatterQueue:^{ + [self _triggerResubscribeWithReason:@"SPI client indicated the device may now be reachable" + nodeLikelyReachable:YES]; + } errorHandler:nil]; } /* END DRAGONS */ From e0bdb09b375f14ad04d83fff5b2001860ab0465f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Sat, 1 Jun 2024 12:08:10 -0400 Subject: [PATCH 022/162] Update network-commissioning to use `AddResponse` for responding to scan responses (#33687) * Add support for thread encoding to tlv * Preserve awkward sort inside a loop * Add a TODO comment ... insertion sort in a loop is awkward * Make use of the new class * Add ifdefs * Fix out parameter to be a reference * Restyle * Comment typo fix and add one more comment * Remove comment: we encode right away, so no lifetime issue * Update src/app/clusters/network-commissioning/network-commissioning.cpp Co-authored-by: Boris Zbarsky * Update src/app/clusters/network-commissioning/network-commissioning.cpp Co-authored-by: Boris Zbarsky * Fix ifdef * Comment update --------- Co-authored-by: Andrei Litvin Co-authored-by: Boris Zbarsky --- .../network-commissioning.cpp | 374 +++++++++++------- 1 file changed, 227 insertions(+), 147 deletions(-) diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index daa843588f5718..f2e74033d8266c 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -115,6 +115,225 @@ BitFlags WiFiFeatures(WiFiDriver * driver) return features; } +/// Performs an auto-release of the given item, generally an `Iterator` type +/// like Wifi or Thread scan results. +template +class AutoRelease +{ +public: + AutoRelease(T * iterator) : mValue(iterator) {} + ~AutoRelease() + { + if (mValue != nullptr) + { + mValue->Release(); + } + } + +private: + T * mValue; +}; + +/// Convenience macro to auto-create a variable for you to release the given name at +/// the exit of the current scope. +#define DEFER_AUTO_RELEASE(name) AutoRelease autoRelease##__COUNTER__(name) + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP + +/// Handles encoding a WifiScanResponseIterator into a TLV response structure +class WifiScanResponseToTLV : public chip::app::DataModel::EncodableToTLV +{ +public: + WifiScanResponseToTLV(Status status, CharSpan debugText, WiFiScanResponseIterator * networks) : + mStatus(status), mDebugText(debugText), mNetworks(networks) + {} + + CHIP_ERROR EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const override; + +private: + Status mStatus; + CharSpan mDebugText; + WiFiScanResponseIterator * mNetworks; +}; + +CHIP_ERROR WifiScanResponseToTLV::EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outerType; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outerType)); + + ReturnErrorOnFailure(writer.Put(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kNetworkingStatus), mStatus)); + if (mDebugText.size() != 0) + { + ReturnErrorOnFailure( + DataModel::Encode(writer, TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kDebugText), mDebugText)); + } + + { + TLV::TLVType listContainerType; + ReturnErrorOnFailure(writer.StartContainer(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kWiFiScanResults), + TLV::kTLVType_Array, listContainerType)); + + if ((mStatus == Status::kSuccess) && (mNetworks != nullptr)) + { + WiFiScanResponse scanResponse; + size_t networksEncoded = 0; + while (mNetworks->Next(scanResponse)) + { + Structs::WiFiInterfaceScanResultStruct::Type result; + result.security = scanResponse.security; + result.ssid = ByteSpan(scanResponse.ssid, scanResponse.ssidLen); + result.bssid = ByteSpan(scanResponse.bssid, sizeof(scanResponse.bssid)); + result.channel = scanResponse.channel; + result.wiFiBand = scanResponse.wiFiBand; + result.rssi = scanResponse.rssi; + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::AnonymousTag(), result)); + + ++networksEncoded; + if (networksEncoded >= kMaxNetworksInScanResponse) + { + break; + } + } + } + + ReturnErrorOnFailure(writer.EndContainer(listContainerType)); + } + + return writer.EndContainer(outerType); +} + +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + +/// Handles encoding a ThreadScanResponseIterator into a TLV response structure. +class ThreadScanResponseToTLV : public chip::app::DataModel::EncodableToTLV +{ +public: + ThreadScanResponseToTLV(Status status, CharSpan debugText, ThreadScanResponseIterator * networks) : + mStatus(status), mDebugText(debugText), mNetworks(networks) + {} + + CHIP_ERROR EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const override; + +private: + Status mStatus; + CharSpan mDebugText; + ThreadScanResponseIterator * mNetworks; + + /// Fills up scanResponseArray with valid and de-duplicated thread responses from mNetworks. + /// Handles sorting and keeping only larger rssi + /// + /// Returns the valid list of scan responses into `validResponses`, which is only valid + /// as long as scanResponseArray is valid. + CHIP_ERROR LoadResponses(Platform::ScopedMemoryBuffer & scanResponseArray, + Span & validResponses) const; +}; + +CHIP_ERROR ThreadScanResponseToTLV::LoadResponses(Platform::ScopedMemoryBuffer & scanResponseArray, + Span & validResponses) const +{ + VerifyOrReturnError(scanResponseArray.Alloc(chip::min(mNetworks->Count(), kMaxNetworksInScanResponse)), CHIP_ERROR_NO_MEMORY); + + ThreadScanResponse scanResponse; + size_t scanResponseArrayLength = 0; + for (; mNetworks != nullptr && mNetworks->Next(scanResponse);) + { + if ((scanResponseArrayLength == kMaxNetworksInScanResponse) && + (scanResponseArray[scanResponseArrayLength - 1].rssi > scanResponse.rssi)) + { + continue; + } + + bool isDuplicated = false; + + for (size_t i = 0; i < scanResponseArrayLength; i++) + { + if ((scanResponseArray[i].panId == scanResponse.panId) && + (scanResponseArray[i].extendedPanId == scanResponse.extendedPanId)) + { + if (scanResponseArray[i].rssi < scanResponse.rssi) + { + scanResponseArray[i] = scanResponseArray[--scanResponseArrayLength]; + } + else + { + isDuplicated = true; + } + break; + } + } + + if (isDuplicated) + { + continue; + } + + if (scanResponseArrayLength < kMaxNetworksInScanResponse) + { + scanResponseArrayLength++; + } + scanResponseArray[scanResponseArrayLength - 1] = scanResponse; + + // TODO: this is a sort (insertion sort even, so O(n^2)) in a O(n) loop. + /// There should be some better alternatives to not have some O(n^3) processing complexity. + Sorting::InsertionSort(scanResponseArray.Get(), scanResponseArrayLength, + [](const ThreadScanResponse & a, const ThreadScanResponse & b) -> bool { return a.rssi > b.rssi; }); + } + + validResponses = Span(scanResponseArray.Get(), scanResponseArrayLength); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThreadScanResponseToTLV::EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + Platform::ScopedMemoryBuffer responseArray; + Span responseSpan; + + ReturnErrorOnFailure(LoadResponses(responseArray, responseSpan)); + + TLV::TLVType outerType; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outerType)); + + ReturnErrorOnFailure(writer.Put(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kNetworkingStatus), mStatus)); + if (mDebugText.size() != 0) + { + ReturnErrorOnFailure( + DataModel::Encode(writer, TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kDebugText), mDebugText)); + } + + { + TLV::TLVType listContainerType; + ReturnErrorOnFailure(writer.StartContainer(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kThreadScanResults), + TLV::kTLVType_Array, listContainerType)); + + for (const ThreadScanResponse & response : responseSpan) + { + Structs::ThreadInterfaceScanResultStruct::Type result; + uint8_t extendedAddressBuffer[Thread::kSizeExtendedPanId]; + + Encoding::BigEndian::Put64(extendedAddressBuffer, response.extendedAddress); + result.panId = response.panId; + result.extendedPanId = response.extendedPanId; + result.networkName = CharSpan(response.networkName, response.networkNameLen); + result.channel = response.channel; + result.version = response.version; + result.extendedAddress = ByteSpan(extendedAddressBuffer); + result.rssi = response.rssi; + result.lqi = response.lqi; + + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::AnonymousTag(), result)); + } + + ReturnErrorOnFailure(writer.EndContainer(listContainerType)); + } + + return writer.EndContainer(outerType); +} + +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD + } // namespace Instance::Instance(EndpointId aEndpointId, WiFiDriver * apDelegate) : @@ -986,8 +1205,9 @@ void Instance::OnResult(Status commissioningError, CharSpan debugText, int32_t i void Instance::OnFinished(Status status, CharSpan debugText, ThreadScanResponseIterator * networks) { + DEFER_AUTO_RELEASE(networks); + #if CHIP_DEVICE_CONFIG_ENABLE_THREAD - CHIP_ERROR err = CHIP_NO_ERROR; auto commandHandleRef = std::move(mAsyncCommandHandle); auto commandHandle = commandHandleRef.Get(); if (commandHandle == nullptr) @@ -999,111 +1219,21 @@ void Instance::OnFinished(Status status, CharSpan debugText, ThreadScanResponseI SetLastNetworkingStatusValue(MakeNullable(status)); - TLV::TLVWriter * writer; - TLV::TLVType listContainerType; - ThreadScanResponse scanResponse; - Platform::ScopedMemoryBuffer scanResponseArray; - size_t scanResponseArrayLength = 0; - uint8_t extendedAddressBuffer[Thread::kSizeExtendedPanId]; - - const CommandHandler::InvokeResponseParameters prepareParams(mPath); - SuccessOrExit( - err = commandHandle->PrepareInvokeResponseCommand( - ConcreteCommandPath(mPath.mEndpointId, NetworkCommissioning::Id, Commands::ScanNetworksResponse::Id), prepareParams)); - VerifyOrExit((writer = commandHandle->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - - SuccessOrExit(err = writer->Put(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kNetworkingStatus), status)); - if (debugText.size() != 0) - { - SuccessOrExit( - err = DataModel::Encode(*writer, TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kDebugText), debugText)); - } - SuccessOrExit(err = writer->StartContainer(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kThreadScanResults), - TLV::TLVType::kTLVType_Array, listContainerType)); - - // If no network was found, we encode an empty list, don't call a zero-sized alloc. - if ((status == Status::kSuccess) && (networks->Count() > 0)) - { - VerifyOrExit(scanResponseArray.Alloc(chip::min(networks->Count(), kMaxNetworksInScanResponse)), err = CHIP_ERROR_NO_MEMORY); - for (; networks != nullptr && networks->Next(scanResponse);) - { - if ((scanResponseArrayLength == kMaxNetworksInScanResponse) && - (scanResponseArray[scanResponseArrayLength - 1].rssi > scanResponse.rssi)) - { - continue; - } - - bool isDuplicated = false; - - for (size_t i = 0; i < scanResponseArrayLength; i++) - { - if ((scanResponseArray[i].panId == scanResponse.panId) && - (scanResponseArray[i].extendedPanId == scanResponse.extendedPanId)) - { - if (scanResponseArray[i].rssi < scanResponse.rssi) - { - scanResponseArray[i] = scanResponseArray[--scanResponseArrayLength]; - } - else - { - isDuplicated = true; - } - break; - } - } + ThreadScanResponseToTLV responseBuilder(status, debugText, networks); + commandHandle->AddResponse(mPath, Commands::ScanNetworksResponse::Id, responseBuilder); - if (isDuplicated) - { - continue; - } - - if (scanResponseArrayLength < kMaxNetworksInScanResponse) - { - scanResponseArrayLength++; - } - scanResponseArray[scanResponseArrayLength - 1] = scanResponse; - Sorting::InsertionSort( - scanResponseArray.Get(), scanResponseArrayLength, - [](const ThreadScanResponse & a, const ThreadScanResponse & b) -> bool { return a.rssi > b.rssi; }); - } - - for (size_t i = 0; i < scanResponseArrayLength; i++) - { - Structs::ThreadInterfaceScanResultStruct::Type result; - Encoding::BigEndian::Put64(extendedAddressBuffer, scanResponseArray[i].extendedAddress); - result.panId = scanResponseArray[i].panId; - result.extendedPanId = scanResponseArray[i].extendedPanId; - result.networkName = CharSpan(scanResponseArray[i].networkName, scanResponseArray[i].networkNameLen); - result.channel = scanResponseArray[i].channel; - result.version = scanResponseArray[i].version; - result.extendedAddress = ByteSpan(extendedAddressBuffer); - result.rssi = scanResponseArray[i].rssi; - result.lqi = scanResponseArray[i].lqi; - - SuccessOrExit(err = DataModel::Encode(*writer, TLV::AnonymousTag(), result)); - } - } - - SuccessOrExit(err = writer->EndContainer(listContainerType)); - SuccessOrExit(err = commandHandle->FinishCommand()); - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Failed to encode response: %" CHIP_ERROR_FORMAT, err.Format()); - } if (status == Status::kSuccess) { CommitSavedBreadcrumb(); } - networks->Release(); #endif } void Instance::OnFinished(Status status, CharSpan debugText, WiFiScanResponseIterator * networks) { + DEFER_AUTO_RELEASE(networks); + #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP - CHIP_ERROR err = CHIP_NO_ERROR; auto commandHandleRef = std::move(mAsyncCommandHandle); auto commandHandle = commandHandleRef.Get(); if (commandHandle == nullptr) @@ -1122,63 +1252,13 @@ void Instance::OnFinished(Status status, CharSpan debugText, WiFiScanResponseIte SetLastNetworkingStatusValue(MakeNullable(status)); - TLV::TLVWriter * writer; - TLV::TLVType listContainerType; - WiFiScanResponse scanResponse; - size_t networksEncoded = 0; - - const CommandHandler::InvokeResponseParameters prepareParams(mPath); - SuccessOrExit( - err = commandHandle->PrepareInvokeResponseCommand( - ConcreteCommandPath(mPath.mEndpointId, NetworkCommissioning::Id, Commands::ScanNetworksResponse::Id), prepareParams)); - VerifyOrExit((writer = commandHandle->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + WifiScanResponseToTLV responseBuilder(status, debugText, networks); + commandHandle->AddResponse(mPath, Commands::ScanNetworksResponse::Id, responseBuilder); - SuccessOrExit(err = writer->Put(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kNetworkingStatus), status)); - if (debugText.size() != 0) - { - SuccessOrExit( - err = DataModel::Encode(*writer, TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kDebugText), debugText)); - } - SuccessOrExit(err = writer->StartContainer(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kWiFiScanResults), - TLV::TLVType::kTLVType_Array, listContainerType)); - - // Only encode results on success, to avoid stale contents on partial failure. - if ((status == Status::kSuccess) && (networks != nullptr)) - { - while (networks->Next(scanResponse)) - { - Structs::WiFiInterfaceScanResultStruct::Type result; - result.security = scanResponse.security; - result.ssid = ByteSpan(scanResponse.ssid, scanResponse.ssidLen); - result.bssid = ByteSpan(scanResponse.bssid, sizeof(scanResponse.bssid)); - result.channel = scanResponse.channel; - result.wiFiBand = scanResponse.wiFiBand; - result.rssi = scanResponse.rssi; - SuccessOrExit(err = DataModel::Encode(*writer, TLV::AnonymousTag(), result)); - - ++networksEncoded; - if (networksEncoded >= kMaxNetworksInScanResponse) - { - break; - } - } - } - - SuccessOrExit(err = writer->EndContainer(listContainerType)); - SuccessOrExit(err = commandHandle->FinishCommand()); -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Failed to encode response: %" CHIP_ERROR_FORMAT, err.Format()); - } if (status == Status::kSuccess) { CommitSavedBreadcrumb(); } - if (networks != nullptr) - { - networks->Release(); - } #endif } From 294dc18fe85182a15ab4d8be2d52f25d756da522 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Sun, 2 Jun 2024 09:42:06 -0400 Subject: [PATCH 023/162] Add some braces that went missing while applying review suggestions. (#33699) --- src/darwin/Framework/CHIP/MTRDevice.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 2e2acd3069aa6e..4014bd5f6924bf 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -3097,8 +3097,9 @@ - (void)_pruneClustersIn:(MTRDeviceDataValueDictionary)previousServerListValue NSMutableSet * clusterPathsToRemove = [[NSMutableSet alloc] init]; for (MTRClusterPath * path in _persistedClusters) { - if ([path.endpoint isEqualToNumber:endpointID] && [toBeRemovedClusters containsObject:path.cluster]) + if ([path.endpoint isEqualToNumber:endpointID] && [toBeRemovedClusters containsObject:path.cluster]) { [clusterPathsToRemove addObject:path]; + } } [self _removeClusters:clusterPathsToRemove doRemoveFromDataStore:YES]; } From 868272e29e3896e576df70f612bb53a7ff73636b Mon Sep 17 00:00:00 2001 From: C Freeman Date: Mon, 3 Jun 2024 05:56:20 -0400 Subject: [PATCH 024/162] TC-IDM-10.2: checks for non-spec clusters (#33695) * TC-IDM-10.2: checks for non-spec clusters There are a number of clusters that appear in the spec adoc but are ifdef'd. These were not caught by the original provisional cluster checks. The following do not appear in the codegen and will therefore be caught in the IDM-10.1 test if they appear in cert (check that all clusters in the standard range have known IDs). These are therefore not included in the specific check. 0x0094 Water Heater Management 0x0095 Energy Price 0x009A Energy Calendar 0x009E Water Heater Mode 0x0450 Network Identity Management The following DOES appear in the 1.3-SVE codegen and are therefore checked explicitly: 0x0096 Demand Response and Load Control The following appears in the master codegen, but is not included in the 1.3-sve branch and will therefore fail the 10.1 test: 0x0451 WiFi Network Management There are also some completely non-spec clusters that appear in the codegen, but not in the spec at all. They appear to be zigbee only clusters. These are added to the new checks: 0x0007 On/off Switch Configuration 0x000F Binary Input (Basic) 0x0103 Barrier Control 0x0B04 Electrical Measurement In all cases, inclusion of these clusters on a device at cert SHOULD cause a failure in the PICS checker test as there is no way to specify these clusters in the PICS, but a definite check here is also beneficial. * Restyled by autopep8 * Restyled by isort * missed removing wifi in the test itself --------- Co-authored-by: Restyled.io --- .../python/chip/clusters/__init__.py | 37 ++++++++++--------- src/python_testing/TC_DeviceConformance.py | 14 +++++-- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/controller/python/chip/clusters/__init__.py b/src/controller/python/chip/clusters/__init__.py index 44d9910c670098..76a37b84abbc87 100644 --- a/src/controller/python/chip/clusters/__init__.py +++ b/src/controller/python/chip/clusters/__init__.py @@ -27,23 +27,24 @@ ApplicationBasic, ApplicationLauncher, AudioOutput, BallastConfiguration, BarrierControl, BasicInformation, BinaryInputBasic, Binding, BooleanState, BooleanStateConfiguration, BridgedDeviceBasicInformation, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, Channel, ColorControl, - ContentControl, ContentLauncher, Descriptor, DeviceEnergyManagement, DeviceEnergyManagementMode, - DiagnosticLogs, DishwasherAlarm, DishwasherMode, DoorLock, ElectricalEnergyMeasurement, ElectricalMeasurement, - ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, - FanControl, FaultInjection, FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, - GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, - Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, - LevelControl, LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, - MicrowaveOvenMode, ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, - OccupancySensing, OnOff, OnOffSwitchConfiguration, OperationalCredentials, OperationalState, - OtaSoftwareUpdateProvider, OtaSoftwareUpdateRequestor, OvenCavityOperationalState, OvenMode, - OzoneConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm10ConcentrationMeasurement, - Pm25ConcentrationMeasurement, PowerSource, PowerSourceConfiguration, PowerTopology, PressureMeasurement, - ProxyConfiguration, ProxyDiscovery, ProxyValid, PulseWidthModulation, PumpConfigurationAndControl, - RadonConcentrationMeasurement, RefrigeratorAlarm, RefrigeratorAndTemperatureControlledCabinetMode, - RelativeHumidityMeasurement, RvcCleanMode, RvcOperationalState, RvcRunMode, ScenesManagement, SmokeCoAlarm, - SoftwareDiagnostics, Switch, TargetNavigator, TemperatureControl, TemperatureMeasurement, Thermostat, - ThermostatUserInterfaceConfiguration, ThreadNetworkDiagnostics, TimeFormatLocalization, TimeSynchronization, + ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, DeviceEnergyManagement, + DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, DoorLock, + ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, + EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, + FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, + HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, + LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, + MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, ModeSelect, NetworkCommissioning, + NitrogenDioxideConcentrationMeasurement, OccupancySensing, OnOff, OnOffSwitchConfiguration, + OperationalCredentials, OperationalState, OtaSoftwareUpdateProvider, OtaSoftwareUpdateRequestor, + OvenCavityOperationalState, OvenMode, OzoneConcentrationMeasurement, Pm1ConcentrationMeasurement, + Pm10ConcentrationMeasurement, Pm25ConcentrationMeasurement, PowerSource, PowerSourceConfiguration, + PowerTopology, PressureMeasurement, ProxyConfiguration, ProxyDiscovery, ProxyValid, PulseWidthModulation, + PumpConfigurationAndControl, RadonConcentrationMeasurement, RefrigeratorAlarm, + RefrigeratorAndTemperatureControlledCabinetMode, RelativeHumidityMeasurement, RvcCleanMode, + RvcOperationalState, RvcRunMode, ScenesManagement, SmokeCoAlarm, SoftwareDiagnostics, Switch, TargetNavigator, + TemperatureControl, TemperatureMeasurement, Thermostat, ThermostatUserInterfaceConfiguration, + ThreadNetworkDiagnostics, TimeFormatLocalization, TimeSynchronization, TotalVolatileOrganicCompoundsConcentrationMeasurement, UnitLocalization, UnitTesting, UserLabel, ValveConfigurationAndControl, WakeOnLan, WiFiNetworkDiagnostics, WindowCovering) @@ -51,7 +52,7 @@ ApplicationBasic, ApplicationLauncher, AudioOutput, BallastConfiguration, BarrierControl, BasicInformation, BinaryInputBasic, Binding, BooleanState, BooleanStateConfiguration, BridgedDeviceBasicInformation, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, Channel, - ColorControl, ContentControl, ContentLauncher, Descriptor, DeviceEnergyManagementMode, DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, + ColorControl, ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, DeviceEnergyManagementMode, DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, DoorLock, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, diff --git a/src/python_testing/TC_DeviceConformance.py b/src/python_testing/TC_DeviceConformance.py index 1db208fa39f40b..42fddd7e31ee4b 100644 --- a/src/python_testing/TC_DeviceConformance.py +++ b/src/python_testing/TC_DeviceConformance.py @@ -80,9 +80,20 @@ def record_warning(location, problem): provisional_cluster_ids = [Clusters.ContentControl.id, Clusters.ScenesManagement.id, Clusters.BallastConfiguration.id, Clusters.EnergyPreference.id, Clusters.DeviceEnergyManagement.id, Clusters.DeviceEnergyManagementMode.id, Clusters.PulseWidthModulation.id, Clusters.ProxyConfiguration.id, Clusters.ProxyDiscovery.id, Clusters.ProxyValid.id] + # TODO: Remove this once the latest 1.3 lands with the clusters removed from the DM XML and change the warning below about missing DM XMLs into a proper error + # These are clusters that weren't part of the 1.3 spec that landed in the SDK before the branch cut + provisional_cluster_ids.extend([Clusters.DemandResponseLoadControl.id]) + # These clusters are zigbee only. I don't even know why they're part of the codegen, but we should get rid of them. + provisional_cluster_ids.extend([Clusters.BarrierControl.id, Clusters.OnOffSwitchConfiguration.id, + Clusters.BinaryInputBasic.id, Clusters.ElectricalMeasurement.id]) for endpoint_id, endpoint in self.endpoints_tlv.items(): for cluster_id, cluster in endpoint.items(): cluster_location = ClusterPathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id) + + if not allow_provisional and cluster_id in provisional_cluster_ids: + record_error(location=cluster_location, problem='Provisional cluster found on device') + continue + if cluster_id not in self.xml_clusters.keys(): if (cluster_id & 0xFFFF_0000) != 0: # manufacturer cluster @@ -92,9 +103,6 @@ def record_warning(location, problem): problem='Standard cluster found on device, but is not present in spec data') continue - if not allow_provisional and cluster_id in provisional_cluster_ids: - record_error(location=cluster_location, problem='Provisional cluster found on device') - feature_map = cluster[GlobalAttributeIds.FEATURE_MAP_ID] attribute_list = cluster[GlobalAttributeIds.ATTRIBUTE_LIST_ID] all_command_list = cluster[GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID] + \ From 046fd513a0376436f5f7d601753bd1bb875e8d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:57:49 +0200 Subject: [PATCH 025/162] [nrfconnect] Raise error if factory data generation fails (#33703) The factory data generator script would just return without an error code if any of the prerequisites is not met. Signed-off-by: Damian Krolik --- .../nrfconnect/generate_nrfconnect_chip_factory_data.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py b/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py index ab70c69d7f9d53..c2fea381fefc9a 100644 --- a/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py +++ b/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py @@ -433,7 +433,7 @@ def _generate_onboarding_data(self): def main(): - parser = argparse.ArgumentParser(description="NrfConnect Factory Data NVS generator tool") + parser = argparse.ArgumentParser(description="nRF Connect Factory Data generator tool") def allow_any_int(i): return int(i, 0) def base64_str(s): return base64.b64decode(s) @@ -564,20 +564,20 @@ def base64_str(s): return base64.b64decode(s) if (exists(args.output + ".json") and not args.overwrite): log.error(("Output file: {} already exist, to create a new one add argument '--overwrite'. " "By default overwriting is disabled").format(args.output+".json")) - return + sys.exit(1) if args.schema and no_jsonschema_module: log.error(("Requested verification of the JSON file using jsonschema, but the module is not installed. \n" "Install only the module by invoking: pip3 install jsonschema \n" "Alternatively, install it with all dependencies for Matter by invoking: pip3 install " "-r ./scripts/setup/requirements.nrfconnect.txt from the Matter root directory.")) - return + sys.exit(1) if args.generate_onboarding and no_onboarding_modules: log.error(("Requested generation of onboarding codes, but the some modules are not installed. \n" "Install all dependencies for Matter by invoking: pip3 install " "-r ./scripts/setup/requirements.nrfconnect.txt from the Matter root directory.")) - return + sys.exit(1) generator = FactoryDataGenerator(args) generator.generate_json() From 32c568fa21ff9c5f9e8edaa68928492021079f18 Mon Sep 17 00:00:00 2001 From: Suhas Shankar <118879678+su-shanka@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:49:45 +0530 Subject: [PATCH 026/162] Operational Discovery with Continuous Query Support for Linux (#33402) * Add operational discovery and continuous query support in linux platform mdns * Restyled by whitespace * Restyled by clang-format * Updated as per feedback comments * Updated as per review feedback * Restyled by whitespace * Restyled by clang-format * Updated as per review feedback * Updated as per new review feedback * Restyled by whitespace * Restyled by clang-format * Updated as per new review feedback and fixed builds * Updated as per suggestions * Fix comment spelling. --------- Co-authored-by: Restyled.io Co-authored-by: Boris Zbarsky --- src/lib/dnssd/Discovery_ImplPlatform.cpp | 71 +++++++++++++++-- src/lib/dnssd/Discovery_ImplPlatform.h | 1 + src/lib/dnssd/ServiceNaming.cpp | 4 + src/lib/dnssd/platform/Dnssd.h | 3 +- src/lib/shell/commands/Dns.cpp | 9 +++ src/platform/Darwin/DnssdContexts.cpp | 11 ++- src/platform/Linux/DnssdImpl.cpp | 98 ++++++++++++++---------- src/platform/Linux/DnssdImpl.h | 6 +- 8 files changed, 153 insertions(+), 50 deletions(-) diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index f4a524f2c81f31..a1b28b726614f9 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -50,13 +50,33 @@ static void HandleNodeResolve(void * context, DnssdService * result, const Span< } DiscoveredNodeData nodeData; - result->ToDiscoveredNodeData(addresses, nodeData); + + result->ToDiscoveredCommissionNodeData(addresses, nodeData); nodeData.Get().LogDetail(); discoveryContext->OnNodeDiscovered(nodeData); discoveryContext->Release(); } +static void HandleNodeOperationalBrowse(void * context, DnssdService * result, CHIP_ERROR error) +{ + DiscoveryContext * discoveryContext = static_cast(context); + + if (error != CHIP_NO_ERROR) + { + discoveryContext->Release(); + return; + } + + DiscoveredNodeData nodeData; + + result->ToDiscoveredOperationalNodeBrowseData(nodeData); + + nodeData.Get().LogDetail(); + discoveryContext->OnNodeDiscovered(nodeData); + discoveryContext->Release(); +} + static void HandleNodeBrowse(void * context, DnssdService * services, size_t servicesSize, bool finalBrowse, CHIP_ERROR error) { DiscoveryContext * discoveryContext = static_cast(context); @@ -75,8 +95,16 @@ static void HandleNodeBrowse(void * context, DnssdService * services, size_t ser auto & ipAddress = services[i].mAddress; - // Check if SRV, TXT and AAAA records were received in DNS responses - if (strlen(services[i].mHostName) == 0 || services[i].mTextEntrySize == 0 || !ipAddress.has_value()) + // mType(service name) exactly matches with operational service name + bool isOperationalBrowse = strcmp(services[i].mType, kOperationalServiceName) == 0; + + // For operational browse result we currently don't need IP address hence skip resolution and handle differently. + if (isOperationalBrowse) + { + HandleNodeOperationalBrowse(context, &services[i], error); + } + // check whether SRV, TXT and AAAA records were received in DNS responses + else if (strlen(services[i].mHostName) == 0 || services[i].mTextEntrySize == 0 || !ipAddress.has_value()) { ChipDnssdResolve(&services[i], services[i].mInterface, HandleNodeResolve, context); } @@ -340,7 +368,15 @@ void DiscoveryImplPlatform::HandleNodeIdResolve(void * context, DnssdService * r impl->mOperationalDelegate->OnOperationalNodeResolved(nodeData); } -void DnssdService::ToDiscoveredNodeData(const Span & addresses, DiscoveredNodeData & nodeData) +void DnssdService::ToDiscoveredOperationalNodeBrowseData(DiscoveredNodeData & nodeData) +{ + nodeData.Set(); + + ExtractIdFromInstanceName(mName, &nodeData.Get().peerId); + nodeData.Get().hasZeroTTL = (mTtlSeconds == 0); +} + +void DnssdService::ToDiscoveredCommissionNodeData(const Span & addresses, DiscoveredNodeData & nodeData) { nodeData.Set(); auto & discoveredData = nodeData.Get(); @@ -746,6 +782,31 @@ CHIP_ERROR DiscoveryImplPlatform::DiscoverCommissioners(DiscoveryFilter filter, return error; } +CHIP_ERROR DiscoveryImplPlatform::DiscoverOperational(DiscoveryFilter filter, DiscoveryContext & context) +{ + ReturnErrorOnFailure(InitImpl()); + StopDiscovery(context); + + char serviceName[kMaxOperationalServiceNameSize]; + ReturnErrorOnFailure(MakeServiceTypeName(serviceName, sizeof(serviceName), filter, DiscoveryType::kOperational)); + + intptr_t browseIdentifier; + // Increase the reference count of the context to keep it alive until HandleNodeBrowse is called back. + CHIP_ERROR error = ChipDnssdBrowse(serviceName, DnssdServiceProtocol::kDnssdProtocolTcp, Inet::IPAddressType::kAny, + Inet::InterfaceId::Null(), HandleNodeBrowse, context.Retain(), &browseIdentifier); + + if (error == CHIP_NO_ERROR) + { + context.SetBrowseIdentifier(browseIdentifier); + } + else + { + context.Release(); + } + + return error; +} + CHIP_ERROR DiscoveryImplPlatform::StartDiscovery(DiscoveryType type, DiscoveryFilter filter, DiscoveryContext & context) { switch (type) @@ -755,7 +816,7 @@ CHIP_ERROR DiscoveryImplPlatform::StartDiscovery(DiscoveryType type, DiscoveryFi case DiscoveryType::kCommissionerNode: return DiscoverCommissioners(filter, context); case DiscoveryType::kOperational: - return CHIP_ERROR_NOT_IMPLEMENTED; + return DiscoverOperational(filter, context); default: return CHIP_ERROR_INVALID_ARGUMENT; } diff --git a/src/lib/dnssd/Discovery_ImplPlatform.h b/src/lib/dnssd/Discovery_ImplPlatform.h index 34fedf831b5ecf..d51d5e758c0268 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.h +++ b/src/lib/dnssd/Discovery_ImplPlatform.h @@ -55,6 +55,7 @@ class DiscoveryImplPlatform : public ServiceAdvertiser, public Resolver void NodeIdResolutionNoLongerNeeded(const PeerId & peerId) override; CHIP_ERROR DiscoverCommissionableNodes(DiscoveryFilter filter, DiscoveryContext & context); CHIP_ERROR DiscoverCommissioners(DiscoveryFilter filter, DiscoveryContext & context); + CHIP_ERROR DiscoverOperational(DiscoveryFilter filter, DiscoveryContext & context); CHIP_ERROR StartDiscovery(DiscoveryType type, DiscoveryFilter filter, DiscoveryContext & context) override; CHIP_ERROR StopDiscovery(DiscoveryContext & context) override; CHIP_ERROR ReconfirmRecord(const char * hostname, Inet::IPAddress address, Inet::InterfaceId interfaceId) override; diff --git a/src/lib/dnssd/ServiceNaming.cpp b/src/lib/dnssd/ServiceNaming.cpp index 25bdfbf2cbf341..8ec86a1bfb9b2b 100644 --- a/src/lib/dnssd/ServiceNaming.cpp +++ b/src/lib/dnssd/ServiceNaming.cpp @@ -162,6 +162,10 @@ CHIP_ERROR MakeServiceTypeName(char * buffer, size_t bufferLen, DiscoveryFilter { requiredSize = snprintf(buffer, bufferLen, kCommissionerServiceName); } + else if (type == DiscoveryType::kOperational) + { + requiredSize = snprintf(buffer, bufferLen, kOperationalServiceName); + } else { return CHIP_ERROR_NOT_IMPLEMENTED; diff --git a/src/lib/dnssd/platform/Dnssd.h b/src/lib/dnssd/platform/Dnssd.h index 02fb851a12d861..e1e44053640617 100644 --- a/src/lib/dnssd/platform/Dnssd.h +++ b/src/lib/dnssd/platform/Dnssd.h @@ -81,7 +81,8 @@ struct DnssdService // Time to live in seconds. Per rfc6762 section 10, because we have a hostname, our default TTL is 120 seconds uint32_t mTtlSeconds = 120; - void ToDiscoveredNodeData(const Span & addresses, DiscoveredNodeData & nodeData); + void ToDiscoveredCommissionNodeData(const Span & addresses, DiscoveredNodeData & nodeData); + void ToDiscoveredOperationalNodeBrowseData(DiscoveredNodeData & nodeData); }; /** diff --git a/src/lib/shell/commands/Dns.cpp b/src/lib/shell/commands/Dns.cpp index 65b3f7bc9cc537..50be591ddfeaee 100644 --- a/src/lib/shell/commands/Dns.cpp +++ b/src/lib/shell/commands/Dns.cpp @@ -261,6 +261,13 @@ CHIP_ERROR BrowseOperationalHandler(int argc, char ** argv) return sResolverProxy.DiscoverOperationalNodes(filter); } +CHIP_ERROR BrowseStopHandler(int argc, char ** argv) +{ + streamer_printf(streamer_get(), "Stopping browse...\r\n"); + + return sResolverProxy.StopDiscovery(); +} + } // namespace void RegisterDnsCommands() @@ -270,6 +277,8 @@ void RegisterDnsCommands() "Browse Matter commissionables. Usage: dns browse commissionable [subtype]" }, { &BrowseCommissionerHandler, "commissioner", "Browse Matter commissioners. Usage: dns browse commissioner [subtype]" }, { &BrowseOperationalHandler, "operational", "Browse Matter operational nodes. Usage: dns browse operational" }, + { &BrowseStopHandler, "stop", "Stop ongoing browse. Usage: dns browse stop" }, + }; static constexpr Command subCommands[] = { diff --git a/src/platform/Darwin/DnssdContexts.cpp b/src/platform/Darwin/DnssdContexts.cpp index 7dc5956845414f..fc68a5d779616b 100644 --- a/src/platform/Darwin/DnssdContexts.cpp +++ b/src/platform/Darwin/DnssdContexts.cpp @@ -607,7 +607,16 @@ bool ResolveContext::TryReportingResultsForInterfaceIndex(uint32_t interfaceInde { auto delegate = static_cast(context); DiscoveredNodeData nodeData; - service.ToDiscoveredNodeData(addresses, nodeData); + + // Check whether mType (service name) exactly matches with operational service name + if (strcmp(service.mType, kOperationalServiceName) == 0) + { + service.ToDiscoveredOperationalNodeBrowseData(nodeData); + } + else + { + service.ToDiscoveredCommissionNodeData(addresses, nodeData); + } delegate->OnNodeDiscovered(nodeData); } else diff --git a/src/platform/Linux/DnssdImpl.cpp b/src/platform/Linux/DnssdImpl.cpp index 800064f52157de..40b7c89812d251 100644 --- a/src/platform/Linux/DnssdImpl.cpp +++ b/src/platform/Linux/DnssdImpl.cpp @@ -611,9 +611,9 @@ CHIP_ERROR MdnsAvahi::Browse(const char * type, DnssdServiceProtocol protocol, c { avahiInterface = AVAHI_IF_UNSPEC; } - browseContext->mInterface = avahiInterface; - browseContext->mProtocol = GetFullType(type, protocol); - browseContext->mBrowseRetries = 0; + browseContext->mInterface = avahiInterface; + browseContext->mProtocol = GetFullType(type, protocol); + browseContext->mReceivedAllCached = false; browseContext->mStopped.store(false); browser = avahi_service_browser_new(mClient, avahiInterface, AVAHI_PROTO_UNSPEC, browseContext->mProtocol.c_str(), nullptr, @@ -686,23 +686,22 @@ void CopyTypeWithoutProtocol(char (&dest)[N], const char * typeAndProtocol) } } -void MdnsAvahi::BrowseRetryCallback(chip::System::Layer * aLayer, void * appState) +void MdnsAvahi::InvokeDelegateOrCleanUp(BrowseContext * context, AvahiServiceBrowser * browser) { - BrowseContext * context = static_cast(appState); - // Don't schedule anything new if we've stopped. - if (context->mStopped.load()) + // If we were already asked to stop, no need to send a callback - no one is listening. + if (!context->mStopped.load()) { - chip::Platform::Delete(context); - return; + // since this is continuous browse, finalBrowse will always be false. + context->mCallback(context->mContext, context->mServices.data(), context->mServices.size(), false, CHIP_NO_ERROR); + + // Clearing records/services already passed to application through delegate. Keeping it may cause + // duplicates in next query / retry attempt as currently found will also come again from cache. + context->mServices.clear(); } - AvahiServiceBrowser * newBrowser = - avahi_service_browser_new(context->mInstance->mClient, context->mInterface, AVAHI_PROTO_UNSPEC, context->mProtocol.c_str(), - nullptr, static_cast(0), HandleBrowse, context); - if (newBrowser == nullptr) + else { - // If we failed to create the browser, this browse context is effectively done. We need to call the final callback and - // delete the context. - context->mCallback(context->mContext, context->mServices.data(), context->mServices.size(), true, CHIP_NO_ERROR); + // browse is stopped, so free browse handle and context + avahi_service_browser_free(browser); chip::Platform::Delete(context); } } @@ -722,6 +721,13 @@ void MdnsAvahi::HandleBrowse(AvahiServiceBrowser * browser, AvahiIfIndex interfa break; case AVAHI_BROWSER_NEW: ChipLogProgress(DeviceLayer, "Avahi browse: cache new"); + if (context->mStopped.load()) + { + // browse is stopped, so free browse handle and context + avahi_service_browser_free(browser); + chip::Platform::Delete(context); + break; + } if (strcmp("local", domain) == 0) { DnssdService service = {}; @@ -738,41 +744,53 @@ void MdnsAvahi::HandleBrowse(AvahiServiceBrowser * browser, AvahiIfIndex interfa } service.mType[kDnssdTypeMaxSize] = 0; context->mServices.push_back(service); + if (context->mReceivedAllCached) + { + InvokeDelegateOrCleanUp(context, browser); + } } break; case AVAHI_BROWSER_ALL_FOR_NOW: { ChipLogProgress(DeviceLayer, "Avahi browse: all for now"); - bool needRetries = context->mBrowseRetries++ < kMaxBrowseRetries && !context->mStopped.load(); - // If we were already asked to stop, no need to send a callback - no one is listening. - if (!context->mStopped.load()) - { - context->mCallback(context->mContext, context->mServices.data(), context->mServices.size(), !needRetries, - CHIP_NO_ERROR); - } - avahi_service_browser_free(browser); - if (needRetries) - { - context->mNextRetryDelay *= 2; - // Hand the ownership of the context over to the timer. It will either schedule a new browse on the context, - // triggering this function, or it will delete and not reschedule (if stopped). - DeviceLayer::SystemLayer().StartTimer(context->mNextRetryDelay / 2, BrowseRetryCallback, context); - } - else - { - // We didn't schedule a timer, so we're responsible for deleting the context - chip::Platform::Delete(context); - } + context->mReceivedAllCached = true; + + InvokeDelegateOrCleanUp(context, browser); break; } case AVAHI_BROWSER_REMOVE: ChipLogProgress(DeviceLayer, "Avahi browse: remove"); if (strcmp("local", domain) == 0) { - context->mServices.erase( - std::remove_if(context->mServices.begin(), context->mServices.end(), [name, type](const DnssdService & service) { - return strcmp(name, service.mName) == 0 && type == GetFullType(service.mType, service.mProtocol); - })); + // don't attempt to erase if vector has been cleared + if (context->mServices.size()) + { + context->mServices.erase(std::remove_if( + context->mServices.begin(), context->mServices.end(), [name, type](const DnssdService & service) { + return strcmp(name, service.mName) == 0 && type == GetFullType(service.mType, service.mProtocol); + })); + } + + if (context->mReceivedAllCached) + { + DnssdService service = {}; + + Platform::CopyString(service.mName, name); + CopyTypeWithoutProtocol(service.mType, type); + service.mProtocol = GetProtocolInType(type); + service.mAddressType = context->mAddressType; + service.mTransportType = ToAddressType(protocol); + service.mInterface = Inet::InterfaceId::Null(); + if (interface != AVAHI_IF_UNSPEC) + { + service.mInterface = static_cast(interface); + } + service.mTtlSeconds = 0; + + context->mServices.push_back(service); + InvokeDelegateOrCleanUp(context, browser); + } } + break; case AVAHI_BROWSER_CACHE_EXHAUSTED: ChipLogProgress(DeviceLayer, "Avahi browse: cache exhausted"); diff --git a/src/platform/Linux/DnssdImpl.h b/src/platform/Linux/DnssdImpl.h index c66a8c23f700b6..f1de8dbf0b1491 100644 --- a/src/platform/Linux/DnssdImpl.h +++ b/src/platform/Linux/DnssdImpl.h @@ -131,11 +131,11 @@ class MdnsAvahi void * mContext; Inet::IPAddressType mAddressType; std::vector mServices; - size_t mBrowseRetries; + bool mReceivedAllCached; AvahiIfIndex mInterface; std::string mProtocol; - chip::System::Clock::Timeout mNextRetryDelay = chip::System::Clock::Seconds16(1); std::atomic_bool mStopped{ false }; + AvahiServiceBrowser * mBrowser; }; struct ResolveContext @@ -181,7 +181,7 @@ class MdnsAvahi static void HandleBrowse(AvahiServiceBrowser * broswer, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char * name, const char * type, const char * domain, AvahiLookupResultFlags flags, void * userdata); - static void BrowseRetryCallback(chip::System::Layer * aLayer, void * appState); + static void InvokeDelegateOrCleanUp(BrowseContext * context, AvahiServiceBrowser * browser); static void HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char * name, const char * type, const char * domain, const char * host_name, const AvahiAddress * address, uint16_t port, AvahiStringList * txt, From 10d7d9af4588f5519eacd6a68376093145b4322a Mon Sep 17 00:00:00 2001 From: Kevin Schoedel Date: Mon, 3 Jun 2024 09:30:05 -0400 Subject: [PATCH 027/162] Streamline bloat reports, part 1 (#33642) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Streamline bloat reports, part 1 - Remove ‘Increases’ and ‘Decreases’ tables from the GitHub comment reports, leaving only the full table and the large-increase highlights. - Add region groups to platform configurations. Reports will switch to summary flash and RAM totals rather than reporting each section. Some platform report configurations did not already indicate which section(s) belong in which reportable region. - Add region sizes to size report artifacts. - Record area type (section, region, read/write) in the size database. A followup will remove sizes other than regions from the GitHub comment reports. * Restyled by autopep8 --------- Co-authored-by: Restyled.io --- scripts/tools/memory/gh_report.py | 19 ---------------- scripts/tools/memory/gh_sizes.py | 16 +++++++++++++ scripts/tools/memory/memdf/sizedb.py | 22 +++++++++++------- scripts/tools/memory/platform/bl602.cfg | 20 ++++++++++------ scripts/tools/memory/platform/mbed.cfg | 22 ++++++++++-------- scripts/tools/memory/platform/openiotsdk.cfg | 13 +++++++++++ scripts/tools/memory/platform/p6.cfg | 22 ++++++++++-------- scripts/tools/memory/platform/telink.cfg | 24 ++++++++++++-------- 8 files changed, 97 insertions(+), 61 deletions(-) diff --git a/scripts/tools/memory/gh_report.py b/scripts/tools/memory/gh_report.py index ba30cdec4b12b9..a9315f7c628cbd 100755 --- a/scripts/tools/memory/gh_report.py +++ b/scripts/tools/memory/gh_report.py @@ -316,9 +316,6 @@ def format(config: Config, df: pd.DataFrame): threshold_df = df[df['% change'] > threshold] if threshold_df.empty: threshold_df = None - decrease_df = df[df['change'] < 0] - if decrease_df.empty: - decrease_df = None with io.StringIO() as md: md.write(df.attrs['title']) @@ -329,22 +326,6 @@ def format(config: Config, df: pd.DataFrame): md.write('\n\n') V1Comment.write_df(config, threshold_df, md) - if increase_df is not None: - summary = V1Comment.summary(increase_df) - md.write('
\n') - md.write(f'Increases ({summary})\n') - md.write('\n\n') - V1Comment.write_df(config, increase_df, md) - md.write('
\n\n') - - if decrease_df is not None: - summary = V1Comment.summary(decrease_df) - md.write('
\n') - md.write(f'Decreases ({summary})\n') - md.write('\n\n') - V1Comment.write_df(config, decrease_df, md) - md.write('
\n\n') - summary = V1Comment.summary(df) md.write('
\n') md.write(f'Full report ({summary})\n') diff --git a/scripts/tools/memory/gh_sizes.py b/scripts/tools/memory/gh_sizes.py index 9decc178e15d45..4a32809de8bb40 100755 --- a/scripts/tools/memory/gh_sizes.py +++ b/scripts/tools/memory/gh_sizes.py @@ -183,6 +183,18 @@ def main(argv): if value := config[key]: config.putl(['output', 'metadata', key], value) + # In case there is no platform configuration file or it does not define regions, + # try to find reasonable groups. + if not config.get('region.sections'): + sections = {'FLASH': [], 'RAM': []} + for section in config.get('section.select'): + print('section:', section) + for substring, region in [('text', 'FLASH'), ('rodata', 'FLASH'), ('data', 'RAM'), ('bss', 'RAM')]: + if substring in section: + sections[region].append(section) + break + config.put('region.sections', sections) + collected: DFs = memdf.collect.collect_files(config, [binary]) # Aggregate loaded segments, by writable (RAM) or not (flash). @@ -205,9 +217,13 @@ def main(argv): 'wr']].sort_values(by='section') section_summary.attrs['name'] = "section" + region_summary = memdf.select.groupby(config, collected['section'], 'region') + region_summary.attrs['name'] = "region" + summaries = { 'section': section_summary, 'memory': segment_summary, + 'region': region_summary, } # Write configured (json) report to the output file. diff --git a/scripts/tools/memory/memdf/sizedb.py b/scripts/tools/memory/memdf/sizedb.py index a0704b41cd7abf..c3b221a963babf 100644 --- a/scripts/tools/memory/memdf/sizedb.py +++ b/scripts/tools/memory/memdf/sizedb.py @@ -61,11 +61,12 @@ class SizeDatabase(memdf.util.sqlite.Database): UNIQUE(thing_id, hash, parent, pr, time, artifact) ) """, """ - -- A ‘size’ entry gives the size of a section for a particular build. + -- A ‘size’ entry gives the size of an area for a particular build. CREATE TABLE IF NOT EXISTS size ( build_id INTEGER REFERENCES build(id), - name TEXT NOT NULL, -- Section name - size INTEGER NOT NULL, -- Section size in bytes + kind TEXT NOT NULL, -- Area kind + name TEXT NOT NULL, -- Area name + size INTEGER NOT NULL, -- Size in bytes PRIMARY KEY (build_id, name) ) """ @@ -100,15 +101,20 @@ def add_sizes_from_json(self, s: Union[bytes, str], origin: Dict): r = origin.copy() r.update(json.loads(s)) r['sizes'] = [] - # Add section sizes. - for i in r['frames'].get('section', []): - r['sizes'].append({'name': i['section'], 'size': i['size']}) + # Add section and region sizes. + for frame in ['section', 'region']: + for i in r['frames'].get(frame, []): + r['sizes'].append({ + 'name': i[frame], + 'size': i['size'], + 'kind': frame + }) # Add segment sizes. for i in r['frames'].get('wr', []): r['sizes'].append({ 'name': ('(read only)', '(read/write)')[int(i['wr'])], - 'size': - i['size'] + 'size': i['size'], + 'kind': 'wr' }) self.add_sizes(**r) diff --git a/scripts/tools/memory/platform/bl602.cfg b/scripts/tools/memory/platform/bl602.cfg index 1370bfcf5f777c..4603d6e5176d72 100644 --- a/scripts/tools/memory/platform/bl602.cfg +++ b/scripts/tools/memory/platform/bl602.cfg @@ -30,11 +30,17 @@ # 'end': [], # } # }, - # 'region': { - # # Regions are sets of sections that can be used for aggregate reports. - # 'sections': { - # 'FLASH': [], - # 'RAM': [] - # } - # }, + 'region': { + # Regions are sets of sections that can be used for aggregate reports. + 'sections': { + 'FLASH': [ + '.text', + '.rodata', + ], + 'RAM': [ + '.bss', + '.data', + ], + } + }, } diff --git a/scripts/tools/memory/platform/mbed.cfg b/scripts/tools/memory/platform/mbed.cfg index ca5d43d692eb7f..9c525ee1d469ab 100644 --- a/scripts/tools/memory/platform/mbed.cfg +++ b/scripts/tools/memory/platform/mbed.cfg @@ -30,13 +30,17 @@ # 'end': [], # } # }, -# 'region': { -# # Regions are sets of sections that can be used for aggregate reports. -# 'sections': { -# 'FLASH': [ -# ], -# 'RAM': [ -# ] -# } -# }, + 'region': { + # Regions are sets of sections that can be used for aggregate reports. + 'sections': { + 'FLASH': [ + '.text', + '.rodata', + ], + 'RAM': [ + '.bss', + '.data', + ], + } + }, } diff --git a/scripts/tools/memory/platform/openiotsdk.cfg b/scripts/tools/memory/platform/openiotsdk.cfg index 4717f1278044dd..37426161d667d4 100644 --- a/scripts/tools/memory/platform/openiotsdk.cfg +++ b/scripts/tools/memory/platform/openiotsdk.cfg @@ -20,4 +20,17 @@ # when operating by sections. 'default': ['.text', '.data', '.bss', '.stack', '.heap'], }, + 'region': { + # Regions are sets of sections that can be used for aggregate reports. + 'sections': { + 'FLASH': [ + '.text', + '.rodata', + ], + 'RAM': [ + '.bss', + '.data', + ], + } + }, } diff --git a/scripts/tools/memory/platform/p6.cfg b/scripts/tools/memory/platform/p6.cfg index d1870ee8e1fb79..7b6184d378e4f6 100644 --- a/scripts/tools/memory/platform/p6.cfg +++ b/scripts/tools/memory/platform/p6.cfg @@ -30,13 +30,17 @@ # 'end': [], # } # }, -# 'region': { -# # Regions are sets of sections that can be used for aggregate reports. -# 'sections': { -# 'FLASH': [ -# ], -# 'RAM': [ -# ] -# } -# }, + 'region': { + # Regions are sets of sections that can be used for aggregate reports. + 'sections': { + 'FLASH': [ + '.text', + '.rodata', + ], + 'RAM': [ + '.bss', + '.data', + ], + } + }, } diff --git a/scripts/tools/memory/platform/telink.cfg b/scripts/tools/memory/platform/telink.cfg index 4db7fcd95fc201..ca0d54b77fd4ce 100644 --- a/scripts/tools/memory/platform/telink.cfg +++ b/scripts/tools/memory/platform/telink.cfg @@ -30,13 +30,19 @@ # 'end': [], # } # }, -# 'region': { -# # Regions are sets of sections that can be used for aggregate reports. -# 'sections': { -# 'FLASH': [ -# ], -# 'RAM': [ -# ] -# } -# }, + 'region': { + # Regions are sets of sections that can be used for aggregate reports. + 'sections': { + 'FLASH': [ + 'text', + 'rodata', + ], + 'RAM': [ + 'bss', + 'data', + 'noinit', + 'ram_code', + ], + } + }, } From 00aa1014d39b1f7869e392ea630fb7598c282d07 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 3 Jun 2024 10:03:25 -0400 Subject: [PATCH 028/162] Make BLE UUID string constants lowercase (#33692) * make BLE UUID constants be lowercase, add note about bluez * Restyle --------- Co-authored-by: Andrei Litvin --- src/ble/BleUUID.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/ble/BleUUID.h b/src/ble/BleUUID.h index 6470cfe36e8494..37e2fdc1180f5e 100644 --- a/src/ble/BleUUID.h +++ b/src/ble/BleUUID.h @@ -95,16 +95,22 @@ constexpr std::pair StringToUUID(const char (&str)[N]) }(); // UUID of CHIP BLE service. +// NOTE: lower-case string seems to be required at least by bluez when +// executing g_variant_lookup_value +// +// BlueZ API https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.Device.rst +// describes ServiceData as "Keys are the UUIDs in string format" however no description +// on actual case required inline constexpr char CHIP_BLE_DESC_SHORT_UUID_STR[] = "2902"; -inline constexpr char CHIP_BLE_SERVICE_SHORT_UUID_STR[] = "FFF6"; -inline constexpr char CHIP_BLE_SERVICE_LONG_UUID_STR[] = "0000FFF6-0000-1000-8000-00805F9B34FB"; -inline constexpr char CHIP_BLE_CHAR_1_UUID_STR[] = "18EE2EF5-263D-4559-959F-4F9C429F9D11"; -inline constexpr char CHIP_BLE_CHAR_2_UUID_STR[] = "18EE2EF5-263D-4559-959F-4F9C429F9D12"; -inline constexpr char CHIP_BLE_CHAR_3_UUID_STR[] = "64630238-8772-45F2-B87D-748A83218F04"; -inline constexpr ChipBleUUID CHIP_BLE_SVC_ID = StringToUUIDConstexpr("0000FFF6-0000-1000-8000-00805F9B34FB"); -inline constexpr ChipBleUUID CHIP_BLE_CHAR_1_UUID = StringToUUIDConstexpr("18EE2EF5-263D-4559-959F-4F9C429F9D11"); -inline constexpr ChipBleUUID CHIP_BLE_CHAR_2_UUID = StringToUUIDConstexpr("18EE2EF5-263D-4559-959F-4F9C429F9D12"); -inline constexpr ChipBleUUID CHIP_BLE_CHAR_3_UUID = StringToUUIDConstexpr("64630238-8772-45F2-B87D-748A83218F04"); +inline constexpr char CHIP_BLE_SERVICE_SHORT_UUID_STR[] = "fff6"; +inline constexpr char CHIP_BLE_SERVICE_LONG_UUID_STR[] = "0000fff6-0000-1000-8000-00805f9b34fb"; +inline constexpr char CHIP_BLE_CHAR_1_UUID_STR[] = "18ee2ef5-263d-4559-959f-4f9c429f9d11"; +inline constexpr char CHIP_BLE_CHAR_2_UUID_STR[] = "18ee2ef5-263d-4559-959f-4f9c429f9d12"; +inline constexpr char CHIP_BLE_CHAR_3_UUID_STR[] = "64630238-8772-45f2-b87d-748a83218f04"; +inline constexpr ChipBleUUID CHIP_BLE_SVC_ID = StringToUUIDConstexpr("0000fff6-0000-1000-8000-00805f9b34fb"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_1_UUID = StringToUUIDConstexpr("18ee2ef5-263d-4559-959f-4f9c429f9d11"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_2_UUID = StringToUUIDConstexpr("18ee2ef5-263d-4559-959f-4f9c429f9d12"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_3_UUID = StringToUUIDConstexpr("64630238-8772-45f2-b87d-748a83218f04"); } /* namespace Ble */ } /* namespace chip */ From f49e6840c51d4286375bc95ff2b9c4f29d20cb9b Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Mon, 3 Jun 2024 16:03:34 +0200 Subject: [PATCH 029/162] [Tizen] Fix Matter devices BLE scan after changes in 92f8cd0 (#33708) * Fix typo introduced in 92f8cd0 * Case insensitive comparison for service UUID --- src/platform/Tizen/BLEManagerImpl.cpp | 2 +- src/platform/Tizen/ChipDeviceScanner.cpp | 52 +++++++----------------- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index 944447d2e759df..209c5fb2337356 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -1404,7 +1404,7 @@ void BLEManagerImpl::InitiateScan(BleScanState scanType) } /* Send StartChipScan Request to Scanner Class */ - strcpy(data.service_uuid, Ble::CHIP_BLE_DESC_SHORT_UUID_STR); + strcpy(data.service_uuid, Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR); err = mDeviceScanner->StartChipScan(kNewConnectionScanTimeout, ScanFilterType::kServiceData, data); VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Failed to start BLE scan")); diff --git a/src/platform/Tizen/ChipDeviceScanner.cpp b/src/platform/Tizen/ChipDeviceScanner.cpp index 2b022f537d79b9..5f334535d904fc 100644 --- a/src/platform/Tizen/ChipDeviceScanner.cpp +++ b/src/platform/Tizen/ChipDeviceScanner.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -55,31 +56,16 @@ std::unique_ptr ChipDeviceScanner::Create(ChipDeviceScannerDe return std::make_unique(delegate); } -static void __CleanupServiceData(bt_adapter_le_service_data_s * dataList, size_t count) +static void __PrintLEScanData(const bt_adapter_le_service_data_s & data) { - VerifyOrReturn(dataList != nullptr); - VerifyOrReturn(count != 0); - - for (size_t i = 0; i < count; i++) - { - g_free(dataList[i].service_uuid); - g_free(dataList[i].service_data); - } - g_free(dataList); -} - -static void __PrintLEScanData(bt_adapter_le_service_data_s * dataList, size_t idx) -{ - VerifyOrReturn(dataList != nullptr); - // Print Service UUID in the Service Data ChipLogDetail(DeviceLayer, "======Service UUID========"); - ChipLogDetail(DeviceLayer, "Service UUID::[%s]", dataList[idx].service_uuid); + ChipLogDetail(DeviceLayer, "Service UUID::[%s]", data.service_uuid); // Print Service Data ChipLogDetail(DeviceLayer, "======Service Data========"); - ChipLogDetail(DeviceLayer, "Service Data Length::[%d]", dataList[idx].service_data_len); - ChipLogByteSpan(DeviceLayer, ByteSpan(reinterpret_cast(dataList[idx].service_data), dataList[idx].service_data_len)); + ChipLogDetail(DeviceLayer, "Service Data Length::[%d]", data.service_data_len); + ChipLogByteSpan(DeviceLayer, ByteSpan(reinterpret_cast(data.service_data), data.service_data_len)); } static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, @@ -91,25 +77,22 @@ static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, bt_adapter_le_service_data_s * dataList = nullptr; bool isChipDevice = false; - ChipLogProgress(DeviceLayer, "Is [%s] ChipThingDevice ?: Check now", info->remote_address); - if (bt_adapter_le_get_scan_result_service_data_list(info, BT_ADAPTER_LE_PACKET_ADVERTISING, &dataList, &count) == BT_ERROR_NONE) { for (int i = 0; i < count; i++) { - if (g_strcmp0(dataList[i].service_uuid, chip::Ble::CHIP_BLE_CHAR_1_UUID_STR) == 0 || - g_strcmp0(dataList[i].service_uuid, chip::Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR) == 0) + if (strcasecmp(dataList[i].service_uuid, chip::Ble::CHIP_BLE_SERVICE_LONG_UUID_STR) == 0 || + strcasecmp(dataList[i].service_uuid, chip::Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR) == 0) { - ChipLogProgress(DeviceLayer, "CHIP Thing Device Found! [Service Data UUID] = %s", dataList[i].service_uuid); - // Print full Service Data - __PrintLEScanData(dataList, i); + __PrintLEScanData(dataList[i]); memcpy(&aDeviceInfo, dataList[i].service_data, dataList[i].service_data_len); isChipDevice = true; break; } } } - __CleanupServiceData(dataList, count); + + bt_adapter_le_free_service_data_list(dataList, count); return isChipDevice; } @@ -120,17 +103,12 @@ void ChipDeviceScanner::LeScanResultCb(int result, bt_adapter_le_device_scan_res auto self = reinterpret_cast(userData); chip::Ble::ChipBLEDeviceIdentificationInfo deviceInfo; - ChipLogProgress(DeviceLayer, "LE Device Reported!! remote addr [%s]", info->remote_address); + ChipLogProgress(DeviceLayer, "LE device reported: %s", info->remote_address); + VerifyOrReturn(__IsChipThingDevice(info, deviceInfo), + ChipLogDetail(Ble, "Device %s does not look like a CHIP device", info->remote_address)); - if (__IsChipThingDevice(info, deviceInfo)) - { - // Looks like a CHIP Thing Device: Service UUID matched - ChipLogProgress(DeviceLayer, "Looks Like Got a CHIP Thing Device: Process further"); - // Report probable CHIP Thing Device to BLEMgrImp class - self->mDelegate->OnChipDeviceScanned(info, deviceInfo); - } - else - ChipLogProgress(DeviceLayer, "Does not Look like a CHIP Device, Skip....."); + // Report probable CHIP device to BLEMgrImp class + self->mDelegate->OnChipDeviceScanned(info, deviceInfo); } gboolean ChipDeviceScanner::TimerExpiredCb(gpointer userData) From d6ede36dc4d5a6735e719ca401a5d4a6babea7cb Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Mon, 3 Jun 2024 18:28:59 +0300 Subject: [PATCH 030/162] [Telink] Update Docker image (Zephyr update) (#33686) --- integrations/docker/images/base/chip-build/version | 2 +- integrations/docker/images/stage-2/chip-build-telink/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index 05ab2a03dbdb4f..3458a0819286da 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -53 : [Tizen] Add libatomic.so to QEMU Docker image +54 : [Telink] Update Docker image (Zephyr update) diff --git a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile index 1333a4bfaaa286..e3b806eec091c0 100644 --- a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile @@ -12,7 +12,7 @@ RUN set -x \ && : # last line # Setup Zephyr -ARG ZEPHYR_REVISION=68deadeb5c20b82d68700e720d4580e8003bf1d8 +ARG ZEPHYR_REVISION=0e8032dfef7e02498f34ba0b5d5d2df71a62adb1 WORKDIR /opt/telink/zephyrproject RUN set -x \ && python3 -m pip install -U --no-cache-dir west \ From 909c69b91db68b0c6b13495413e3f44a8753dbc7 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Mon, 3 Jun 2024 17:36:18 +0200 Subject: [PATCH 031/162] Do not generate exec link map files by default (#33635) * Do not generate exec link map files by default * Remove toolchain override * Update default in struct * Fix copying artifacts if map file is not created * Unify collecting build and bundle outputs * Fix RW61X build output logic * More copy-paste fixes * Fix TI build --- build/toolchain/android/android_toolchain.gni | 1 - build/toolchain/gcc_toolchain.gni | 12 +- examples/chef/chef.py | 1 + scripts/build/build_examples.py | 14 +- scripts/build/builders/ameba.py | 31 +++-- scripts/build/builders/android.py | 129 ++++++++---------- scripts/build/builders/asr.py | 17 +-- scripts/build/builders/bouffalolab.py | 17 +-- scripts/build/builders/builder.py | 67 +++++---- scripts/build/builders/cc32xx.py | 18 ++- scripts/build/builders/cyw30739.py | 12 +- scripts/build/builders/efr32.py | 29 ++-- scripts/build/builders/esp32.py | 35 ++--- scripts/build/builders/genio.py | 13 +- scripts/build/builders/gn.py | 3 + scripts/build/builders/host.py | 15 +- scripts/build/builders/imx.py | 15 +- scripts/build/builders/infineon.py | 28 ++-- scripts/build/builders/mbed.py | 17 +-- scripts/build/builders/mw320.py | 13 +- scripts/build/builders/nrf.py | 29 ++-- scripts/build/builders/nuttx.py | 17 +-- scripts/build/builders/nxp.py | 12 +- scripts/build/builders/openiotsdk.py | 15 +- scripts/build/builders/qpg.py | 21 +-- scripts/build/builders/rw61x.py | 13 +- scripts/build/builders/stm32.py | 21 +-- scripts/build/builders/telink.py | 21 ++- scripts/build/builders/ti.py | 34 ++--- scripts/build/builders/tizen.py | 27 ++-- src/test_driver/tizen/chip_tests/BUILD.gn | 1 - 31 files changed, 333 insertions(+), 365 deletions(-) diff --git a/build/toolchain/android/android_toolchain.gni b/build/toolchain/android/android_toolchain.gni index e4eed1b30b577e..f1242b6cbcd855 100644 --- a/build/toolchain/android/android_toolchain.gni +++ b/build/toolchain/android/android_toolchain.gni @@ -69,6 +69,5 @@ template("android_clang_toolchain") { ar = _ndk_prefix + "llvm-ar" cc = _ndk_prefix + _tool_name_root + "clang" cxx = _ndk_prefix + _tool_name_root + "clang++" - link_generate_map_file = false } } diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index b4b39daf711fb0..dce52ec7644df8 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -16,11 +16,9 @@ import("//build_overrides/pigweed.gni") import("$dir_pw_toolchain/generate_toolchain.gni") declare_args() { - # Generate Linker map files. Can skip since they can + # Generate Linker map files. By default it is disabled since they can # be quite large. - # - # Note that toolchains can individually override this - chip_generate_link_map_file = true + chip_generate_link_map_file = false } template("gcc_toolchain") { @@ -48,11 +46,7 @@ template("gcc_toolchain") { cxx = invoker.cxx } - if (defined(invoker.link_generate_map_file)) { - link_generate_map_file = invoker.link_generate_map_file - } else { - link_generate_map_file = chip_generate_link_map_file - } + link_generate_map_file = chip_generate_link_map_file is_host_toolchain = invoker_toolchain_args.current_os == host_os link_group = invoker_toolchain_args.current_os != "mac" && diff --git a/examples/chef/chef.py b/examples/chef/chef.py index d3b9fae0ec06ff..6176c6e8c280ac 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -811,6 +811,7 @@ def main() -> int: 'chip_shell_cmd_server = false', 'chip_build_libshell = true', 'chip_enable_openthread = false', + 'chip_generate_link_map_file = true', 'chip_config_network_layer_ble = false', 'chip_device_project_config_include = ""', 'chip_project_config_include = ""', diff --git a/scripts/build/build_examples.py b/scripts/build/build_examples.py index a52c9aa6f3e131..e1f37fca797d7f 100755 --- a/scripts/build/build_examples.py +++ b/scripts/build/build_examples.py @@ -83,14 +83,17 @@ def ValidateTargetNames(context, parameter, values): default=[], multiple=True, callback=ValidateTargetNames, - help='Build target(s)' -) + help='Build target(s)') +@click.option( + '--enable-link-map-file', + default=False, + is_flag=True, + help='Enable generation of link map files.') @click.option( '--enable-flashbundle', default=False, is_flag=True, - help='Also generate the flashbundles for the app.' -) + help='Also generate the flashbundles for the app.') @click.option( '--repo', default='.', @@ -132,7 +135,7 @@ def ValidateTargetNames(context, parameter, values): 'Set pigweed command launcher. E.g.: "--pw-command-launcher=ccache" ' 'for using ccache when building examples.')) @click.pass_context -def main(context, log_level, target, repo, +def main(context, log_level, target, enable_link_map_file, repo, out_prefix, pregen_dir, clean, dry_run, dry_run_output, enable_flashbundle, no_log_timestamps, pw_command_launcher): # Ensures somewhat pretty logging of what is going on @@ -160,6 +163,7 @@ def main(context, log_level, target, repo, context.obj = build.Context( repository_path=repo, output_prefix=out_prefix, runner=runner) context.obj.SetupBuilders(targets=requested_targets, options=BuilderOptions( + enable_link_map_file=enable_link_map_file, enable_flashbundle=enable_flashbundle, pw_command_launcher=pw_command_launcher, pregen_dir=pregen_dir, diff --git a/scripts/build/builders/ameba.py b/scripts/build/builders/ameba.py index 677b47bbd43a01..802ce1f73cbe62 100644 --- a/scripts/build/builders/ameba.py +++ b/scripts/build/builders/ameba.py @@ -15,7 +15,7 @@ import os from enum import Enum, auto -from .builder import Builder +from .builder import Builder, BuilderOutput class AmebaBoard(Enum): @@ -89,18 +89,19 @@ def _build(self): title='Building ' + self.identifier) def build_outputs(self): - return { - self.app.AppNamePrefix + '.axf': - os.path.join(self.output_dir, 'asdk', 'target_image2.axf'), - self.app.AppNamePrefix + '.map': + yield BuilderOutput( + os.path.join(self.output_dir, 'asdk', 'target_image2.axf'), + self.app.AppNamePrefix + '.axf') + if self.options.enable_link_map_file: + yield BuilderOutput( os.path.join(self.output_dir, 'asdk', 'target_image2.map'), - 'km0_boot_all.bin': - os.path.join(self.output_dir, 'asdk', - 'bootloader', 'km0_boot_all.bin'), - 'km4_boot_all.bin': - os.path.join(self.output_dir, 'asdk', - 'bootloader', 'km4_boot_all.bin'), - 'km0_km4_image2.bin': - os.path.join(self.output_dir, 'asdk', - 'image', 'km0_km4_image2.bin'), - } + self.app.AppNamePrefix + '.map') + yield BuilderOutput( + os.path.join(self.output_dir, 'asdk', 'bootloader', 'km0_boot_all.bin'), + 'km0_boot_all.bin') + yield BuilderOutput( + os.path.join(self.output_dir, 'asdk', 'bootloader', 'km4_boot_all.bin'), + 'km4_boot_all.bin') + yield BuilderOutput( + os.path.join(self.output_dir, 'asdk', 'image', 'km0_km4_image2.bin'), + 'km0_km4_image2.bin') diff --git a/scripts/build/builders/android.py b/scripts/build/builders/android.py index bd2c90c28136d6..94d3a566a63877 100644 --- a/scripts/build/builders/android.py +++ b/scripts/build/builders/android.py @@ -16,7 +16,7 @@ import shlex from enum import Enum, auto -from .builder import Builder +from .builder import Builder, BuilderOutput class AndroidBoard(Enum): @@ -366,6 +366,9 @@ def generate(self): if self.options.pw_command_launcher: gn_args["pw_command_launcher"] = self.options.pw_command_launcher + if self.options.enable_link_map_file: + gn_args["chip_generate_link_map_file"] = True + if exampleName == "chip-test": gn_args["chip_build_tests"] = True if self.profile != AndroidProfile.DEBUG: @@ -569,85 +572,61 @@ def _build(self): def build_outputs(self): if self.board.IsIde(): - outputs = { - self.app.AppName() - + "-debug.apk": os.path.join( + yield BuilderOutput( + os.path.join( self.root, "examples/android", self.app.AppName(), - "app/build/outputs/apk/debug/app-debug.apk", - ) - } + "app/build/outputs/apk/debug/app-debug.apk"), + self.app.AppName() + "-debug.apk") elif self.app.ExampleName() is not None: if self.app == AndroidApp.TV_SERVER: - outputs = { - "tv-sever-platform-app-debug.apk": os.path.join( - self.output_dir, "platform-app", "outputs", "apk", "debug", "platform-app-debug.apk" - ), - "tv-sever-content-app-debug.apk": os.path.join( - self.output_dir, "content-app", "outputs", "apk", "debug", "content-app-debug.apk" - ) - } + yield BuilderOutput( + os.path.join(self.output_dir, "platform-app", + "outputs", "apk", "debug", "platform-app-debug.apk"), + "tv-sever-platform-app-debug.apk") + yield BuilderOutput( + os.path.join(self.output_dir, "content-app", + "outputs", "apk", "debug", "content-app-debug.apk"), + "tv-sever-content-app-debug.apk") elif self.app == AndroidApp.VIRTUAL_DEVICE_APP: - outputs = { - self.app.AppName() + "app-debug.apk": os.path.join( - self.output_dir, "VirtualDeviceApp", "app", "outputs", "apk", "debug", "app-debug.apk" - ) - } + yield BuilderOutput( + os.path.join(self.output_dir, "VirtualDeviceApp", "app", + "outputs", "apk", "debug", "app-debug.apk"), + self.app.AppName() + "app-debug.apk") else: - outputs = { - self.app.AppName() + "app-debug.apk": os.path.join( - self.output_dir, "outputs", "apk", "debug", "app-debug.apk" - ) - } + yield BuilderOutput( + os.path.join(self.output_dir, + "outputs", "apk", "debug", "app-debug.apk"), + self.app.AppName() + "app-debug.apk") else: - outputs = { - self.app.AppName() + "app-debug.apk": os.path.join( - self.output_dir, "outputs", "apk", "debug", "app-debug.apk" - ), - "CHIPController.jar": os.path.join( - self.output_dir, "lib", "src/controller/java/CHIPController.jar" - ), - "CHIPInteractionModel.jar": os.path.join( - self.output_dir, "lib", "src/controller/java/CHIPInteractionModel.jar" - ), - "libMatterTlv.jar": os.path.join( - self.output_dir, "lib", "src/controller/java/libMatterTlv.jar" - ), - "AndroidPlatform.jar": os.path.join( - self.output_dir, "lib", "src/platform/android/AndroidPlatform.jar" - ), - "OnboardingPayload.jar": os.path.join( - self.output_dir, - "lib", - "src/controller/java/OnboardingPayload.jar", - ), - "CHIPClusters.jar": os.path.join( - self.output_dir, - "lib", - "src/controller/java/CHIPClusters.jar", - ), - "CHIPClusterID.jar": os.path.join( - self.output_dir, - "lib", - "src/controller/java/CHIPClusterID.jar", - ), - "jni/%s/libCHIPController.so" - % self.board.AbiName(): os.path.join( - self.output_dir, - "lib", - "jni", - self.board.AbiName(), - "libCHIPController.so", - ), - "jni/%s/libc++_shared.so" - % self.board.AbiName(): os.path.join( - self.output_dir, - "lib", - "jni", - self.board.AbiName(), - "libc++_shared.so", - ), - } - - return outputs + yield BuilderOutput( + os.path.join(self.output_dir, "outputs", "apk", "debug", "app-debug.apk"), + self.app.AppName() + "app-debug.apk") + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "src", "controller", "java", "CHIPController.jar"), + "CHIPController.jar") + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "src", "controller", "java", "CHIPInteractionModel.jar"), + "CHIPInteractionModel.jar") + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "src", "controller", "java", "libMatterTlv.jar"), + "libMatterTlv.jar") + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "src", "platform", "android", "AndroidPlatform.jar"), + "AndroidPlatform.jar") + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "src", "controller", "java", "OnboardingPayload.jar"), + "OnboardingPayload.jar") + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "src", "controller", "java", "CHIPClusters.jar"), + "CHIPClusters.jar") + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "src", "controller", "java", "CHIPClusterID.jar"), + "CHIPClusterID.jar") + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "jni", self.board.AbiName(), "libCHIPController.so"), + "jni/%s/libCHIPController.so" % self.board.AbiName()) + yield BuilderOutput( + os.path.join(self.output_dir, "lib", "jni", self.board.AbiName(), "libc++_shared.so"), + "jni/%s/libc++_shared.so" % self.board.AbiName()) diff --git a/scripts/build/builders/asr.py b/scripts/build/builders/asr.py index d7351a1daec289..a901147cf1e7a7 100644 --- a/scripts/build/builders/asr.py +++ b/scripts/build/builders/asr.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -178,13 +179,9 @@ def GnBuildArgs(self): return self.extra_gn_options def build_outputs(self): - items = { - '%s.out' % self.app.AppNamePrefix(): - os.path.join(self.output_dir, '%s.out' % - self.app.AppNamePrefix()), - '%s.out.map' % self.app.AppNamePrefix(): - os.path.join(self.output_dir, - '%s.out.map' % self.app.AppNamePrefix()), - } - - return items + extensions = ["out"] + if self.options.enable_link_map_file: + extensions.append("out.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/bouffalolab.py b/scripts/build/builders/bouffalolab.py index 1b661bff045c07..a8adfbb2a32b74 100644 --- a/scripts/build/builders/bouffalolab.py +++ b/scripts/build/builders/bouffalolab.py @@ -16,6 +16,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -226,16 +227,12 @@ def GnBuildArgs(self): return self.argsOpt def build_outputs(self): - items = { - '%s.out' % self.app.AppNamePrefix(self.chip_name): - os.path.join(self.output_dir, '%s.out' % - self.app.AppNamePrefix(self.chip_name)), - '%s.out.map' % self.app.AppNamePrefix(self.chip_name): - os.path.join(self.output_dir, - '%s.out.map' % self.app.AppNamePrefix(self.chip_name)), - } - - return items + extensions = ["out"] + if self.options.enable_link_map_file: + extensions.append("out.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix(self.chip_name)}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) def PostBuildCommand(self): diff --git a/scripts/build/builders/builder.py b/scripts/build/builders/builder.py index dc420fce5e6b41..2895300e12388e 100644 --- a/scripts/build/builders/builder.py +++ b/scripts/build/builders/builder.py @@ -22,6 +22,9 @@ @dataclass class BuilderOptions: + # Generate a link map file + enable_link_map_file: bool = False + # Enable flashbundle generation stage enable_flashbundle: bool = False @@ -32,6 +35,12 @@ class BuilderOptions: pregen_dir: str = None +@dataclass +class BuilderOutput: + source: str # Source file generated by the build + target: str # Target file to be copied to + + class Builder(ABC): """Generic builder base class for CHIP. @@ -59,63 +68,61 @@ def _build(self): """Perform an actual build""" raise NotImplementedError() - def _generate_flashbundle(self): - """Perform an actual generating of flashbundle + def _bundle(self): + """Perform an actual generating of flashbundle. - May do nothing (and builder can choose not to implement this) if the - app does not need special steps for generating flashbundle. (e.g. the - example apps on Linux platform can run the ELF files directly.) + May do nothing (and builder can choose not to implement this) if + the app does not need special steps for generating flashbundle (e.g. + on Linux platform, the output ELF files can be used directly). """ pass @abstractmethod def build_outputs(self): - """Return a list of relevant output files after a build. + """Return a list of relevant BuilderOutput objects after a build. - May use build output data (e.g. manifests), so this should be invoked - only after a build has succeeded. + May use build output data (e.g. manifests), so this should be + invoked only after a build has succeeded. """ raise NotImplementedError() - def flashbundle(self): - """Return the files in flashbundle. + def bundle_outputs(self): + """Return the BuilderOutput objects in flashbundle. - Return an empty dict (and builder can choose not to implement this) if the - app does not need special files as flashbundle. (e.g. the example apps on - Linux platform can run the ELF files directly.) + Return an empty list (and builder can choose not to implement this) + if the app does not need special files as flashbundle. - May use data from do_generate_flashbundle, so this should be invoked only - after do_generate_flashbundle has succeeded. + May use data from _bundle(), so this should be invoked only after + _bundle() has succeeded. """ - return {} + return [] def outputs(self): - artifacts = self.build_outputs() + outputs = list(self.build_outputs()) if self.options.enable_flashbundle: - artifacts.update(self.flashbundle()) - return artifacts + outputs.extend(self.bundle_outputs()) + return outputs def build(self): self._build() if self.options.enable_flashbundle: - self._generate_flashbundle() + self._bundle() def _Execute(self, cmdarray, title=None): self._runner.Run(cmdarray, title=title) def CompressArtifacts(self, target_file: str): with tarfile.open(target_file, "w:gz") as tar: - for target_name, source_name in self.outputs().items(): - logging.info( - f'Adding {source_name} into {target_file}/{target_name}') - tar.add(source_name, target_name) + for output in self.outputs(): + logging.info('Adding %s into %s(%s)', + output.source, target_file, output.target) + tar.add(output.source, output.target) def CopyArtifacts(self, target_dir: str): - for target_name, source_name in self.outputs().items(): - target_full_name = os.path.join(target_dir, target_name) - - logging.info('Copying %s into %s', source_name, target_name) + for output in self.outputs(): + logging.info(f'Copying {output.source} into {output.target}') + target_full_name = os.path.join(target_dir, output.target) target_dir_full_name = os.path.dirname(target_full_name) if not os.path.exists(target_dir_full_name): @@ -123,5 +130,5 @@ def CopyArtifacts(self, target_dir: str): target_dir_full_name) os.makedirs(target_dir_full_name) - shutil.copyfile(source_name, target_full_name) - shutil.copymode(source_name, target_full_name) + shutil.copyfile(output.source, target_full_name) + shutil.copymode(output.source, target_full_name) diff --git a/scripts/build/builders/cc32xx.py b/scripts/build/builders/cc32xx.py index f54b7531eecc81..2563cab948ce0b 100644 --- a/scripts/build/builders/cc32xx.py +++ b/scripts/build/builders/cc32xx.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -62,17 +63,14 @@ def GnBuildArgs(self): return args def build_outputs(self): - items = {} if (self.app == cc32xxApp.LOCK): - extensions = [".out", ".bin", ".out.map"] + extensions = ["out", "bin"] elif (self.app == cc32xxApp.AIR_PURIFIER): - extensions = [".out", ".bin", ".out.map"] - + extensions = ["out", "bin"] else: raise Exception('Unknown app type: %r' % self.app) - - for extension in extensions: - name = '%s%s' % (self.app.AppNamePrefix(), extension) - items[name] = os.path.join(self.output_dir, name) - - return items + if self.options.enable_link_map_file: + extensions.append("out.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/cyw30739.py b/scripts/build/builders/cyw30739.py index 4c03edca3151ef..243c78bc524b82 100644 --- a/scripts/build/builders/cyw30739.py +++ b/scripts/build/builders/cyw30739.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -102,8 +103,9 @@ def GnBuildArgs(self): return args def build_outputs(self): - items = {} - for extension in ["elf", "elf.map"]: - name = "%s-%s.%s" % (self.app.AppNamePrefix(), self.board.GnArgName(), extension) - items[name] = os.path.join(self.output_dir, name) - return items + extensions = ["elf"] + if self.options.enable_link_map_file: + extensions.append("elf.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix()}-{self.board.GnArgName()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/efr32.py b/scripts/build/builders/efr32.py index 1144cfc8c54a16..b0ad37be4774a9 100644 --- a/scripts/build/builders/efr32.py +++ b/scripts/build/builders/efr32.py @@ -17,6 +17,7 @@ import subprocess from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -263,26 +264,27 @@ def GnBuildArgs(self): return self.extra_gn_options def build_outputs(self): - items = {} - for extension in ["out", "out.map", "hex"]: - name = '%s.%s' % (self.app.AppNamePrefix(), extension) - items[name] = os.path.join(self.output_dir, name) + extensions = ["out", "hex"] + if self.options.enable_link_map_file: + extensions.append("out.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) if self.app == Efr32App.UNIT_TEST: # Include test runner python wheels for root, dirs, files in os.walk(os.path.join(self.output_dir, 'chip_nl_test_runner_wheels')): for file in files: - items["chip_nl_test_runner_wheels/" + - file] = os.path.join(root, file) + yield BuilderOutput( + os.path.join(root, file), + os.path.join("chip_nl_test_runner_wheels", file)) # Figure out flash bundle files and build accordingly with open(os.path.join(self.output_dir, self.app.FlashBundleName())) as f: - for line in f.readlines(): - name = line.strip() - items['flashbundle/%s' % - name] = os.path.join(self.output_dir, name) - - return items + for name in filter(None, [x.strip() for x in f.readlines()]): + yield BuilderOutput( + os.path.join(self.output_dir, name), + os.path.join("flashbundle", name)) def generate(self): cmd = [ @@ -298,6 +300,9 @@ def generate(self): if self.options.pw_command_launcher: extra_args.append('pw_command_launcher="%s"' % self.options.pw_command_launcher) + if self.options.enable_link_map_file: + extra_args.append('chip_generate_link_map_file=true') + if self.options.pregen_dir: extra_args.append('chip_code_pre_generated_directory="%s"' % self.options.pregen_dir) diff --git a/scripts/build/builders/esp32.py b/scripts/build/builders/esp32.py index 468a92072c9fd9..3528a5873050e4 100644 --- a/scripts/build/builders/esp32.py +++ b/scripts/build/builders/esp32.py @@ -17,7 +17,7 @@ import shlex from enum import Enum, auto -from .builder import Builder +from .builder import Builder, BuilderOutput class Esp32Board(Enum): @@ -248,26 +248,21 @@ def _build(self): def build_outputs(self): if self.app == Esp32App.TESTS: # Include the runnable image names as artifacts - result = dict() with open(os.path.join(self.output_dir, 'test_images.txt'), 'rt') as f: - for name in f.readlines(): - name = name.strip() - result[name] = os.path.join(self.output_dir, name) - - return result + for name in filter(None, [x.strip() for x in f.readlines()]): + yield BuilderOutput(os.path.join(self.output_dir, name), name) + return - return { - self.app.AppNamePrefix + '.elf': - os.path.join(self.output_dir, self.app.AppNamePrefix + '.elf'), - self.app.AppNamePrefix + '.map': - os.path.join(self.output_dir, self.app.AppNamePrefix + '.map'), - } + extensions = ["elf"] + if self.options.enable_link_map_file: + extensions.append("map") + for ext in extensions: + name = f"{self.app.AppNamePrefix}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) - def flashbundle(self): + def bundle_outputs(self): if not self.app.FlashBundleName: - return {} - - with open(os.path.join(self.output_dir, self.app.FlashBundleName), 'r') as fp: - return { - line.strip(): os.path.join(self.output_dir, line.strip()) for line in fp.readlines() if line.strip() - } + return + with open(os.path.join(self.output_dir, self.app.FlashBundleName)) as f: + for line in filter(None, [x.strip() for x in f.readlines()]): + yield BuilderOutput(os.path.join(self.output_dir, line), line) diff --git a/scripts/build/builders/genio.py b/scripts/build/builders/genio.py index 822f198fd798da..ed7a8518f7d128 100755 --- a/scripts/build/builders/genio.py +++ b/scripts/build/builders/genio.py @@ -1,6 +1,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -48,9 +49,9 @@ def __init__(self, self.app = app def build_outputs(self): - items = {} - for extension in ['out', 'out.map', 'bin']: - name = '%s.%s' % (self.app.AppNamePrefix(), extension) - items[name] = os.path.join(self.output_dir, name) - - return items + extensions = ['out', 'bin'] + if self.options.enable_link_map_file: + extensions.append('out.map') + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/gn.py b/scripts/build/builders/gn.py index 75f6bb02c4231e..d2b09f393c1597 100644 --- a/scripts/build/builders/gn.py +++ b/scripts/build/builders/gn.py @@ -64,6 +64,9 @@ def generate(self): if self.options.pw_command_launcher: extra_args.append('pw_command_launcher="%s"' % self.options.pw_command_launcher) + if self.options.enable_link_map_file: + extra_args.append('chip_generate_link_map_file=true') + if self.options.pregen_dir: extra_args.append('chip_code_pre_generated_directory="%s"' % self.options.pregen_dir) diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index 667cd39d47da99..822375fdd65c05 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -17,6 +17,7 @@ from platform import uname from typing import Optional +from .builder import BuilderOutput from .gn import GnBuilder @@ -564,19 +565,13 @@ def PostBuildCommand(self): self.createJavaExecutable("kotlin-matter-controller") def build_outputs(self): - outputs = {} - for name in self.app.OutputNames(): + if not self.options.enable_link_map_file and name.endswith(".map"): + continue path = os.path.join(self.output_dir, name) if os.path.isdir(path): for root, dirs, files in os.walk(path): for file in files: - outputs.update({ - file: os.path.join(root, file) - }) + yield BuilderOutput(os.path.join(root, file), file) else: - outputs.update({ - name: os.path.join(self.output_dir, name) - }) - - return outputs + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/imx.py b/scripts/build/builders/imx.py index e748144edc21a1..0d10557b8c5396 100644 --- a/scripts/build/builders/imx.py +++ b/scripts/build/builders/imx.py @@ -17,6 +17,7 @@ import shlex from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -180,19 +181,13 @@ def SysRootPath(self, name): return os.environ[name] def build_outputs(self): - outputs = {} - for name in self.app.OutputNames(): + if not self.options.enable_link_map_file and name.endswith(".map"): + continue path = os.path.join(self.output_dir, name) if os.path.isdir(path): for root, dirs, files in os.walk(path): for file in files: - outputs.update({ - file: os.path.join(root, file) - }) + yield BuilderOutput(os.path.join(root, file), file) else: - outputs.update({ - name: os.path.join(self.output_dir, name) - }) - - return outputs + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/infineon.py b/scripts/build/builders/infineon.py index 1cf7e0dd9b900d..8578fba45434a3 100644 --- a/scripts/build/builders/infineon.py +++ b/scripts/build/builders/infineon.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -102,19 +103,14 @@ def GnBuildArgs(self): return self.extra_gn_options def build_outputs(self): - items = { - '%s.out' % self.app.AppNamePrefix(): - os.path.join(self.output_dir, '%s.out' % - self.app.AppNamePrefix()), - '%s.out.map' % self.app.AppNamePrefix(): - os.path.join(self.output_dir, - '%s.out.map' % self.app.AppNamePrefix()), - } - - return items - - def flashbundle(self): - with open(os.path.join(self.output_dir, self.app.FlashBundleName()), 'r') as fp: - return { - line.strip(): os.path.join(self.output_dir, line.strip()) for line in fp.readlines() if line.strip() - } + extensions = ['out'] + if self.options.enable_link_map_file: + extensions.append('out.map') + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) + + def bundle_outputs(self): + with open(os.path.join(self.output_dir, self.app.FlashBundleName())) as f: + for line in filter(None, [x.strip() for x in f.readlines()]): + yield BuilderOutput(os.path.join(self.output_dir, line), line) diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py index fd2aa00ebd2f35..6dc47d0aa4aa27 100644 --- a/scripts/build/builders/mbed.py +++ b/scripts/build/builders/mbed.py @@ -16,7 +16,7 @@ import shlex from enum import Enum, auto -from .builder import Builder +from .builder import Builder, BuilderOutput class MbedApp(Enum): @@ -147,12 +147,9 @@ def _build(self): title='Building ' + self.identifier) def build_outputs(self): - return { - self.app.AppNamePrefix + '.elf': - os.path.join(self.output_dir, self.app.AppNamePrefix + '.elf'), - self.app.AppNamePrefix + '.hex': - os.path.join(self.output_dir, self.app.AppNamePrefix + '.hex'), - self.app.AppNamePrefix + '.map': - os.path.join(self.output_dir, - self.app.AppNamePrefix + '.elf.map'), - } + extensions = ['elf', 'hex'] + if self.options.enable_link_map_file: + extensions.append('elf.map') + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/mw320.py b/scripts/build/builders/mw320.py index 66b739321d8759..7fdf7578385eec 100755 --- a/scripts/build/builders/mw320.py +++ b/scripts/build/builders/mw320.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -49,9 +50,9 @@ def __init__(self, self.app = app def build_outputs(self): - items = {} - for extension in [".bin", ".out", ".out.map"]: - name = '%s%s' % (self.app.AppNamePrefix(), extension) - items[name] = os.path.join(self.output_dir, name) - - return items + extensions = ["bin", "out"] + if self.options.enable_link_map_file: + extensions.append("out.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/nrf.py b/scripts/build/builders/nrf.py index 9bc4f9596efc26..d584490589c662 100644 --- a/scripts/build/builders/nrf.py +++ b/scripts/build/builders/nrf.py @@ -17,7 +17,7 @@ import shlex from enum import Enum, auto -from .builder import Builder +from .builder import Builder, BuilderOutput class NrfApp(Enum): @@ -225,23 +225,24 @@ def _build(self): self._Execute(['ctest', '--build-nocmake', '-V', '--output-on-failure', '--test-dir', self.output_dir], title='Run Tests ' + self.identifier) - def _generate_flashbundle(self): + def _bundle(self): logging.info(f'Generating flashbundle at {self.output_dir}') self._Execute(['ninja', '-C', self.output_dir, 'flashing_script'], title='Generating flashable files of ' + self.identifier) def build_outputs(self): - return { - '%s.elf' % self.app.AppNamePrefix(): os.path.join(self.output_dir, 'zephyr', 'zephyr.elf'), - '%s.map' % self.app.AppNamePrefix(): os.path.join(self.output_dir, 'zephyr', 'zephyr.map'), - } - - def flashbundle(self): + yield BuilderOutput( + os.path.join(self.output_dir, 'zephyr', 'zephyr.elf'), + '%s.elf' % self.app.AppNamePrefix()) + if self.options.enable_link_map_file: + yield BuilderOutput( + os.path.join(self.output_dir, 'zephyr', 'zephyr.map'), + '%s.map' % self.app.AppNamePrefix()) + + def bundle_outputs(self): if self.app == NrfApp.UNIT_TESTS: - return dict() - - with open(os.path.join(self.output_dir, self.app.FlashBundleName()), 'r') as fp: - return { - line.strip(): os.path.join(self.output_dir, line.strip()) for line in fp.readlines() if line.strip() - } + return + with open(os.path.join(self.output_dir, self.app.FlashBundleName())) as f: + for line in filter(None, [x.strip() for x in f.readlines()]): + yield BuilderOutput(os.path.join(self.output_dir, line), line) diff --git a/scripts/build/builders/nuttx.py b/scripts/build/builders/nuttx.py index ae198ca71f07ac..39bb2e78918667 100644 --- a/scripts/build/builders/nuttx.py +++ b/scripts/build/builders/nuttx.py @@ -16,6 +16,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import Builder @@ -86,13 +87,9 @@ def _build(self): def build_outputs(self): logging.info('Compiling outputs NuttX at %s', self.output_dir) - items = { - '%s.out' % self.app.AppNamePrefix(self.chip_name): - os.path.join(self.output_dir, '%s.out' % - self.app.AppNamePrefix(self.chip_name)), - '%s.out.map' % self.app.AppNamePrefix(self.chip_name): - os.path.join(self.output_dir, - '%s.out.map' % self.app.AppNamePrefix(self.chip_name)), - } - - return items + extensions = ["out"] + if self.options.enable_link_map_file: + extensions.append("out.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix(self.chip_name)}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/nxp.py b/scripts/build/builders/nxp.py index 9f0dcfddd7bbde..4bd4f0ae451875 100644 --- a/scripts/build/builders/nxp.py +++ b/scripts/build/builders/nxp.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -129,7 +130,10 @@ def generate(self): def build_outputs(self): name = 'chip-%s-%s' % (self.board.Name(), self.app.NameSuffix()) - return { - '%s.elf' % name: os.path.join(self.output_dir, name), - '%s.map' % name: os.path.join(self.output_dir, '%s.map' % name) - } + yield BuilderOutput( + os.path.join(self.output_dir, name), + f'{name}.elf') + if self.options.enable_link_map_file: + yield BuilderOutput( + os.path.join(self.output_dir, f'{name}.map'), + f'{name}.map') diff --git a/scripts/build/builders/openiotsdk.py b/scripts/build/builders/openiotsdk.py index 89aad6a59e9a16..c0ea5facb92f70 100644 --- a/scripts/build/builders/openiotsdk.py +++ b/scripts/build/builders/openiotsdk.py @@ -16,7 +16,7 @@ import shlex from enum import Enum, auto -from .builder import Builder +from .builder import Builder, BuilderOutput class OpenIotSdkApp(Enum): @@ -90,10 +90,9 @@ def _build(self): title='Building ' + self.identifier) def build_outputs(self): - return { - self.app.AppNamePrefix + '.elf': - os.path.join(self.output_dir, self.app.AppNamePrefix + '.elf'), - self.app.AppNamePrefix + '.map': - os.path.join(self.output_dir, - self.app.AppNamePrefix + '.map'), - } + extensions = ["elf"] + if self.options.enable_link_map_file: + extensions.append("map") + for ext in extensions: + name = f"{self.app.AppNamePrefix}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/qpg.py b/scripts/build/builders/qpg.py index ef3b6745058e02..330f4e3b74977d 100644 --- a/scripts/build/builders/qpg.py +++ b/scripts/build/builders/qpg.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -126,16 +127,16 @@ def GnBuildArgs(self): return args def build_outputs(self): - items = {} - for extension in ["out", "out.map", "out.hex"]: - name = '%s.%s' % (self.app.AppNamePrefix(), extension) - items[name] = os.path.join(self.output_dir, name) + extensions = ["out", "out.hex"] + if self.options.enable_link_map_file: + extensions.append("out.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) # Figure out flash bundle files and build accordingly with open(os.path.join(self.output_dir, self.app.FlashBundleName())) as f: - for line in f.readlines(): - name = line.strip() - items['flashbundle/%s' % - name] = os.path.join(self.output_dir, name) - - return items + for name in filter(None, [x.strip() for x in f.readlines()]): + yield BuilderOutput( + os.path.join(self.output_dir, name), + os.path.join('flashbundle', name)) diff --git a/scripts/build/builders/rw61x.py b/scripts/build/builders/rw61x.py index 546c6549e2aab9..b0c67dcbac68b1 100644 --- a/scripts/build/builders/rw61x.py +++ b/scripts/build/builders/rw61x.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -117,8 +118,10 @@ def generate(self): super(RW61XBuilder, self).generate() def build_outputs(self): - name = '%s' % self.app.NameSuffix() - return { - '%s.elf' % name: os.path.join(self.output_dir, name), - '%s.map' % name: os.path.join(self.output_dir, '%s.map' % name) - } + yield BuilderOutput( + os.path.join(self.output_dir, self.app.NameSuffix()), + f'{self.app.NameSuffix()}.elf') + if self.options.enable_link_map_file: + yield BuilderOutput( + os.path.join(self.output_dir, f'{self.app.NameSuffix()}.map'), + f'{self.app.NameSuffix()}.map') diff --git a/scripts/build/builders/stm32.py b/scripts/build/builders/stm32.py index 1613ecbbe42f39..ae9d4f7b65c702 100644 --- a/scripts/build/builders/stm32.py +++ b/scripts/build/builders/stm32.py @@ -15,6 +15,7 @@ import os from enum import Enum, auto +from .builder import BuilderOutput from .gn import GnBuilder @@ -78,16 +79,16 @@ def GnBuildArgs(self): return self.extra_gn_options def build_outputs(self): - items = {} - for extension in ["out", "out.map", "out.hex"]: - name = '%s.%s' % (self.app.AppNamePrefix(), extension) - items[name] = os.path.join(self.output_dir, name) + extensions = ["out", "out.hex"] + if self.options.enable_link_map_file: + extensions.append("out.map") + for ext in extensions: + name = f"{self.app.AppNamePrefix()}.{ext}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) # Figure out flash bundle files and build accordingly with open(os.path.join(self.output_dir, self.app.FlashBundleName())) as f: - for line in f.readlines(): - name = line.strip() - items['flashbundle/%s' % - name] = os.path.join(self.output_dir, name) - - return items + for name in filter(None, [x.strip() for x in f.readlines()]): + yield BuilderOutput( + os.path.join(self.output_dir, name), + os.path.join('flashbundle', name)) diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py index 9b63635250dcf2..c53e0b6321cd76 100644 --- a/scripts/build/builders/telink.py +++ b/scripts/build/builders/telink.py @@ -17,7 +17,7 @@ import shlex from enum import Enum, auto -from .builder import Builder +from .builder import Builder, BuilderOutput class TelinkApp(Enum): @@ -229,15 +229,10 @@ def _build(self): self._Execute(['bash', '-c', cmd], title='Building ' + self.identifier) def build_outputs(self): - return { - '%s.elf' % - self.app.AppNamePrefix(): os.path.join( - self.output_dir, - 'zephyr', - 'zephyr.elf'), - '%s.map' % - self.app.AppNamePrefix(): os.path.join( - self.output_dir, - 'zephyr', - 'zephyr.map'), - } + yield BuilderOutput( + os.path.join(self.output_dir, 'zephyr', 'zephyr.elf'), + '%s.elf' % self.app.AppNamePrefix()) + if self.options.enable_link_map_file: + yield BuilderOutput( + os.path.join(self.output_dir, 'zephyr', 'zephyr.map'), + '%s.map' % self.app.AppNamePrefix()) diff --git a/scripts/build/builders/ti.py b/scripts/build/builders/ti.py index 5decd75cc058e0..f0691f541b3157 100644 --- a/scripts/build/builders/ti.py +++ b/scripts/build/builders/ti.py @@ -16,6 +16,7 @@ from enum import Enum, auto from typing import Optional +from .builder import BuilderOutput from .gn import GnBuilder @@ -104,6 +105,9 @@ def GnBuildArgs(self): args = [ 'ti_sysconfig_root="%s"' % os.environ['TI_SYSCONFIG_ROOT'], 'ti_simplelink_board="%s"' % self.board.BoardName(), + # FIXME: It seems that TI SDK expects link map file to be present. + # In order to make it optional, SDK fix is needed. + 'chip_generate_link_map_file=true', ] if self.openthread_ftd: @@ -115,22 +119,18 @@ def GnBuildArgs(self): return args def build_outputs(self): - items = {} - if (self.board == TIBoard.LP_EM_CC1354P10_6): - if (self.app == TIApp.LOCK - or self.app == TIApp.LIGHTING - or self.app == TIApp.PUMP - or self.app == TIApp.PUMP_CONTROLLER): - extensions = [".out", ".out.map", "-mcuboot.hex"] - + if self.board == TIBoard.LP_EM_CC1354P10_6: + if self.app in [TIApp.LOCK, + TIApp.LIGHTING, + TIApp.PUMP, + TIApp.PUMP_CONTROLLER]: + suffixes = [".out", "-mcuboot.hex"] else: - extensions = [".out", ".out.map"] - + suffixes = [".out"] else: - extensions = [".out", ".out.map"] - - for extension in extensions: - name = '%s%s' % (self.app.AppNamePrefix(self.board), extension) - items[name] = os.path.join(self.output_dir, name) - - return items + suffixes = [".out"] + if self.options.enable_link_map_file: + suffixes.append(".out.map") + for suffix in suffixes: + name = f"{self.app.AppNamePrefix(self.board)}{suffix}" + yield BuilderOutput(os.path.join(self.output_dir, name), name) diff --git a/scripts/build/builders/tizen.py b/scripts/build/builders/tizen.py index 6b5cdd90ec77f0..97124328c5dd1e 100644 --- a/scripts/build/builders/tizen.py +++ b/scripts/build/builders/tizen.py @@ -18,6 +18,7 @@ from enum import Enum from xml.etree import ElementTree as ET +from .builder import BuilderOutput from .gn import GnBuilder Board = namedtuple('Board', ['target_cpu']) @@ -147,23 +148,23 @@ def GnBuildArgs(self): 'tizen_sdk_sysroot="%s"' % os.environ['TIZEN_SDK_SYSROOT'], ] - def _generate_flashbundle(self): + def _bundle(self): if self.app.is_tpk: logging.info('Packaging %s', self.output_dir) cmd = ['ninja', '-C', self.output_dir, self.app.value.name + ':tpk'] self._Execute(cmd, title='Packaging ' + self.identifier) def build_outputs(self): - return { - output: os.path.join(self.output_dir, output) - for output in self.app.value.outputs - } - - def flashbundle(self): + for name in self.app.value.outputs: + if not self.options.enable_link_map_file and name.endswith(".map"): + continue + yield BuilderOutput( + os.path.join(self.output_dir, name), + name) + + def bundle_outputs(self): if not self.app.is_tpk: - return {} - return { - self.app.package: os.path.join(self.output_dir, - self.app.package_name, 'out', - self.app.package), - } + return + source = os.path.join(self.output_dir, self.app.package_name, + 'out', self.app.package) + yield BuilderOutput(source, self.app.package) diff --git a/src/test_driver/tizen/chip_tests/BUILD.gn b/src/test_driver/tizen/chip_tests/BUILD.gn index 01b0e5e70246be..829371df7cc620 100644 --- a/src/test_driver/tizen/chip_tests/BUILD.gn +++ b/src/test_driver/tizen/chip_tests/BUILD.gn @@ -30,7 +30,6 @@ tizen_qemu_mkisofs("chip-tests-runner") { # rebuild of the ISO image, so the test will be run with old # binaries. assets_non_tracked = [ rebase_path("${root_build_dir}/tests") ] - assets_non_tracked_exclude_globs = [ "*.map" ] } tizen_qemu_run("chip-tests") { From 95fc18c6fcbc3f41578048f115c9fdeb244d7190 Mon Sep 17 00:00:00 2001 From: ZhangLe2016 <156590889+ZhangLe2016@users.noreply.github.com> Date: Tue, 4 Jun 2024 00:11:33 +0800 Subject: [PATCH 032/162] [thread] add Thread stack lock held for output the unicast addresses (#33661) * [thread] add Thread stack lock held for output the unicast addresses * [thread] add Thread stack lock held for output the unicast addresses --- .../OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp | 2 ++ src/platform/OpenThread/OpenThreadUtils.cpp | 5 ----- src/platform/OpenThread/OpenThreadUtils.h | 6 ++++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index 12f9af57a44342..cf1894cf93fc74 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -247,7 +247,9 @@ void GenericThreadStackManagerImpl_OpenThread::_OnPlatformEvent(const } #if CHIP_DETAIL_LOGGING + Impl()->LockThreadStack(); LogOpenThreadStateChange(mOTInst, event->ThreadStateChange.OpenThread.Flags); + Impl()->UnlockThreadStack(); #endif // CHIP_DETAIL_LOGGING } } diff --git a/src/platform/OpenThread/OpenThreadUtils.cpp b/src/platform/OpenThread/OpenThreadUtils.cpp index ef97c7a4e35947..093997c66fb789 100644 --- a/src/platform/OpenThread/OpenThreadUtils.cpp +++ b/src/platform/OpenThread/OpenThreadUtils.cpp @@ -87,11 +87,6 @@ void RegisterOpenThreadErrorFormatter(void) RegisterErrorFormatter(&sOpenThreadErrorFormatter); } -/** - * Log information related to a state change in the OpenThread stack. - * - * NB: This function *must* be called with the Thread stack lock held. - */ void LogOpenThreadStateChange(otInstance * otInst, uint32_t flags) { #if CHIP_DETAIL_LOGGING diff --git a/src/platform/OpenThread/OpenThreadUtils.h b/src/platform/OpenThread/OpenThreadUtils.h index ad2687cf53aea5..f9609e8d8728af 100644 --- a/src/platform/OpenThread/OpenThreadUtils.h +++ b/src/platform/OpenThread/OpenThreadUtils.h @@ -60,6 +60,12 @@ namespace Internal { extern CHIP_ERROR MapOpenThreadError(otError otErr); extern void RegisterOpenThreadErrorFormatter(void); + +/** + * Log information related to a state change in the OpenThread stack. + * + * NB: This function *must* be called with the Thread stack lock held. + */ extern void LogOpenThreadStateChange(otInstance * otInst, uint32_t flags); extern void LogOpenThreadPacket(const char * titleStr, otMessage * pkt); extern bool IsOpenThreadMeshLocalAddress(otInstance * otInst, const Inet::IPAddress & addr); From 960329aee9b3a83d005c578fff6257f2684ee1be Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Mon, 3 Jun 2024 18:19:38 +0200 Subject: [PATCH 033/162] [Tizen] Gracefully terminate example apps (#33712) --- examples/platform/tizen/TizenServiceAppMain.cpp | 16 ++++++++++------ examples/platform/tizen/TizenServiceAppMain.h | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/platform/tizen/TizenServiceAppMain.cpp b/examples/platform/tizen/TizenServiceAppMain.cpp index 778c36960c608b..aed9734ce1aa2f 100644 --- a/examples/platform/tizen/TizenServiceAppMain.cpp +++ b/examples/platform/tizen/TizenServiceAppMain.cpp @@ -18,7 +18,9 @@ #include "TizenServiceAppMain.h" +#include #include +#include #include #include @@ -29,13 +31,13 @@ namespace { bool service_app_create(void * data) { auto app = reinterpret_cast(data); - return app->AppCreated(); + return app->AppCreate(); } void service_app_terminate(void * data) { auto app = reinterpret_cast(data); - app->AppTerminated(); + app->AppTerminate(); } void service_app_control(app_control_h app_control, void * data) @@ -68,15 +70,17 @@ void TizenServiceAppMain::Exit() service_app_exit(); } -bool TizenServiceAppMain::AppCreated() +bool TizenServiceAppMain::AppCreate() { - ChipLogProgress(NotSpecified, "Tizen app created"); + ChipLogProgress(NotSpecified, "Tizen app create"); return true; } -void TizenServiceAppMain::AppTerminated() +void TizenServiceAppMain::AppTerminate() { - ChipLogProgress(NotSpecified, "Tizen app terminated"); + ChipLogProgress(NotSpecified, "Tizen app terminate"); + chip::Server::GetInstance().GenerateShutDownEvent(); + chip::DeviceLayer::PlatformMgr().StopEventLoopTask(); } static void TizenMainLoopWrapper() diff --git a/examples/platform/tizen/TizenServiceAppMain.h b/examples/platform/tizen/TizenServiceAppMain.h index 20f889e94a8b63..316a6b6a1f7a36 100644 --- a/examples/platform/tizen/TizenServiceAppMain.h +++ b/examples/platform/tizen/TizenServiceAppMain.h @@ -35,8 +35,8 @@ class TizenServiceAppMain app_error_e RunMainLoop(); void Exit(); - virtual bool AppCreated(); - virtual void AppTerminated(); + virtual bool AppCreate(); + virtual void AppTerminate(); virtual void AppControl(app_control_h app_control); private: From 9a06cfccdedda4919f841c04ed9ded1e72591191 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 3 Jun 2024 12:19:42 -0400 Subject: [PATCH 034/162] Use EncodableToTLV in im_responder (#33693) * Use EncodableToTLV in im_responder. This makes the API cleaner and safer (have snapshot & rollback capabilities, less use of prepare/finish). * Update src/app/tests/integration/chip_im_responder.cpp Co-authored-by: Boris Zbarsky --------- Co-authored-by: Andrei Litvin Co-authored-by: Boris Zbarsky --- .../tests/integration/chip_im_responder.cpp | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/app/tests/integration/chip_im_responder.cpp b/src/app/tests/integration/chip_im_responder.cpp index 72f056ca6ab8b7..86d654b99ff94c 100644 --- a/src/app/tests/integration/chip_im_responder.cpp +++ b/src/app/tests/integration/chip_im_responder.cpp @@ -50,6 +50,25 @@ namespace chip { namespace app { +namespace { + +class TestTLVDataEncoder : public DataModel::EncodableToTLV +{ +public: + CHIP_ERROR EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const override + { + TLV::TLVType outerType; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outerType)); + + ReturnErrorOnFailure(writer.Put(chip::TLV::ContextTag(kTestFieldId1), kTestFieldValue1)); + ReturnErrorOnFailure(writer.Put(chip::TLV::ContextTag(kTestFieldId2), kTestFieldValue2)); + + return writer.EndContainer(outerType); + } +}; + +} // namespace + Protocols::InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aCommandPath) { // The Mock cluster catalog -- only have one command on one cluster on one endpoint. @@ -104,17 +123,8 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPat { printf("responder constructing command data in command"); - chip::TLV::TLVWriter * writer; - - const CommandHandler::InvokeResponseParameters prepareParams(aRequestCommandPath); - ReturnOnFailure(apCommandObj->PrepareInvokeResponseCommand(path, prepareParams)); - - writer = apCommandObj->GetCommandDataIBTLVWriter(); - ReturnOnFailure(writer->Put(chip::TLV::ContextTag(kTestFieldId1), kTestFieldValue1)); - - ReturnOnFailure(writer->Put(chip::TLV::ContextTag(kTestFieldId2), kTestFieldValue2)); - - ReturnOnFailure(apCommandObj->FinishCommand()); + TestTLVDataEncoder testData; + apCommandObj->AddResponse(path, kTestCommandId, testData); } statusCodeFlipper = !statusCodeFlipper; } From 8a64366b0dcd28d023bacaca2a06f8cd178a7263 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 3 Jun 2024 12:35:58 -0400 Subject: [PATCH 035/162] Use EncodableToTLV in TestCommandInteraction (#33694) * An initial conversion. however we FAIL right now.... * ifdef to compare ok/fail * Fix usage of internal calls ... we want the re-shuffling of responses to happen * Restyle * Update src/app/tests/TestCommandInteraction.cpp Co-authored-by: Boris Zbarsky --------- Co-authored-by: Andrei Litvin Co-authored-by: Boris Zbarsky --- src/app/tests/TestCommandInteraction.cpp | 36 +++++++++++------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index 195580ce8702a5..dc6b6132341a63 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -87,6 +87,19 @@ constexpr CommandId kTestCommandIdFillResponseMessage = 7; constexpr CommandId kTestNonExistCommandId = 0; const app::CommandSender::TestOnlyMarker kCommandSenderTestOnlyMarker; + +class SimpleTLVPayload : public app::DataModel::EncodableToTLV +{ +public: + CHIP_ERROR EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const override + { + TLV::TLVType outerType; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outerType)); + ReturnErrorOnFailure(writer.PutBoolean(chip::TLV::ContextTag(1), true)); + return writer.EndContainer(outerType); + } +}; + } // namespace namespace app { @@ -199,12 +212,8 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPat } else { - const CommandHandler::InvokeResponseParameters prepareParams(aRequestCommandPath); - const ConcreteCommandPath responseCommandPath = aRequestCommandPath; - apCommandObj->PrepareInvokeResponseCommand(responseCommandPath, prepareParams); - chip::TLV::TLVWriter * writer = apCommandObj->GetCommandDataIBTLVWriter(); - writer->PutBoolean(chip::TLV::ContextTag(1), true); - apCommandObj->FinishCommand(); + SimpleTLVPayload payloadWriter; + apCommandObj->AddResponse(aRequestCommandPath, aRequestCommandPath.mCommandId, payloadWriter); } } @@ -597,8 +606,6 @@ void TestCommandInteraction::AddInvalidInvokeRequestData(nlTestSuite * apSuite, void TestCommandInteraction::AddInvokeResponseData(nlTestSuite * apSuite, void * apContext, CommandHandler * apCommandHandler, bool aNeedStatusCode, CommandId aResponseCommandId, CommandId aRequestCommandId) { - CHIP_ERROR err = CHIP_NO_ERROR; - constexpr EndpointId kTestEndpointId = 1; constexpr ClusterId kTestClusterId = 3; ConcreteCommandPath requestCommandPath = { kTestEndpointId, kTestClusterId, aRequestCommandId }; @@ -608,17 +615,8 @@ void TestCommandInteraction::AddInvokeResponseData(nlTestSuite * apSuite, void * } else { - const CommandHandler::InvokeResponseParameters prepareParams(requestCommandPath); - ConcreteCommandPath responseCommandPath = { kTestEndpointId, kTestClusterId, aResponseCommandId }; - err = apCommandHandler->PrepareInvokeResponseCommand(responseCommandPath, prepareParams); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - chip::TLV::TLVWriter * writer = apCommandHandler->GetCommandDataIBTLVWriter(); - - err = writer->PutBoolean(chip::TLV::ContextTag(1), true); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - err = apCommandHandler->FinishCommand(); + SimpleTLVPayload payloadWriter; + CHIP_ERROR err = apCommandHandler->AddResponseData(requestCommandPath, aResponseCommandId, payloadWriter); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } } From 5dd912f755f6374be063d41f8e0caac7247e64d2 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Mon, 3 Jun 2024 23:00:07 +0200 Subject: [PATCH 036/162] pw_unit_test migration: apps-1 and stub-refactoring (#33638) * Decoupling ember functions + some tests * Fix TearDown issue of some App Tests * adding more tests * Integrating comments * Rename ember-test-compatibility to test-interaction-model-api * adding ember test-utilities source files * restyled patch * integrating comments * restyled --- src/BUILD.gn | 1 + src/app/tests/BUILD.gn | 96 +- src/app/tests/TestAclAttribute.cpp | 43 +- .../TestAttributeAccessInterfaceCache.cpp | 88 +- .../tests/TestAttributePathExpandIterator.cpp | 137 +- .../TestAttributePersistenceProvider.cpp | 246 ++-- src/app/tests/TestAttributeValueDecoder.cpp | 58 +- src/app/tests/TestAttributeValueEncoder.cpp | 242 ++-- src/app/tests/TestBindingTable.cpp | 182 +-- src/app/tests/TestBuilderParser.cpp | 79 +- src/app/tests/TestDefaultICDClientStorage.cpp | 164 +-- src/app/tests/TestFailSafeContext.cpp | 102 +- src/app/tests/TestMessageDef.cpp | 1283 ++++++++--------- src/app/tests/TestNullable.cpp | 196 ++- src/app/tests/TestNumericAttributeTraits.cpp | 508 +++---- .../TestOperationalStateClusterObjects.cpp | 378 ++--- src/app/tests/TestPendingNotificationMap.cpp | 90 +- .../tests/TestPendingResponseTrackerImpl.cpp | 85 +- src/app/tests/TestPowerSourceCluster.cpp | 190 +-- src/app/tests/TestReadInteraction.cpp | 51 +- ...estSimpleSubscriptionResumptionStorage.cpp | 220 ++- src/app/tests/TestStatusIB.cpp | 125 +- src/app/tests/TestStatusResponseMessage.cpp | 96 +- .../tests/TestTestEventTriggerDelegate.cpp | 108 +- src/app/tests/TestTimeSyncDataProvider.cpp | 171 +-- src/app/tests/TestWriteInteraction.cpp | 30 +- src/app/tests/test-ember-api.cpp | 36 + src/app/tests/test-ember-api.h | 28 + src/app/tests/test-interaction-model-api.cpp | 139 ++ src/app/tests/test-interaction-model-api.h | 69 + .../openiotsdk/unit-tests/test_components.txt | 1 + .../unit-tests/test_components_nl.txt | 2 +- 32 files changed, 2323 insertions(+), 2921 deletions(-) create mode 100644 src/app/tests/test-ember-api.cpp create mode 100644 src/app/tests/test-ember-api.h create mode 100644 src/app/tests/test-interaction-model-api.cpp create mode 100644 src/app/tests/test-interaction-model-api.h diff --git a/src/BUILD.gn b/src/BUILD.gn index cf15f40ec00629..5f7d6cc95ab6ba 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -96,6 +96,7 @@ if (chip_build_tests) { if (chip_device_platform != "efr32") { tests += [ "${chip_root}/src/app/tests", + "${chip_root}/src/app/tests:tests_nltest", "${chip_root}/src/credentials/tests", "${chip_root}/src/lib/format/tests", "${chip_root}/src/lib/support/tests", diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 28408773e15edf..e8413b92026d9a 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -15,6 +15,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") import("//build_overrides/nlunit_test.gni") +import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/app/icd/icd.gni") @@ -37,9 +38,10 @@ static_library("helpers") { "${chip_root}/src/access", "${chip_root}/src/app", "${chip_root}/src/lib/support", - "${chip_root}/src/messaging/tests:helpers", "${chip_root}/src/transport/raw/tests:helpers", ] + + public_deps = [ "${chip_root}/src/messaging/tests:helpers" ] } source_set("binding-test-srcs") { @@ -119,31 +121,33 @@ source_set("operational-state-test-srcs") { ] } -chip_test_suite_using_nltest("tests") { +source_set("app-test-stubs") { + sources = [ + "test-ember-api.cpp", + "test-ember-api.h", + "test-interaction-model-api.cpp", + "test-interaction-model-api.h", + ] + public_configs = [ "${chip_root}/src/lib/support/pw_log_chip:config" ] + + public_deps = [ + "${chip_root}/src/app/util/mock:mock_ember", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + ] +} + +chip_test_suite("tests") { output_name = "libAppTests" test_sources = [ - "TestAclAttribute.cpp", - "TestAclEvent.cpp", "TestAttributeAccessInterfaceCache.cpp", "TestAttributePathExpandIterator.cpp", "TestAttributePersistenceProvider.cpp", "TestAttributeValueDecoder.cpp", "TestAttributeValueEncoder.cpp", - "TestBasicCommandPathRegistry.cpp", "TestBindingTable.cpp", "TestBuilderParser.cpp", - "TestClusterInfo.cpp", - "TestCommandInteraction.cpp", - "TestCommandPathParams.cpp", - "TestConcreteAttributePath.cpp", - "TestDataModelSerialization.cpp", - "TestDefaultOTARequestorStorage.cpp", - "TestEventLoggingNoUTCTime.cpp", - "TestEventOverflow.cpp", - "TestEventPathParams.cpp", - "TestFabricScopedEventLogging.cpp", - "TestInteractionModelEngine.cpp", "TestMessageDef.cpp", "TestNullable.cpp", "TestNumericAttributeTraits.cpp", @@ -151,15 +155,10 @@ chip_test_suite_using_nltest("tests") { "TestPendingNotificationMap.cpp", "TestPendingResponseTrackerImpl.cpp", "TestPowerSourceCluster.cpp", - "TestReadInteraction.cpp", - "TestReportScheduler.cpp", - "TestReportingEngine.cpp", "TestStatusIB.cpp", "TestStatusResponseMessage.cpp", "TestTestEventTriggerDelegate.cpp", "TestTimeSyncDataProvider.cpp", - "TestTimedHandler.cpp", - "TestWriteInteraction.cpp", ] if (!chip_fake_platform) { @@ -171,6 +170,56 @@ chip_test_suite_using_nltest("tests") { test_sources += [ "TestDefaultICDClientStorage.cpp" ] } + if (chip_persist_subscriptions) { + test_sources += [ "TestSimpleSubscriptionResumptionStorage.cpp" ] + } + + cflags = [ "-Wconversion" ] + + public_deps = [ + ":app-test-stubs", + ":binding-test-srcs", + ":operational-state-test-srcs", + ":ota-requestor-test-srcs", + ":power-cluster-test-srcs", + ":time-sync-data-provider-test-srcs", + "${chip_root}/src/app", + "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/icd/client:manager", + "${chip_root}/src/app/tests:helpers", + "${chip_root}/src/app/util/mock:mock_ember", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", + "${chip_root}/src/lib/support:test_utils", + "${chip_root}/src/lib/support:testing", + ] +} + +chip_test_suite_using_nltest("tests_nltest") { + output_name = "libAppTestsNL" + + test_sources = [ + "TestAclAttribute.cpp", + "TestAclEvent.cpp", + "TestBasicCommandPathRegistry.cpp", + "TestClusterInfo.cpp", + "TestCommandInteraction.cpp", + "TestCommandPathParams.cpp", + "TestConcreteAttributePath.cpp", + "TestDataModelSerialization.cpp", + "TestDefaultOTARequestorStorage.cpp", + "TestEventLoggingNoUTCTime.cpp", + "TestEventOverflow.cpp", + "TestEventPathParams.cpp", + "TestFabricScopedEventLogging.cpp", + "TestInteractionModelEngine.cpp", + "TestReadInteraction.cpp", + "TestReportScheduler.cpp", + "TestReportingEngine.cpp", + "TestTimedHandler.cpp", + "TestWriteInteraction.cpp", + ] + # # On NRF platforms, the allocation of a large number of pbufs in this test # to exercise chunking causes it to run out of memory. For now, disable it there. @@ -192,6 +241,7 @@ chip_test_suite_using_nltest("tests") { cflags = [ "-Wconversion" ] public_deps = [ + ":app-test-stubs", ":binding-test-srcs", ":operational-state-test-srcs", ":ota-requestor-test-srcs", @@ -227,8 +277,4 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/messaging/tests/echo:common", ] } - - if (chip_persist_subscriptions) { - test_sources += [ "TestSimpleSubscriptionResumptionStorage.cpp" ] - } } diff --git a/src/app/tests/TestAclAttribute.cpp b/src/app/tests/TestAclAttribute.cpp index 427b257f9efd7c..1c928515dc5d74 100644 --- a/src/app/tests/TestAclAttribute.cpp +++ b/src/app/tests/TestAclAttribute.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -46,18 +47,13 @@ namespace { using namespace chip; using namespace chip::Access; -chip::ClusterId kTestClusterId = 1; -chip::ClusterId kTestDeniedClusterId1 = 1000; -chip::ClusterId kTestDeniedClusterId2 = 3; -chip::EndpointId kTestEndpointId = 4; - class TestAccessControlDelegate : public AccessControl::Delegate { public: CHIP_ERROR Check(const SubjectDescriptor & subjectDescriptor, const chip::Access::RequestPath & requestPath, Privilege requestPrivilege) override { - if (requestPath.cluster == kTestDeniedClusterId2) + if (requestPath.cluster == chip::Test::kTestDeniedClusterId2) { return CHIP_ERROR_ACCESS_DENIED; } @@ -125,21 +121,6 @@ class MockInteractionModelApp : public chip::app::ReadClient::Callback namespace chip { namespace app { -bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath) -{ - return aPath.mClusterId != kTestDeniedClusterId1; -} - -Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) -{ - if (aPath.mClusterId == kTestDeniedClusterId1) - { - return Protocols::InteractionModel::Status::UnsupportedCluster; - } - - return Protocols::InteractionModel::Status::Success; -} - class TestAclAttribute { public: @@ -166,12 +147,12 @@ void TestAclAttribute::TestACLDeniedAttribute(nlTestSuite * apSuite, void * apCo chip::app::ReadClient::InteractionType::Subscribe); chip::app::AttributePathParams attributePathParams[2]; - attributePathParams[0].mEndpointId = kTestEndpointId; - attributePathParams[0].mClusterId = kTestDeniedClusterId1; + attributePathParams[0].mEndpointId = chip::Test::kTestEndpointId; + attributePathParams[0].mClusterId = chip::Test::kTestDeniedClusterId1; attributePathParams[0].mAttributeId = 1; - attributePathParams[1].mEndpointId = kTestEndpointId; - attributePathParams[1].mClusterId = kTestDeniedClusterId1; + attributePathParams[1].mEndpointId = chip::Test::kTestEndpointId; + attributePathParams[1].mClusterId = chip::Test::kTestDeniedClusterId1; attributePathParams[1].mAttributeId = 2; ReadPrepareParams readPrepareParams(ctx.GetSessionBobToAlice()); @@ -194,10 +175,10 @@ void TestAclAttribute::TestACLDeniedAttribute(nlTestSuite * apSuite, void * apCo chip::app::AttributePathParams attributePathParams[2]; - attributePathParams[0].mClusterId = kTestDeniedClusterId2; + attributePathParams[0].mClusterId = chip::Test::kTestDeniedClusterId2; attributePathParams[0].mAttributeId = 1; - attributePathParams[1].mClusterId = kTestDeniedClusterId2; + attributePathParams[1].mClusterId = chip::Test::kTestDeniedClusterId2; attributePathParams[1].mAttributeId = 2; ReadPrepareParams readPrepareParams(ctx.GetSessionBobToAlice()); @@ -219,12 +200,12 @@ void TestAclAttribute::TestACLDeniedAttribute(nlTestSuite * apSuite, void * apCo chip::app::ReadClient::InteractionType::Subscribe); chip::app::AttributePathParams attributePathParams[2]; - attributePathParams[0].mEndpointId = kTestEndpointId; - attributePathParams[0].mClusterId = kTestDeniedClusterId1; + attributePathParams[0].mEndpointId = chip::Test::kTestEndpointId; + attributePathParams[0].mClusterId = chip::Test::kTestDeniedClusterId1; attributePathParams[0].mAttributeId = 1; - attributePathParams[1].mEndpointId = kTestEndpointId; - attributePathParams[1].mClusterId = kTestClusterId; + attributePathParams[1].mEndpointId = chip::Test::kTestEndpointId; + attributePathParams[1].mClusterId = chip::Test::kTestClusterId; attributePathParams[1].mAttributeId = 2; ReadPrepareParams readPrepareParams(ctx.GetSessionBobToAlice()); diff --git a/src/app/tests/TestAttributeAccessInterfaceCache.cpp b/src/app/tests/TestAttributeAccessInterfaceCache.cpp index 47b8e6d921de94..28aa91db42b16f 100644 --- a/src/app/tests/TestAttributeAccessInterfaceCache.cpp +++ b/src/app/tests/TestAttributeAccessInterfaceCache.cpp @@ -18,15 +18,15 @@ #include #include -#include -#include +#include +#include using namespace chip; using namespace chip::app; namespace { -void TestBasicLifecycle(nlTestSuite * inSuite, void * inContext) +TEST(TestAttributeAccessInterfaceCache, TestBasicLifecycle) { using CacheResult = AttributeAccessInterfaceCache::CacheResult; @@ -44,86 +44,58 @@ void TestBasicLifecycle(nlTestSuite * inSuite, void * inContext) // Cache can keep track of at least 1 entry, AttributeAccessInterface * entry = nullptr; - NL_TEST_ASSERT(inSuite, cache.Get(1, 1, &entry) == CacheResult::kCacheMiss); - NL_TEST_ASSERT(inSuite, entry == nullptr); + EXPECT_EQ(cache.Get(1, 1, &entry), CacheResult::kCacheMiss); + EXPECT_EQ(entry, nullptr); cache.MarkUsed(1, 1, accessor1); - NL_TEST_ASSERT(inSuite, cache.Get(1, 1, &entry) == CacheResult::kDefinitelyUsed); - NL_TEST_ASSERT(inSuite, entry == accessor1); + EXPECT_EQ(cache.Get(1, 1, &entry), CacheResult::kDefinitelyUsed); + EXPECT_EQ(entry, accessor1); entry = nullptr; - NL_TEST_ASSERT(inSuite, cache.Get(1, 2, &entry) == CacheResult::kCacheMiss); - NL_TEST_ASSERT(inSuite, entry == nullptr); - NL_TEST_ASSERT(inSuite, cache.Get(2, 1, &entry) == CacheResult::kCacheMiss); - NL_TEST_ASSERT(inSuite, entry == nullptr); + EXPECT_EQ(cache.Get(1, 2, &entry), CacheResult::kCacheMiss); + EXPECT_EQ(entry, nullptr); + EXPECT_EQ(cache.Get(2, 1, &entry), CacheResult::kCacheMiss); + EXPECT_EQ(entry, nullptr); cache.MarkUsed(1, 2, accessor1); entry = nullptr; - NL_TEST_ASSERT(inSuite, cache.Get(1, 2, &entry) == CacheResult::kDefinitelyUsed); - NL_TEST_ASSERT(inSuite, entry == accessor1); - NL_TEST_ASSERT(inSuite, cache.Get(2, 1, &entry) == CacheResult::kCacheMiss); + EXPECT_EQ(cache.Get(1, 2, &entry), CacheResult::kDefinitelyUsed); + EXPECT_EQ(entry, accessor1); + EXPECT_EQ(cache.Get(2, 1, &entry), CacheResult::kCacheMiss); cache.MarkUsed(1, 2, accessor2); entry = nullptr; - NL_TEST_ASSERT(inSuite, cache.Get(1, 2, &entry) == CacheResult::kDefinitelyUsed); - NL_TEST_ASSERT(inSuite, entry == accessor2); + EXPECT_EQ(cache.Get(1, 2, &entry), CacheResult::kDefinitelyUsed); + EXPECT_EQ(entry, accessor2); // The following should not crash (e.g. output not used if nullptr). - NL_TEST_ASSERT(inSuite, cache.Get(1, 2, nullptr) == CacheResult::kDefinitelyUsed); + EXPECT_EQ(cache.Get(1, 2, nullptr), CacheResult::kDefinitelyUsed); // Setting used to nullptr == does not mark used. cache.MarkUsed(1, 2, nullptr); entry = nullptr; - NL_TEST_ASSERT(inSuite, cache.Get(1, 2, &entry) == CacheResult::kCacheMiss); - NL_TEST_ASSERT(inSuite, entry == nullptr); + EXPECT_EQ(cache.Get(1, 2, &entry), CacheResult::kCacheMiss); + EXPECT_EQ(entry, nullptr); cache.Invalidate(); - NL_TEST_ASSERT(inSuite, cache.Get(1, 1, &entry) == CacheResult::kCacheMiss); - NL_TEST_ASSERT(inSuite, entry == nullptr); - NL_TEST_ASSERT(inSuite, cache.Get(1, 2, &entry) == CacheResult::kCacheMiss); - NL_TEST_ASSERT(inSuite, cache.Get(2, 1, &entry) == CacheResult::kCacheMiss); + EXPECT_EQ(cache.Get(1, 1, &entry), CacheResult::kCacheMiss); + EXPECT_EQ(entry, nullptr); + EXPECT_EQ(cache.Get(1, 2, &entry), CacheResult::kCacheMiss); + EXPECT_EQ(cache.Get(2, 1, &entry), CacheResult::kCacheMiss); // Marking unused works, keeps single entry, and is invalidated when invalidated fully. - NL_TEST_ASSERT(inSuite, cache.Get(2, 2, nullptr) != CacheResult::kDefinitelyUnused); - NL_TEST_ASSERT(inSuite, cache.Get(3, 3, nullptr) != CacheResult::kDefinitelyUnused); + EXPECT_NE(cache.Get(2, 2, nullptr), CacheResult::kDefinitelyUnused); + EXPECT_NE(cache.Get(3, 3, nullptr), CacheResult::kDefinitelyUnused); cache.MarkUnused(2, 2); - NL_TEST_ASSERT(inSuite, cache.Get(2, 2, nullptr) == CacheResult::kDefinitelyUnused); - NL_TEST_ASSERT(inSuite, cache.Get(3, 3, nullptr) != CacheResult::kDefinitelyUnused); + EXPECT_EQ(cache.Get(2, 2, nullptr), CacheResult::kDefinitelyUnused); + EXPECT_NE(cache.Get(3, 3, nullptr), CacheResult::kDefinitelyUnused); cache.MarkUnused(3, 3); - NL_TEST_ASSERT(inSuite, cache.Get(2, 2, nullptr) != CacheResult::kDefinitelyUnused); - NL_TEST_ASSERT(inSuite, cache.Get(3, 3, nullptr) == CacheResult::kDefinitelyUnused); + EXPECT_NE(cache.Get(2, 2, nullptr), CacheResult::kDefinitelyUnused); + EXPECT_EQ(cache.Get(3, 3, nullptr), CacheResult::kDefinitelyUnused); cache.Invalidate(); - NL_TEST_ASSERT(inSuite, cache.Get(3, 3, nullptr) != CacheResult::kDefinitelyUnused); + EXPECT_NE(cache.Get(3, 3, nullptr), CacheResult::kDefinitelyUnused); } - -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("Basic AttributeAccessInterfaceCache lifecycle works", TestBasicLifecycle), - NL_TEST_SENTINEL() -}; -// clang-format on - } // namespace - -int TestAttributeAccessInterfaceCache() -{ - // clang-format off - nlTestSuite theSuite = - { - "Test for AttributeAccessInterface cache utility", - &sTests[0], - nullptr, - nullptr - }; - // clang-format on - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestAttributeAccessInterfaceCache) diff --git a/src/app/tests/TestAttributePathExpandIterator.cpp b/src/app/tests/TestAttributePathExpandIterator.cpp index e5505320193b81..032581bff16f8a 100644 --- a/src/app/tests/TestAttributePathExpandIterator.cpp +++ b/src/app/tests/TestAttributePathExpandIterator.cpp @@ -26,10 +26,10 @@ #include #include #include -#include #include -#include +#include +#include using namespace chip; using namespace chip::Test; @@ -39,7 +39,7 @@ namespace { using P = app::ConcreteAttributePath; -void TestAllWildcard(nlTestSuite * apSuite, void * apContext) +TEST(TestAttributePathExpandIterator, TestAllWildcard) { SingleLinkedListNode clusInfo; @@ -136,17 +136,18 @@ void TestAllWildcard(nlTestSuite * apSuite, void * apContext) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); - NL_TEST_ASSERT(apSuite, index < ArraySize(paths) && paths[index] == path); + EXPECT_LT(index, ArraySize(paths)); + EXPECT_EQ(paths[index], path); index++; } - NL_TEST_ASSERT(apSuite, index == ArraySize(paths)); + EXPECT_EQ(index, ArraySize(paths)); } -void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) +TEST(TestAttributePathExpandIterator, TestWildcardEndpoint) { SingleLinkedListNode clusInfo; - clusInfo.mValue.mClusterId = Test::MockClusterId(3); - clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); + clusInfo.mValue.mClusterId = chip::Test::MockClusterId(3); + clusInfo.mValue.mAttributeId = chip::Test::MockAttributeId(3); app::ConcreteAttributePath path; P paths[] = { @@ -159,16 +160,17 @@ void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); - NL_TEST_ASSERT(apSuite, index < ArraySize(paths) && paths[index] == path); + EXPECT_LT(index, ArraySize(paths)); + EXPECT_EQ(paths[index], path); index++; } - NL_TEST_ASSERT(apSuite, index == ArraySize(paths)); + EXPECT_EQ(index, ArraySize(paths)); } -void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) +TEST(TestAttributePathExpandIterator, TestWildcardCluster) { SingleLinkedListNode clusInfo; - clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo.mValue.mEndpointId = chip::Test::kMockEndpoint3; clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; app::ConcreteAttributePath path; @@ -185,16 +187,17 @@ void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); - NL_TEST_ASSERT(apSuite, index < ArraySize(paths) && paths[index] == path); + EXPECT_LT(index, ArraySize(paths)); + EXPECT_EQ(paths[index], path); index++; } - NL_TEST_ASSERT(apSuite, index == ArraySize(paths)); + EXPECT_EQ(index, ArraySize(paths)); } -void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void * apContext) +TEST(TestAttributePathExpandIterator, TestWildcardClusterGlobalAttributeNotInMetadata) { SingleLinkedListNode clusInfo; - clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo.mValue.mEndpointId = chip::Test::kMockEndpoint3; clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::AttributeList::Id; app::ConcreteAttributePath path; @@ -211,17 +214,18 @@ void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); - NL_TEST_ASSERT(apSuite, index < ArraySize(paths) && paths[index] == path); + EXPECT_LT(index, ArraySize(paths)); + EXPECT_EQ(paths[index], path); index++; } - NL_TEST_ASSERT(apSuite, index == ArraySize(paths)); + EXPECT_EQ(index, ArraySize(paths)); } -void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) +TEST(TestAttributePathExpandIterator, TestWildcardAttribute) { SingleLinkedListNode clusInfo; - clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; - clusInfo.mValue.mClusterId = Test::MockClusterId(3); + clusInfo.mValue.mEndpointId = chip::Test::kMockEndpoint2; + clusInfo.mValue.mClusterId = chip::Test::MockClusterId(3); app::ConcreteAttributePath path; P paths[] = { @@ -244,18 +248,19 @@ void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); - NL_TEST_ASSERT(apSuite, index < ArraySize(paths) && paths[index] == path); + EXPECT_LT(index, ArraySize(paths)); + EXPECT_EQ(paths[index], path); index++; } - NL_TEST_ASSERT(apSuite, index == ArraySize(paths)); + EXPECT_EQ(index, ArraySize(paths)); } -void TestNoWildcard(nlTestSuite * apSuite, void * apContext) +TEST(TestAttributePathExpandIterator, TestNoWildcard) { SingleLinkedListNode clusInfo; - clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; - clusInfo.mValue.mClusterId = Test::MockClusterId(3); - clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); + clusInfo.mValue.mEndpointId = chip::Test::kMockEndpoint2; + clusInfo.mValue.mClusterId = chip::Test::MockClusterId(3); + clusInfo.mValue.mAttributeId = chip::Test::MockAttributeId(3); app::ConcreteAttributePath path; P paths[] = { @@ -268,33 +273,34 @@ void TestNoWildcard(nlTestSuite * apSuite, void * apContext) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); - NL_TEST_ASSERT(apSuite, index < ArraySize(paths) && paths[index] == path); + EXPECT_LT(index, ArraySize(paths)); + EXPECT_EQ(paths[index], path); index++; } - NL_TEST_ASSERT(apSuite, index == ArraySize(paths)); + EXPECT_EQ(index, ArraySize(paths)); } -void TestMultipleClusInfo(nlTestSuite * apSuite, void * apContext) +TEST(TestAttributePathExpandIterator, TestMultipleClusInfo) { SingleLinkedListNode clusInfo1; SingleLinkedListNode clusInfo2; - clusInfo2.mValue.mClusterId = Test::MockClusterId(3); - clusInfo2.mValue.mAttributeId = Test::MockAttributeId(3); + clusInfo2.mValue.mClusterId = chip::Test::MockClusterId(3); + clusInfo2.mValue.mAttributeId = chip::Test::MockAttributeId(3); SingleLinkedListNode clusInfo3; - clusInfo3.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo3.mValue.mEndpointId = chip::Test::kMockEndpoint3; clusInfo3.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; SingleLinkedListNode clusInfo4; - clusInfo4.mValue.mEndpointId = Test::kMockEndpoint2; - clusInfo4.mValue.mClusterId = Test::MockClusterId(3); + clusInfo4.mValue.mEndpointId = chip::Test::kMockEndpoint2; + clusInfo4.mValue.mClusterId = chip::Test::MockClusterId(3); SingleLinkedListNode clusInfo5; - clusInfo5.mValue.mEndpointId = Test::kMockEndpoint2; - clusInfo5.mValue.mClusterId = Test::MockClusterId(3); - clusInfo5.mValue.mAttributeId = Test::MockAttributeId(3); + clusInfo5.mValue.mEndpointId = chip::Test::kMockEndpoint2; + clusInfo5.mValue.mClusterId = chip::Test::MockClusterId(3); + clusInfo5.mValue.mAttributeId = chip::Test::MockAttributeId(3); clusInfo1.mpNext = &clusInfo2; clusInfo2.mpNext = &clusInfo3; @@ -411,60 +417,11 @@ void TestMultipleClusInfo(nlTestSuite * apSuite, void * apContext) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); - NL_TEST_ASSERT(apSuite, index < ArraySize(paths) && paths[index] == path); + EXPECT_LT(index, ArraySize(paths)); + EXPECT_EQ(paths[index], path); index++; } - NL_TEST_ASSERT(apSuite, index == ArraySize(paths)); + EXPECT_EQ(index, ArraySize(paths)); } -static int TestSetup(void * inContext) -{ - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - return SUCCESS; -} - -/** - * Test Suite. It lists all the test functions. - */ - -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestAllWildcard", TestAllWildcard), - NL_TEST_DEF("TestWildcardEndpoint", TestWildcardEndpoint), - NL_TEST_DEF("TestWildcardCluster", TestWildcardCluster), - NL_TEST_DEF("TestWildcardClusterGlobalAttributeNotInMetadata", - TestWildcardClusterGlobalAttributeNotInMetadata), - NL_TEST_DEF("TestWildcardAttribute", TestWildcardAttribute), - NL_TEST_DEF("TestNoWildcard", TestNoWildcard), - NL_TEST_DEF("TestMultipleClusInfo", TestMultipleClusInfo), - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -nlTestSuite sSuite = -{ - "TestAttributePathExpandIterator", - &sTests[0], - TestSetup, - TestTeardown, -}; -// clang-format on - } // namespace - -int TestAttributePathExpandIterator() -{ - nlTestRunner(&sSuite, nullptr); - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestAttributePathExpandIterator) diff --git a/src/app/tests/TestAttributePersistenceProvider.cpp b/src/app/tests/TestAttributePersistenceProvider.cpp index 9c75715d14e03d..7ae40b52402fe0 100644 --- a/src/app/tests/TestAttributePersistenceProvider.cpp +++ b/src/app/tests/TestAttributePersistenceProvider.cpp @@ -16,17 +16,11 @@ * limitations under the License. */ -/** - * @file - * This file implements unit tests for AttributePersistenceProvider - * - */ - #include #include +#include #include -#include -#include +#include using namespace chip; using namespace chip::app; @@ -36,48 +30,36 @@ const ConcreteAttributePath TestConcretePath = ConcreteAttributePath(1, 1, 1); namespace { -/** - * Set up the test suite. - */ -int Test_Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - VerifyOrReturnError(error == CHIP_NO_ERROR, FAILURE); - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int Test_Teardown(void * inContext) +class TestAttributePersistenceProvider : public ::testing::Test { - chip::Platform::MemoryShutdown(); - return SUCCESS; -} +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; /** * Tests the storage and retrival of data from the KVS as ByteSpan */ -void TestStorageAndRetrivalByteSpans(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAttributePersistenceProvider, TestStorageAndRetrivalByteSpans) { TestPersistentStorageDelegate storageDelegate; DefaultAttributePersistenceProvider persistenceProvider; // Init ChipError err = persistenceProvider.Init(&storageDelegate); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Store ByteSpan of size 1 uint8_t valueArray[1] = { 0x42 }; ByteSpan value(valueArray); err = persistenceProvider.SafeWriteValue(TestConcretePath, value); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint8_t getArray[1]; MutableByteSpan valueReadBack(getArray); err = persistenceProvider.SafeReadValue(TestConcretePath, valueReadBack); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, std::equal(valueReadBack.begin(), valueReadBack.end(), value.begin(), value.end())); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(std::equal(valueReadBack.begin(), valueReadBack.end(), value.begin(), value.end())); // Finishing persistenceProvider.Shutdown(); @@ -89,17 +71,16 @@ void TestStorageAndRetrivalByteSpans(nlTestSuite * inSuite, void * inContext) * @param testValue The test value to store and retrieve */ template -void testHelperStorageAndRetrivalScalarValues(nlTestSuite * inSuite, DefaultAttributePersistenceProvider & persistenceProvider, - T testValue) +void testHelperStorageAndRetrivalScalarValues(DefaultAttributePersistenceProvider & persistenceProvider, T testValue) { CHIP_ERROR err = persistenceProvider.WriteScalarValue(TestConcretePath, testValue); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); T valueReadBack = 0; err = persistenceProvider.ReadScalarValue(TestConcretePath, valueReadBack); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, valueReadBack == testValue); + EXPECT_EQ(valueReadBack, testValue); } /** @@ -108,55 +89,55 @@ void testHelperStorageAndRetrivalScalarValues(nlTestSuite * inSuite, DefaultAttr * @param testValue The test value to store and retrieve */ template -void testHelperStorageAndRetrivalScalarValues(nlTestSuite * inSuite, DefaultAttributePersistenceProvider & persistenceProvider, +void testHelperStorageAndRetrivalScalarValues(DefaultAttributePersistenceProvider & persistenceProvider, DataModel::Nullable testValue) { CHIP_ERROR err = persistenceProvider.WriteScalarValue(TestConcretePath, testValue); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DataModel::Nullable valueReadBack(0); err = persistenceProvider.ReadScalarValue(TestConcretePath, valueReadBack); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, valueReadBack == testValue); + EXPECT_EQ(valueReadBack, testValue); } /** * Tests the storage and retrival of data from the KVS of types bool, uint8_t, uint16_t, uint32_t, uint64_t. */ -void TestStorageAndRetrivalScalarValues(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAttributePersistenceProvider, TestStorageAndRetrivalScalarValues) { TestPersistentStorageDelegate storageDelegate; DefaultAttributePersistenceProvider persistenceProvider; // Init CHIP_ERROR err = persistenceProvider.Init(&storageDelegate); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Test bool - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, bool(true)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, bool(false)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, bool(true)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, bool(true)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, bool(false)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, bool(true)); // Test uint8_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint8_t(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint8_t(42)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint8_t(0xff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint8_t(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint8_t(42)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint8_t(0xff)); // Test uint16_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint16_t(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint16_t(0x0101)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint16_t(0xffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint16_t(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint16_t(0x0101)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint16_t(0xffff)); // Test uint32_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint32_t(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint32_t(0x01ffff)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint32_t(0xffffffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint32_t(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint32_t(0x01ffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint32_t(0xffffffff)); // Test uint64_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint64_t(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint64_t(0x0100000001)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, uint64_t(0xffffffffffffffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint64_t(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint64_t(0x0100000001)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, uint64_t(0xffffffffffffffff)); // Finishing persistenceProvider.Shutdown(); @@ -165,34 +146,34 @@ void TestStorageAndRetrivalScalarValues(nlTestSuite * inSuite, void * inContext) /** * Tests the storage and retrival of data from the KVS of types int8_t, int16_t, int32_t, int64_t. */ -void TestStorageAndRetrivalSignedScalarValues(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAttributePersistenceProvider, TestStorageAndRetrivalSignedScalarValues) { TestPersistentStorageDelegate storageDelegate; DefaultAttributePersistenceProvider persistenceProvider; // Init CHIP_ERROR err = persistenceProvider.Init(&storageDelegate); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Test int8_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int8_t(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int8_t(42)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int8_t(-127)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int8_t(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int8_t(42)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int8_t(-127)); // Test int16_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int16_t(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int16_t(0x7fff)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int16_t(0x8000)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int16_t(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int16_t(0x7fff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int16_t(0x8000)); // Test int32_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int32_t(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int32_t(0x7fffffff)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int32_t(0x80000000)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int32_t(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int32_t(0x7fffffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int32_t(0x80000000)); // Test int64_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int64_t(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int64_t(0x7fffffffffffffff)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, int64_t(0x8000000000000000)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int64_t(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int64_t(0x7fffffffffffffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, int64_t(0x8000000000000000)); // Finishing persistenceProvider.Shutdown(); @@ -201,54 +182,54 @@ void TestStorageAndRetrivalSignedScalarValues(nlTestSuite * inSuite, void * inCo /** * Tests the storage and retrival of data from the KVS of DataModel::Nullable types bool, uint8_t, uint16_t, uint32_t, uint64_t. */ -void TestStorageAndRetrivalNullableScalarValues(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAttributePersistenceProvider, TestStorageAndRetrivalNullableScalarValues) { TestPersistentStorageDelegate storageDelegate; DefaultAttributePersistenceProvider persistenceProvider; // Init CHIP_ERROR err = persistenceProvider.Init(&storageDelegate); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Test bool - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(true)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(false)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(true)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(true)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(false)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(true)); auto nullValBool = DataModel::Nullable(); nullValBool.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullValBool); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullValBool); // Test uint8_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(42)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0xfe)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(42)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0xfe)); auto nullVal8 = DataModel::Nullable(); nullVal8.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullVal8); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullVal8); // Test uint16_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0x0101)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0xfffe)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0x0101)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0xfffe)); auto nullVal16 = DataModel::Nullable(); nullVal16.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullVal16); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullVal16); // Test uint32_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0x01ffff)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0xfffffffe)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0x01ffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0xfffffffe)); auto nullVal32 = DataModel::Nullable(); nullVal32.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullVal32); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullVal32); // Test uint64_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0x0100000001)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0xfffffffffffffffe)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0x0100000001)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0xfffffffffffffffe)); auto nullVal64 = DataModel::Nullable(); nullVal64.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullVal64); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullVal64); // Finishing persistenceProvider.Shutdown(); @@ -257,46 +238,46 @@ void TestStorageAndRetrivalNullableScalarValues(nlTestSuite * inSuite, void * in /** * Tests the storage and retrival of data from the KVS of DataModel::Nullable types int8_t, int16_t, int32_t, int64_t. */ -void TestStorageAndRetrivalSignedNullableScalarValues(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAttributePersistenceProvider, TestStorageAndRetrivalSignedNullableScalarValues) { TestPersistentStorageDelegate storageDelegate; DefaultAttributePersistenceProvider persistenceProvider; // Init CHIP_ERROR err = persistenceProvider.Init(&storageDelegate); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Test int8_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(42)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(-127)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(42)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(-127)); auto nullVal8 = DataModel::Nullable(); nullVal8.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullVal8); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullVal8); // Test int16_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0x7fff)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(-0x7fff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0x7fff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(-0x7fff)); auto nullVal16 = DataModel::Nullable(); nullVal16.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullVal16); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullVal16); // Test int32_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0x7fffffff)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(-0x7fffffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0x7fffffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(-0x7fffffff)); auto nullVal32 = DataModel::Nullable(); nullVal32.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullVal32); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullVal32); // Test int64_t - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(0x7fffffffffffffff)); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, DataModel::Nullable(-0x7fffffffffffffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(0x7fffffffffffffff)); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, DataModel::Nullable(-0x7fffffffffffffff)); auto nullVal64 = DataModel::Nullable(); nullVal64.SetNull(); - testHelperStorageAndRetrivalScalarValues(inSuite, persistenceProvider, nullVal64); + testHelperStorageAndRetrivalScalarValues(persistenceProvider, nullVal64); // Finishing persistenceProvider.Shutdown(); @@ -305,85 +286,62 @@ void TestStorageAndRetrivalSignedNullableScalarValues(nlTestSuite * inSuite, voi /** * Test that the correct error is given when trying to read a value with a buffer that's too small. */ -void TestBufferTooSmallErrors(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAttributePersistenceProvider, TestBufferTooSmallErrors) { TestPersistentStorageDelegate storageDelegate; DefaultAttributePersistenceProvider persistenceProvider; // Init CHIP_ERROR err = persistenceProvider.Init(&storageDelegate); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Store large data uint8_t valueArray[9] = { 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42 }; ByteSpan value(valueArray); err = persistenceProvider.SafeWriteValue(TestConcretePath, value); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Confirm the daya is there uint8_t getArray[9]; MutableByteSpan valueReadBack(getArray); err = persistenceProvider.SafeReadValue(TestConcretePath, valueReadBack); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, std::equal(valueReadBack.begin(), valueReadBack.end(), value.begin(), value.end())); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(std::equal(valueReadBack.begin(), valueReadBack.end(), value.begin(), value.end())); // Fail to get data as ByteSpace of size 0 uint8_t getArray0[0]; MutableByteSpan valueReadBackByteSpan0(getArray0, 0); err = persistenceProvider.SafeReadValue(TestConcretePath, valueReadBackByteSpan0); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); // Fail to get data as ByteSpace of size > 0 but < required uint8_t getArray8[8]; MutableByteSpan valueReadBackByteSpan8(getArray8, sizeof(getArray8)); err = persistenceProvider.SafeReadValue(TestConcretePath, valueReadBackByteSpan8); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); // Fail to get value as uint8_t uint8_t valueReadBack8; err = persistenceProvider.ReadScalarValue(TestConcretePath, valueReadBack8); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); // Fail to get value as uint16_t uint16_t valueReadBack16; err = persistenceProvider.ReadScalarValue(TestConcretePath, valueReadBack16); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); // Fail to get value as uint32_t uint32_t valueReadBack32; err = persistenceProvider.ReadScalarValue(TestConcretePath, valueReadBack32); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); // Fail to get value as uint64_t uint64_t valueReadBack64; err = persistenceProvider.ReadScalarValue(TestConcretePath, valueReadBack64); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); // Finishing persistenceProvider.Shutdown(); } } // anonymous namespace - -namespace { -const nlTest sTests[] = { - NL_TEST_DEF("Storage and retrival of ByteSpans", TestStorageAndRetrivalByteSpans), - NL_TEST_DEF("Storage and retrival of unsigned scalar values", TestStorageAndRetrivalScalarValues), - NL_TEST_DEF("Storage and retrival of signed scalar values", TestStorageAndRetrivalSignedScalarValues), - NL_TEST_DEF("Storage and retrival of unsigned nullable scalar values", TestStorageAndRetrivalNullableScalarValues), - NL_TEST_DEF("Storage and retrival of signed nullable scalar values", TestStorageAndRetrivalSignedNullableScalarValues), - NL_TEST_DEF("Small buffer errors", TestBufferTooSmallErrors), - NL_TEST_SENTINEL() -}; -} - -int TestAttributePersistenceProvider() -{ - nlTestSuite theSuite = { "AttributePersistenceProvider", &sTests[0], Test_Setup, Test_Teardown }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestAttributePersistenceProvider) diff --git a/src/app/tests/TestAttributeValueDecoder.cpp b/src/app/tests/TestAttributeValueDecoder.cpp index c25738588e6afa..b48cd230ea2537 100644 --- a/src/app/tests/TestAttributeValueDecoder.cpp +++ b/src/app/tests/TestAttributeValueDecoder.cpp @@ -16,18 +16,13 @@ * limitations under the License. */ -/** - * @file - * This file implements unit tests for CommandPathParams - * - */ +#include +#include #include #include #include #include -#include -#include using namespace chip; using namespace chip::app; @@ -62,7 +57,7 @@ struct TestSetup TLVWriter writer; }; -void TestOverwriteFabricIndexInStruct(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueDecoder, TestOverwriteFabricIndexInStruct) { TestSetup setup; CHIP_ERROR err; @@ -73,29 +68,29 @@ void TestOverwriteFabricIndexInStruct(nlTestSuite * aSuite, void * aContext) item.fabricIndex = 0; err = setup.Encode(item); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); TLV::TLVReader reader; TLVType ignored; reader.Init(setup.buf, setup.writer.GetLengthWritten()); err = reader.Next(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.EnterContainer(ignored); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.Next(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); AttributeValueDecoder decoder(reader, subjectDescriptor); err = decoder.Decode(decodeItem); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, decodeItem.fabricIndex == kTestFabricIndex); + EXPECT_EQ(decodeItem.fabricIndex, kTestFabricIndex); } -void TestOverwriteFabricIndexInListOfStructs(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueDecoder, TestOverwriteFabricIndexInListOfStructs) { TestSetup setup; CHIP_ERROR err; @@ -109,7 +104,7 @@ void TestOverwriteFabricIndexInListOfStructs(nlTestSuite * aSuite, void * aConte } err = setup.Encode(DataModel::List(items)); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); TLV::TLVReader reader; TLVType ignored; @@ -118,44 +113,27 @@ void TestOverwriteFabricIndexInListOfStructs(nlTestSuite * aSuite, void * aConte reader.Init(setup.buf, setup.writer.GetLengthWritten()); err = reader.Next(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.EnterContainer(ignored); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.Next(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); AttributeValueDecoder decoder(reader, subjectDescriptor); err = decoder.Decode(decodeItems); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = decodeItems.ComputeSize(&decodeCount); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, decodeCount == kTestListElements); + EXPECT_EQ(decodeCount, kTestListElements); for (auto iter = decodeItems.begin(); iter.Next();) { const auto & entry = iter.GetValue(); - NL_TEST_ASSERT(aSuite, entry.fabricIndex == kTestFabricIndex); + EXPECT_EQ(entry.fabricIndex, kTestFabricIndex); } } } // anonymous namespace - -namespace { -const nlTest sTests[] = { NL_TEST_DEF("TestOverwriteFabricIndexInStruct", TestOverwriteFabricIndexInStruct), - NL_TEST_DEF("TestOverwriteFabricIndexInListOfStructs", TestOverwriteFabricIndexInListOfStructs), - NL_TEST_SENTINEL() }; -} - -int TestAttributeValueDecoder() -{ - nlTestSuite theSuite = { "AttributeValueDecoder", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestAttributeValueDecoder) diff --git a/src/app/tests/TestAttributeValueEncoder.cpp b/src/app/tests/TestAttributeValueEncoder.cpp index 085c4f870cdf64..43a015d27c4b9e 100644 --- a/src/app/tests/TestAttributeValueEncoder.cpp +++ b/src/app/tests/TestAttributeValueEncoder.cpp @@ -16,11 +16,10 @@ * limitations under the License. */ -/** - * @file - * This file implements unit tests for CommandPathParams - * - */ +#include + +#include +#include #include #include @@ -30,10 +29,6 @@ #include #include #include -#include -#include - -#include using namespace chip; using namespace chip::app; @@ -75,7 +70,7 @@ Access::SubjectDescriptor DescriptorWithFabric(FabricIndex fabricIndex) template struct LimitedTestSetup { - LimitedTestSetup(nlTestSuite * aSuite, const FabricIndex aFabricIndex = kUndefinedFabricIndex, + LimitedTestSetup(const FabricIndex aFabricIndex = kUndefinedFabricIndex, const AttributeEncodeState & aState = AttributeEncodeState()) : encoder(builder, DescriptorWithFabric(aFabricIndex), ConcreteAttributePath(kRandomEndpointId, kRandomClusterId, kRandomAttributeId), kRandomDataVersion, @@ -85,11 +80,11 @@ struct LimitedTestSetup { TLVType ignored; CHIP_ERROR err = writer.StartContainer(AnonymousTag(), kTLVType_Structure, ignored); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } { CHIP_ERROR err = builder.Init(&writer, 1); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } } @@ -103,11 +98,11 @@ using TestSetup = LimitedTestSetup<1024>; // Macro so we get better error reporting in terms of which test failed, because // the reporting uses __LINE__. -#define VERIFY_BUFFER_STATE(aSuite, aSetup, aExpected) \ +#define VERIFY_BUFFER_STATE(aSetup, aExpected) \ do \ { \ - NL_TEST_ASSERT(aSuite, aSetup.writer.GetLengthWritten() == sizeof(aExpected)); \ - NL_TEST_ASSERT(aSuite, memcmp(aSetup.buf, aExpected, sizeof(aExpected)) == 0); \ + EXPECT_EQ(aSetup.writer.GetLengthWritten(), sizeof(aExpected)); \ + EXPECT_EQ(memcmp(aSetup.buf, aExpected, sizeof(aExpected)), 0); \ if (aSetup.writer.GetLengthWritten() != sizeof(aExpected) || memcmp(aSetup.buf, aExpected, sizeof(aExpected)) != 0) \ { \ printf("Encoded: \n"); \ @@ -125,19 +120,19 @@ using TestSetup = LimitedTestSetup<1024>; } \ } while (0) -void TestEncodeNothing(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeNothing) { - TestSetup test(aSuite); + TestSetup test{}; // Just have an anonymous struct marker, and the AttributeReportIBs opened. const uint8_t expected[] = { 0x15, 0x36, 0x01 }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } -void TestEncodeBool(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeBool) { - TestSetup test(aSuite); + TestSetup test{}; CHIP_ERROR err = test.encoder.Encode(true); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off 0x15, 0x36, 0x01, // Test overhead, Start Anonymous struct + Start 1 byte Tag Array + Tag (01) @@ -154,15 +149,15 @@ void TestEncodeBool(nlTestSuite * aSuite, void * aContext) 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } -void TestEncodeListOfBools1(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeListOfBools1) { - TestSetup test(aSuite); + TestSetup test{}; bool list[] = { true, false }; CHIP_ERROR err = test.encoder.Encode(DataModel::List(list)); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off 0x15, 0x36, 0x01, // Test overhead, Start Anonymous struct + Start 1 byte Tag Array + Tag (01) @@ -182,12 +177,12 @@ void TestEncodeListOfBools1(nlTestSuite * aSuite, void * aContext) 0x18, // End of attribute structure // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } -void TestEncodeListOfBools2(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeListOfBools2) { - TestSetup test(aSuite); + TestSetup test{}; bool list[] = { true, false }; CHIP_ERROR err = test.encoder.EncodeList([&list](const auto & encoder) -> CHIP_ERROR { for (auto & item : list) @@ -196,7 +191,7 @@ void TestEncodeListOfBools2(nlTestSuite * aSuite, void * aContext) } return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off 0x15, 0x36, 0x01, // Test overhead, Start Anonymous struct + Start 1 byte Tag Array + Tag (01) @@ -216,7 +211,7 @@ void TestEncodeListOfBools2(nlTestSuite * aSuite, void * aContext) 0x18, // End of attribute structure // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } constexpr uint8_t emptyListExpected[] = { @@ -238,25 +233,25 @@ constexpr uint8_t emptyListExpected[] = { // clang-format on }; -void TestEncodeEmptyList1(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeEmptyList1) { - TestSetup test(aSuite); + TestSetup test{}; CHIP_ERROR err = test.encoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); - VERIFY_BUFFER_STATE(aSuite, test, emptyListExpected); + EXPECT_EQ(err, CHIP_NO_ERROR); + VERIFY_BUFFER_STATE(test, emptyListExpected); } -void TestEncodeEmptyList2(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeEmptyList2) { - TestSetup test(aSuite); + TestSetup test{}; CHIP_ERROR err = test.encoder.EncodeEmptyList(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); - VERIFY_BUFFER_STATE(aSuite, test, emptyListExpected); + EXPECT_EQ(err, CHIP_NO_ERROR); + VERIFY_BUFFER_STATE(test, emptyListExpected); } -void TestEncodeFabricScoped(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeFabricScoped) { - TestSetup test(aSuite, kTestFabricIndex); + TestSetup test(kTestFabricIndex); Clusters::AccessControl::Structs::AccessControlExtensionStruct::Type items[3]; items[0].fabricIndex = 1; items[1].fabricIndex = 2; @@ -270,7 +265,7 @@ void TestEncodeFabricScoped(nlTestSuite * aSuite, void * aContext) } return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off 0x15, 0x36, 0x01, // Test overhead, Start Anonymous struct + Start 1 byte Tag Array + Tag (01) @@ -292,10 +287,10 @@ void TestEncodeFabricScoped(nlTestSuite * aSuite, void * aContext) 0x18, // End of attribute structure // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } -void TestEncodeListChunking(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeListChunking) { AttributeEncodeState state; @@ -316,9 +311,9 @@ void TestEncodeListChunking(nlTestSuite * aSuite, void * aContext) // corresponding to the "test overhead" container starts. But TLVWriter automatically // reserves space when containers are opened, so we have to have enough space to have // encoded those last two close containers. - LimitedTestSetup<30> test1(aSuite, kTestFabricIndex); + LimitedTestSetup<30> test1(kTestFabricIndex); CHIP_ERROR err = test1.encoder.EncodeList(listEncoder); - NL_TEST_ASSERT(aSuite, err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_TRUE(err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); state = test1.encoder.GetState(); const uint8_t expected[] = { @@ -340,14 +335,14 @@ void TestEncodeListChunking(nlTestSuite * aSuite, void * aContext) 0x18, // End of attribute structure // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test1, expected); + VERIFY_BUFFER_STATE(test1, expected); } { // Use 30 bytes buffer to force chunking after the second "false". The kTestFabricIndex is // not effective in this test. - LimitedTestSetup<30> test2(aSuite, 0, state); + LimitedTestSetup<30> test2(0, state); CHIP_ERROR err = test2.encoder.EncodeList(listEncoder); - NL_TEST_ASSERT(aSuite, err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_TRUE(err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); state = test2.encoder.GetState(); const uint8_t expected[] = { @@ -367,13 +362,13 @@ void TestEncodeListChunking(nlTestSuite * aSuite, void * aContext) 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test2, expected); + VERIFY_BUFFER_STATE(test2, expected); } { // Allow encoding everything else. The kTestFabricIndex is not effective in this test. - TestSetup test3(aSuite, 0, state); + TestSetup test3(0, state); CHIP_ERROR err = test3.encoder.EncodeList(listEncoder); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off @@ -416,11 +411,11 @@ void TestEncodeListChunking(nlTestSuite * aSuite, void * aContext) 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test3, expected); + VERIFY_BUFFER_STATE(test3, expected); } } -void TestEncodeListChunking2(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeListChunking2) { AttributeEncodeState state; @@ -441,9 +436,9 @@ void TestEncodeListChunking2(nlTestSuite * aSuite, void * aContext) // corresponding to the "test overhead" container starts. But TLVWriter automatically // reserves space when containers are opened, so we have to have enough space to have // encoded those last two close containers. - LimitedTestSetup<28> test1(aSuite, kTestFabricIndex); + LimitedTestSetup<28> test1(kTestFabricIndex); CHIP_ERROR err = test1.encoder.EncodeList(listEncoder); - NL_TEST_ASSERT(aSuite, err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_TRUE(err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); state = test1.encoder.GetState(); const uint8_t expected[] = { @@ -463,14 +458,14 @@ void TestEncodeListChunking2(nlTestSuite * aSuite, void * aContext) 0x18, // End of attribute structure // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test1, expected); + VERIFY_BUFFER_STATE(test1, expected); } { // Use 30 bytes buffer to force chunking after the first "true". The kTestFabricIndex is not // effective in this test. - LimitedTestSetup<30> test2(aSuite, 0, state); + LimitedTestSetup<30> test2(0, state); CHIP_ERROR err = test2.encoder.EncodeList(listEncoder); - NL_TEST_ASSERT(aSuite, err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_TRUE(err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); state = test2.encoder.GetState(); const uint8_t expected[] = { @@ -490,14 +485,14 @@ void TestEncodeListChunking2(nlTestSuite * aSuite, void * aContext) 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test2, expected); + VERIFY_BUFFER_STATE(test2, expected); } { // Use 60 bytes buffer to force chunking after the second "false". The kTestFabricIndex is not // effective in this test. - LimitedTestSetup<60> test3(aSuite, 0, state); + LimitedTestSetup<60> test3(0, state); CHIP_ERROR err = test3.encoder.EncodeList(listEncoder); - NL_TEST_ASSERT(aSuite, err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_TRUE(err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); state = test3.encoder.GetState(); const uint8_t expected[] = { @@ -529,13 +524,13 @@ void TestEncodeListChunking2(nlTestSuite * aSuite, void * aContext) 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test3, expected); + VERIFY_BUFFER_STATE(test3, expected); } { // Allow encoding everything else. The kTestFabricIndex is not effective in this test. - TestSetup test4(aSuite, 0, state); + TestSetup test4(0, state); CHIP_ERROR err = test4.encoder.EncodeList(listEncoder); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off @@ -578,27 +573,27 @@ void TestEncodeListChunking2(nlTestSuite * aSuite, void * aContext) 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test4, expected); + VERIFY_BUFFER_STATE(test4, expected); } } -void TestEncodePreEncoded(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodePreEncoded) { - TestSetup test(aSuite); + TestSetup test{}; uint8_t buffer[128]; TLV::TLVWriter writer; writer.Init(buffer); // Use a random tag that is not the right tag. CHIP_ERROR err = writer.PutString(TLV::ProfileTag(0x1234abcd, 0x5678fedc), "hello"); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Finalize(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); ByteSpan value(buffer, writer.GetLengthWritten()); err = test.encoder.Encode(DataModel::PreEncodedValue(value)); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off @@ -616,12 +611,12 @@ void TestEncodePreEncoded(nlTestSuite * aSuite, void * aContext) 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } -void TestEncodeListOfPreEncoded(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeListOfPreEncoded) { - TestSetup test(aSuite); + TestSetup test{}; uint8_t buffers[2][128]; std::optional values[2]; @@ -631,10 +626,10 @@ void TestEncodeListOfPreEncoded(nlTestSuite * aSuite, void * aContext) writer.Init(buffers[0]); // Use a random tag that is not the right tag. CHIP_ERROR err = writer.PutString(TLV::ProfileTag(0x1234abcd, 0x5678fedc), "hello"); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Finalize(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); values[0].emplace(ByteSpan(buffers[0], writer.GetLengthWritten())); } @@ -644,10 +639,10 @@ void TestEncodeListOfPreEncoded(nlTestSuite * aSuite, void * aContext) writer.Init(buffers[1]); // Use a random tag that is not the right tag. CHIP_ERROR err = writer.PutString(TLV::ProfileTag(0x1234abcd, 0x00010002), "bye"); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Finalize(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); values[1].emplace(ByteSpan(buffers[1], writer.GetLengthWritten())); } @@ -659,7 +654,7 @@ void TestEncodeListOfPreEncoded(nlTestSuite * aSuite, void * aContext) } return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off @@ -680,12 +675,12 @@ void TestEncodeListOfPreEncoded(nlTestSuite * aSuite, void * aContext) 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } -void TestEncodeListOfFabricScopedPreEncoded(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeListOfFabricScopedPreEncoded) { - TestSetup test(aSuite); + TestSetup test{}; uint8_t buffers[2][128]; std::optional values[2]; @@ -697,19 +692,19 @@ void TestEncodeListOfFabricScopedPreEncoded(nlTestSuite * aSuite, void * aContex TLV::TLVType outerContainerType; CHIP_ERROR err = writer.StartContainer(TLV::ProfileTag(0x1234abcd, 0x5678fedc), TLV::kTLVType_Structure, outerContainerType); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.PutString(TLV::ContextTag(7), "hello"); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Put(kFabricIndexTag, kTestFabricIndex); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.EndContainer(outerContainerType); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Finalize(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); values[0].emplace(ByteSpan(buffers[0], writer.GetLengthWritten())); } @@ -721,19 +716,19 @@ void TestEncodeListOfFabricScopedPreEncoded(nlTestSuite * aSuite, void * aContex TLV::TLVType outerContainerType; CHIP_ERROR err = writer.StartContainer(TLV::ProfileTag(0x1234abcd, 0x00010002), TLV::kTLVType_Structure, outerContainerType); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.PutString(TLV::ContextTag(7), "bye"); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Put(kFabricIndexTag, static_cast(kTestFabricIndex + 1)); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.EndContainer(outerContainerType); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Finalize(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); values[1].emplace(ByteSpan(buffers[1], writer.GetLengthWritten())); } @@ -745,7 +740,7 @@ void TestEncodeListOfFabricScopedPreEncoded(nlTestSuite * aSuite, void * aContex } return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off @@ -772,12 +767,12 @@ void TestEncodeListOfFabricScopedPreEncoded(nlTestSuite * aSuite, void * aContex 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } -void TestEncodeFabricFilteredListOfPreEncoded(nlTestSuite * aSuite, void * aContext) +TEST(TestAttributeValueEncoder, TestEncodeFabricFilteredListOfPreEncoded) { - TestSetup test(aSuite, kTestFabricIndex); + TestSetup test(kTestFabricIndex); uint8_t buffers[2][128]; std::optional values[2]; @@ -789,19 +784,19 @@ void TestEncodeFabricFilteredListOfPreEncoded(nlTestSuite * aSuite, void * aCont TLV::TLVType outerContainerType; CHIP_ERROR err = writer.StartContainer(TLV::ProfileTag(0x1234abcd, 0x5678fedc), TLV::kTLVType_Structure, outerContainerType); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.PutString(TLV::ContextTag(7), "hello"); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Put(kFabricIndexTag, kTestFabricIndex); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.EndContainer(outerContainerType); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Finalize(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); values[0].emplace(ByteSpan(buffers[0], writer.GetLengthWritten())); } @@ -813,19 +808,19 @@ void TestEncodeFabricFilteredListOfPreEncoded(nlTestSuite * aSuite, void * aCont TLV::TLVType outerContainerType; CHIP_ERROR err = writer.StartContainer(TLV::ProfileTag(0x1234abcd, 0x00010002), TLV::kTLVType_Structure, outerContainerType); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.PutString(TLV::ContextTag(7), "bye"); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Put(kFabricIndexTag, static_cast(kTestFabricIndex + 1)); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.EndContainer(outerContainerType); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer.Finalize(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); values[1].emplace(ByteSpan(buffers[1], writer.GetLengthWritten())); } @@ -837,7 +832,7 @@ void TestEncodeFabricFilteredListOfPreEncoded(nlTestSuite * aSuite, void * aCont } return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const uint8_t expected[] = { // clang-format off @@ -861,42 +856,9 @@ void TestEncodeFabricFilteredListOfPreEncoded(nlTestSuite * aSuite, void * aCont 0x18, // End of container // clang-format on }; - VERIFY_BUFFER_STATE(aSuite, test, expected); + VERIFY_BUFFER_STATE(test, expected); } #undef VERIFY_BUFFER_STATE } // anonymous namespace - -namespace { -const nlTest sTests[] = { - // clang-format off - NL_TEST_DEF("TestEncodeNothing", TestEncodeNothing), - NL_TEST_DEF("TestEncodeBool", TestEncodeBool), - NL_TEST_DEF("TestEncodeEmptyList1", TestEncodeEmptyList1), - NL_TEST_DEF("TestEncodeEmptyList2", TestEncodeEmptyList2), - NL_TEST_DEF("TestEncodeListOfBools1", TestEncodeListOfBools1), - NL_TEST_DEF("TestEncodeListOfBools2", TestEncodeListOfBools2), - NL_TEST_DEF("TestEncodeListChunking", TestEncodeListChunking), - NL_TEST_DEF("TestEncodeListChunking2", TestEncodeListChunking2), - NL_TEST_DEF("TestEncodeFabricScoped", TestEncodeFabricScoped), - NL_TEST_DEF("TestEncodePreEncoded", TestEncodePreEncoded), - NL_TEST_DEF("TestEncodeListOfPreEncoded", TestEncodeListOfPreEncoded), - NL_TEST_DEF("TestEncodeListFabricScopedPreEncoded", TestEncodeListOfPreEncoded), - NL_TEST_DEF("TestEncodeListOfFabricScopedPreEncoded", TestEncodeListOfFabricScopedPreEncoded), - NL_TEST_DEF("TestEncodeFabricFilteredListOfPreEncoded", TestEncodeFabricFilteredListOfPreEncoded), - NL_TEST_SENTINEL() - // clang-format on -}; -} - -int TestAttributeValueEncoder() -{ - nlTestSuite theSuite = { "AttributeValueEncoder", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestAttributeValueEncoder) diff --git a/src/app/tests/TestBindingTable.cpp b/src/app/tests/TestBindingTable.cpp index db95408813a0c1..a4d5d0e2fcf6a7 100644 --- a/src/app/tests/TestBindingTable.cpp +++ b/src/app/tests/TestBindingTable.cpp @@ -15,122 +15,122 @@ * limitations under the License. */ +#include +#include + #include #include #include #include #include -#include using chip::BindingTable; namespace { -void TestEmptyBindingTable(nlTestSuite * aSuite, void * aContext) +void VerifyTableSame(BindingTable & table, const std::vector & expected) +{ + ASSERT_EQ(table.Size(), expected.size()); + auto iter1 = table.begin(); + auto iter2 = expected.begin(); + while (iter2 != expected.end()) + { + EXPECT_EQ(*iter1, *iter2); + ++iter1; + ++iter2; + } + EXPECT_EQ(iter1, table.end()); +} + +void VerifyRestored(chip::TestPersistentStorageDelegate & storage, const std::vector & expected) +{ + BindingTable restoredTable; + restoredTable.SetPersistentStorage(&storage); + EXPECT_EQ(restoredTable.LoadFromStorage(), CHIP_NO_ERROR); + VerifyTableSame(restoredTable, expected); +} + +TEST(TestBindingTable, TestEmptyBindingTable) { BindingTable table; chip::TestPersistentStorageDelegate testStorage; table.SetPersistentStorage(&testStorage); - NL_TEST_ASSERT(aSuite, table.Size() == 0); - NL_TEST_ASSERT(aSuite, table.begin() == table.end()); + EXPECT_EQ(table.Size(), 0u); + EXPECT_EQ(table.begin(), table.end()); } -void TestAdd(nlTestSuite * aSuite, void * aContext) +TEST(TestBindingTable, TestAdd) { BindingTable table; chip::TestPersistentStorageDelegate testStorage; table.SetPersistentStorage(&testStorage); EmberBindingTableEntry unusedEntry; unusedEntry.type = MATTER_UNUSED_BINDING; - NL_TEST_ASSERT(aSuite, table.Add(unusedEntry) == CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(table.Add(unusedEntry), CHIP_ERROR_INVALID_ARGUMENT); for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { - NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, i, 0, 0, std::nullopt)) == CHIP_NO_ERROR); + EXPECT_EQ(table.Add(EmberBindingTableEntry::ForNode(0, i, 0, 0, std::nullopt)), CHIP_NO_ERROR); } - NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, 0, 0, 0, std::nullopt)) == CHIP_ERROR_NO_MEMORY); - NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE); + EXPECT_EQ(table.Add(EmberBindingTableEntry::ForNode(0, 0, 0, 0, std::nullopt)), CHIP_ERROR_NO_MEMORY); + EXPECT_EQ(table.Size(), MATTER_BINDING_TABLE_SIZE); auto iter = table.begin(); for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { - NL_TEST_ASSERT(aSuite, iter != table.end()); - NL_TEST_ASSERT(aSuite, iter->nodeId == i); - NL_TEST_ASSERT(aSuite, iter.GetIndex() == i); + EXPECT_NE(iter, table.end()); + EXPECT_EQ(iter->nodeId, i); + EXPECT_EQ(iter.GetIndex(), i); ++iter; } - NL_TEST_ASSERT(aSuite, iter == table.end()); + EXPECT_EQ(iter, table.end()); } -void TestRemoveThenAdd(nlTestSuite * aSuite, void * aContext) +TEST(TestBindingTable, TestRemoveThenAdd) { BindingTable table; chip::TestPersistentStorageDelegate testStorage; table.SetPersistentStorage(&testStorage); - NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, 0, 0, 0, std::nullopt)) == CHIP_NO_ERROR); + EXPECT_EQ(table.Add(EmberBindingTableEntry::ForNode(0, 0, 0, 0, std::nullopt)), CHIP_NO_ERROR); auto iter = table.begin(); - NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, iter == table.end()); - NL_TEST_ASSERT(aSuite, table.Size() == 0); - NL_TEST_ASSERT(aSuite, table.begin() == table.end()); + EXPECT_EQ(table.RemoveAt(iter), CHIP_NO_ERROR); + EXPECT_EQ(iter, table.end()); + EXPECT_EQ(table.Size(), 0u); + EXPECT_EQ(table.begin(), table.end()); for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { - NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, i, 0, 0, std::nullopt)) == CHIP_NO_ERROR); + EXPECT_EQ(table.Add(EmberBindingTableEntry::ForNode(0, i, 0, 0, std::nullopt)), CHIP_NO_ERROR); } iter = table.begin(); ++iter; - NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE - 1); - NL_TEST_ASSERT(aSuite, iter->nodeId == 2); - NL_TEST_ASSERT(aSuite, iter.GetIndex() == 2); + EXPECT_EQ(table.RemoveAt(iter), CHIP_NO_ERROR); + EXPECT_EQ(table.Size(), MATTER_BINDING_TABLE_SIZE - 1); + EXPECT_EQ(iter->nodeId, 2u); + EXPECT_EQ(iter.GetIndex(), 2u); auto iterCheck = table.begin(); ++iterCheck; - NL_TEST_ASSERT(aSuite, iter == iterCheck); + EXPECT_EQ(iter, iterCheck); - NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, 1, 0, 0, std::nullopt)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE); + EXPECT_EQ(table.Add(EmberBindingTableEntry::ForNode(0, 1, 0, 0, std::nullopt)), CHIP_NO_ERROR); + EXPECT_EQ(table.Size(), MATTER_BINDING_TABLE_SIZE); iter = table.begin(); for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE - 1; i++) { ++iter; } - NL_TEST_ASSERT(aSuite, iter->nodeId == 1); - NL_TEST_ASSERT(aSuite, iter.GetIndex() == 1); + EXPECT_EQ(iter->nodeId, 1u); + EXPECT_EQ(iter.GetIndex(), 1u); ++iter; - NL_TEST_ASSERT(aSuite, iter == table.end()); + EXPECT_EQ(iter, table.end()); iter = table.begin(); - NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE - 1); - NL_TEST_ASSERT(aSuite, iter == table.begin()); - NL_TEST_ASSERT(aSuite, iter.GetIndex() == 2); - NL_TEST_ASSERT(aSuite, iter->nodeId == 2); - NL_TEST_ASSERT(aSuite, table.GetAt(0).type == MATTER_UNUSED_BINDING); -} - -void VerifyTableSame(nlTestSuite * aSuite, BindingTable & table, const std::vector & expected) -{ - NL_TEST_ASSERT(aSuite, table.Size() == expected.size()); - auto iter1 = table.begin(); - auto iter2 = expected.begin(); - while (iter2 != expected.end()) - { - NL_TEST_ASSERT(aSuite, iter1 != table.end()); - NL_TEST_ASSERT(aSuite, *iter1 == *iter2); - ++iter1; - ++iter2; - } - NL_TEST_ASSERT(aSuite, iter1 == table.end()); + EXPECT_EQ(table.RemoveAt(iter), CHIP_NO_ERROR); + EXPECT_EQ(table.Size(), MATTER_BINDING_TABLE_SIZE - 1); + EXPECT_EQ(iter, table.begin()); + EXPECT_EQ(iter.GetIndex(), 2u); + EXPECT_EQ(iter->nodeId, 2u); + EXPECT_EQ(table.GetAt(0).type, MATTER_UNUSED_BINDING); } -void VerifyRestored(nlTestSuite * aSuite, chip::TestPersistentStorageDelegate & storage, - const std::vector & expected) -{ - BindingTable restoredTable; - restoredTable.SetPersistentStorage(&storage); - NL_TEST_ASSERT(aSuite, restoredTable.LoadFromStorage() == CHIP_NO_ERROR); - VerifyTableSame(aSuite, restoredTable, expected); -} - -void TestPersistentStorage(nlTestSuite * aSuite, void * aContext) +TEST(TestBindingTable, TestPersistentStorage) { chip::TestPersistentStorageDelegate testStorage; BindingTable table; @@ -142,68 +142,46 @@ void TestPersistentStorage(nlTestSuite * aSuite, void * aContext) EmberBindingTableEntry::ForGroup(3, 3, 0, cluster.std_optional()), }; table.SetPersistentStorage(&testStorage); - NL_TEST_ASSERT(aSuite, table.Add(expected[0]) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Add(expected[1]) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Add(expected[2]) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Add(expected[3]) == CHIP_NO_ERROR); - VerifyRestored(aSuite, testStorage, expected); + EXPECT_EQ(table.Add(expected[0]), CHIP_NO_ERROR); + EXPECT_EQ(table.Add(expected[1]), CHIP_NO_ERROR); + EXPECT_EQ(table.Add(expected[2]), CHIP_NO_ERROR); + EXPECT_EQ(table.Add(expected[3]), CHIP_NO_ERROR); + VerifyRestored(testStorage, expected); // Verify storage untouched if add fails testStorage.AddPoisonKey(chip::DefaultStorageKeyAllocator::BindingTableEntry(4).KeyName()); - NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(4, 4, 0, 0, std::nullopt)) != CHIP_NO_ERROR); - VerifyRestored(aSuite, testStorage, expected); + EXPECT_NE(table.Add(EmberBindingTableEntry::ForNode(4, 4, 0, 0, std::nullopt)), CHIP_NO_ERROR); + VerifyRestored(testStorage, expected); testStorage.ClearPoisonKeys(); // Verify storage untouched if removing head fails testStorage.AddPoisonKey(chip::DefaultStorageKeyAllocator::BindingTable().KeyName()); auto iter = table.begin(); - NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) != CHIP_NO_ERROR); - VerifyTableSame(aSuite, table, expected); + EXPECT_NE(table.RemoveAt(iter), CHIP_NO_ERROR); + VerifyTableSame(table, expected); testStorage.ClearPoisonKeys(); - VerifyRestored(aSuite, testStorage, expected); + VerifyRestored(testStorage, expected); // Verify storage untouched if removing other nodes fails testStorage.AddPoisonKey(chip::DefaultStorageKeyAllocator::BindingTableEntry(0).KeyName()); iter = table.begin(); ++iter; - NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) != CHIP_NO_ERROR); - VerifyTableSame(aSuite, table, expected); + EXPECT_NE(table.RemoveAt(iter), CHIP_NO_ERROR); + VerifyTableSame(table, expected); testStorage.ClearPoisonKeys(); - VerifyRestored(aSuite, testStorage, expected); + VerifyRestored(testStorage, expected); // Verify removing head iter = table.begin(); - NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - VerifyTableSame(aSuite, table, { expected[1], expected[2], expected[3] }); - VerifyRestored(aSuite, testStorage, { expected[1], expected[2], expected[3] }); + EXPECT_EQ(table.RemoveAt(iter), CHIP_NO_ERROR); + VerifyTableSame(table, { expected[1], expected[2], expected[3] }); + VerifyRestored(testStorage, { expected[1], expected[2], expected[3] }); // Verify removing other nodes ++iter; - NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - VerifyTableSame(aSuite, table, { expected[1], expected[3] }); - VerifyRestored(aSuite, testStorage, { expected[1], expected[3] }); + EXPECT_EQ(table.RemoveAt(iter), CHIP_NO_ERROR); + VerifyTableSame(table, { expected[1], expected[3] }); + VerifyRestored(testStorage, { expected[1], expected[3] }); } } // namespace - -int TestBindingTable() -{ - static nlTest sTests[] = { - NL_TEST_DEF("TestEmptyBindingTable", TestEmptyBindingTable), - NL_TEST_DEF("TestAdd", TestAdd), - NL_TEST_DEF("TestRemoveThenAdd", TestRemoveThenAdd), - NL_TEST_DEF("TestPersistentStorage", TestPersistentStorage), - NL_TEST_SENTINEL(), - }; - - nlTestSuite theSuite = { - "BindingTable", - &sTests[0], - nullptr, - nullptr, - }; - nlTestRunner(&theSuite, nullptr); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestBindingTable) diff --git a/src/app/tests/TestBuilderParser.cpp b/src/app/tests/TestBuilderParser.cpp index 314353e8b70029..b59042c4aa6dff 100644 --- a/src/app/tests/TestBuilderParser.cpp +++ b/src/app/tests/TestBuilderParser.cpp @@ -25,23 +25,30 @@ #include #include #include -#include #include -#include +#include +#include namespace { using namespace chip::app; -void ListTest(nlTestSuite * apSuite, void * apContext) +class TestBuilderParser : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestBuilderParser, TestList) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); ListBuilder listBuilder; - NL_TEST_ASSERT(apSuite, listBuilder.Init(&writer) == CHIP_NO_ERROR); + EXPECT_EQ(listBuilder.Init(&writer), CHIP_NO_ERROR); listBuilder.EndOfContainer(); chip::System::PacketBufferHandle buf; @@ -50,18 +57,18 @@ void ListTest(nlTestSuite * apSuite, void * apContext) ListParser listParser; reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, listParser.Init(reader) == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(listParser.Init(reader), CHIP_NO_ERROR); } -void StructTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestBuilderParser, TestStruct) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); StructBuilder structBuilder; - NL_TEST_ASSERT(apSuite, structBuilder.Init(&writer) == CHIP_NO_ERROR); + EXPECT_EQ(structBuilder.Init(&writer), CHIP_NO_ERROR); structBuilder.EndOfContainer(); chip::System::PacketBufferHandle buf; @@ -71,17 +78,17 @@ void StructTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, structParser.Init(reader) == CHIP_NO_ERROR); + EXPECT_EQ(structParser.Init(reader), CHIP_NO_ERROR); } -void ArrayTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestBuilderParser, TestArray) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); ArrayBuilder arrayBuilder; - NL_TEST_ASSERT(apSuite, arrayBuilder.Init(&writer) == CHIP_NO_ERROR); + EXPECT_EQ(arrayBuilder.Init(&writer), CHIP_NO_ERROR); arrayBuilder.EndOfContainer(); chip::System::PacketBufferHandle buf; @@ -91,55 +98,7 @@ void ArrayTest(nlTestSuite * apSuite, void * apContext) reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, arrayParser.Init(reader) == CHIP_NO_ERROR); + EXPECT_EQ(arrayParser.Init(reader), CHIP_NO_ERROR); } -// clang-format off -const nlTest sTests[] = - { - NL_TEST_DEF("ListTest", ListTest), - NL_TEST_DEF("StructTest", StructTest), - NL_TEST_DEF("ArrayTest", ArrayTest), - NL_TEST_SENTINEL() - }; -// clang-format on } // namespace - -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -int TestBuilderParser() -{ - // clang-format off - nlTestSuite theSuite = - { - "TestBuilderParser", - &sTests[0], - TestSetup, - TestTeardown, - }; - // clang-format on - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestBuilderParser) diff --git a/src/app/tests/TestDefaultICDClientStorage.cpp b/src/app/tests/TestDefaultICDClientStorage.cpp index 62787a2c9e4144..8cf4c8d86fa2a1 100644 --- a/src/app/tests/TestDefaultICDClientStorage.cpp +++ b/src/app/tests/TestDefaultICDClientStorage.cpp @@ -15,9 +15,9 @@ * limitations under the License. */ +#include #include -#include -#include +#include #include #include @@ -55,7 +55,14 @@ struct TestClientInfo : public ICDClientInfo } }; -void TestClientInfoCount(nlTestSuite * apSuite, void * apContext) +class TestDefaultICDClientStorage : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestDefaultICDClientStorage, TestClientInfoCount) { CHIP_ERROR err = CHIP_NO_ERROR; FabricIndex fabricId = 1; @@ -67,9 +74,9 @@ void TestClientInfoCount(nlTestSuite * apSuite, void * apContext) { DefaultICDClientStorage manager; err = manager.Init(&clientInfoStorage, &keystore); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.UpdateFabricList(fabricId); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Write some ClientInfos and see the counts are correct ICDClientInfo clientInfo1; clientInfo1.peer_node = ScopedNodeId(nodeId1, fabricId); @@ -78,38 +85,38 @@ void TestClientInfoCount(nlTestSuite * apSuite, void * apContext) ICDClientInfo clientInfo3; clientInfo3.peer_node = ScopedNodeId(nodeId1, fabricId); err = manager.SetKey(clientInfo1, ByteSpan(kKeyBuffer1)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.StoreEntry(clientInfo1); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.SetKey(clientInfo2, ByteSpan(kKeyBuffer2)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.StoreEntry(clientInfo2); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.SetKey(clientInfo3, ByteSpan(kKeyBuffer3)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.StoreEntry(clientInfo3); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); ICDClientInfo clientInfo; // Make sure iterator counts correctly auto * iterator = manager.IterateICDClientInfo(); // same nodeId for clientInfo2 and clientInfo3, so the new one replace old one - NL_TEST_ASSERT(apSuite, iterator->Count() == 2); + EXPECT_EQ(iterator->Count(), 2u); - NL_TEST_ASSERT(apSuite, iterator->Next(clientInfo)); - NL_TEST_ASSERT(apSuite, clientInfo.peer_node.GetNodeId() == nodeId2); - NL_TEST_ASSERT(apSuite, iterator->Next(clientInfo)); - NL_TEST_ASSERT(apSuite, clientInfo.peer_node.GetNodeId() == nodeId1); + EXPECT_TRUE(iterator->Next(clientInfo)); + EXPECT_EQ(clientInfo.peer_node.GetNodeId(), nodeId2); + EXPECT_TRUE(iterator->Next(clientInfo)); + EXPECT_EQ(clientInfo.peer_node.GetNodeId(), nodeId1); iterator->Release(); // Delete all and verify iterator counts 0 err = manager.DeleteAllEntries(fabricId); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); iterator = manager.IterateICDClientInfo(); - NL_TEST_ASSERT(apSuite, iterator->Count() == 0); + EXPECT_EQ(iterator->Count(), 0u); // Verify ClientInfos manually count correctly size_t count = 0; @@ -118,19 +125,19 @@ void TestClientInfoCount(nlTestSuite * apSuite, void * apContext) count++; } iterator->Release(); - NL_TEST_ASSERT(apSuite, count == 0); + EXPECT_EQ(count, 0u); } { DefaultICDClientStorage manager; err = manager.Init(&clientInfoStorage, &keystore); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.UpdateFabricList(fabricId); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } } -void TestClientInfoCountMultipleFabric(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDefaultICDClientStorage, TestClientInfoCountMultipleFabric) { CHIP_ERROR err = CHIP_NO_ERROR; FabricIndex fabricId1 = 1; @@ -142,11 +149,11 @@ void TestClientInfoCountMultipleFabric(nlTestSuite * apSuite, void * apContext) TestPersistentStorageDelegate clientInfoStorage; TestSessionKeystoreImpl keystore; err = manager.Init(&clientInfoStorage, &keystore); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.UpdateFabricList(fabricId1); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.UpdateFabricList(fabricId2); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Write some ClientInfos and see the counts are correct ICDClientInfo clientInfo1; @@ -157,39 +164,39 @@ void TestClientInfoCountMultipleFabric(nlTestSuite * apSuite, void * apContext) clientInfo3.peer_node = ScopedNodeId(nodeId3, fabricId2); err = manager.SetKey(clientInfo1, ByteSpan(kKeyBuffer1)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.StoreEntry(clientInfo1); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.SetKey(clientInfo2, ByteSpan(kKeyBuffer2)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.StoreEntry(clientInfo2); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.SetKey(clientInfo3, ByteSpan(kKeyBuffer3)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.StoreEntry(clientInfo3); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Make sure iterator counts correctly auto * iterator = manager.IterateICDClientInfo(); - NL_TEST_ASSERT(apSuite, iterator->Count() == 3); + EXPECT_EQ(iterator->Count(), 3u); iterator->Release(); // Delete all and verify iterator counts 0 err = manager.DeleteEntry(ScopedNodeId(nodeId1, fabricId1)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); iterator = manager.IterateICDClientInfo(); - NL_TEST_ASSERT(apSuite, iterator != nullptr); + ASSERT_NE(iterator, nullptr); DefaultICDClientStorage::ICDClientInfoIteratorWrapper clientInfoIteratorWrapper(iterator); - NL_TEST_ASSERT(apSuite, iterator->Count() == 2); + EXPECT_EQ(iterator->Count(), 2u); err = manager.DeleteEntry(ScopedNodeId(nodeId2, fabricId1)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, iterator->Count() == 1); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(iterator->Count(), 1u); err = manager.DeleteEntry(ScopedNodeId(nodeId3, fabricId2)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, iterator->Count() == 0); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(iterator->Count(), 0u); // Verify ClientInfos manually count correctly size_t count = 0; @@ -199,10 +206,10 @@ void TestClientInfoCountMultipleFabric(nlTestSuite * apSuite, void * apContext) count++; } - NL_TEST_ASSERT(apSuite, count == 0); + EXPECT_FALSE(count); } -void TestProcessCheckInPayload(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDefaultICDClientStorage, TestProcessCheckInPayload) { CHIP_ERROR err = CHIP_NO_ERROR; FabricIndex fabricId = 1; @@ -212,98 +219,41 @@ void TestProcessCheckInPayload(nlTestSuite * apSuite, void * apContext) DefaultICDClientStorage manager; err = manager.Init(&clientInfoStorage, &keystore); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.UpdateFabricList(fabricId); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Populate clientInfo ICDClientInfo clientInfo; clientInfo.peer_node = ScopedNodeId(nodeId, fabricId); err = manager.SetKey(clientInfo, ByteSpan(kKeyBuffer1)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = manager.StoreEntry(clientInfo); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t counter = 1; System::PacketBufferHandle buffer = MessagePacketBuffer::New(chip::Protocols::SecureChannel::CheckinMessage::kMinPayloadSize); MutableByteSpan output{ buffer->Start(), buffer->MaxDataLength() }; err = chip::Protocols::SecureChannel::CheckinMessage::GenerateCheckinMessagePayload( clientInfo.aes_key_handle, clientInfo.hmac_key_handle, counter, ByteSpan(), output); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); buffer->SetDataLength(static_cast(output.size())); ICDClientInfo decodeClientInfo; uint32_t checkInCounter = 0; ByteSpan payload{ buffer->Start(), buffer->DataLength() }; err = manager.ProcessCheckInPayload(payload, decodeClientInfo, checkInCounter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // 2. Use a key not available in the storage for encoding err = manager.SetKey(clientInfo, ByteSpan(kKeyBuffer2)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = chip::Protocols::SecureChannel::CheckinMessage::GenerateCheckinMessagePayload( clientInfo.aes_key_handle, clientInfo.hmac_key_handle, counter, ByteSpan(), output); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); buffer->SetDataLength(static_cast(output.size())); ByteSpan payload1{ buffer->Start(), buffer->DataLength() }; err = manager.ProcessCheckInPayload(payload1, decodeClientInfo, checkInCounter); - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_NOT_FOUND); -} - -/** - * Set up the test suite. - */ -int TestClientInfo_Setup(void * apContext) -{ - VerifyOrReturnError(CHIP_NO_ERROR == Platform::MemoryInit(), FAILURE); - - return SUCCESS; + EXPECT_EQ(err, CHIP_ERROR_NOT_FOUND); } - -/** - * Tear down the test suite. - */ -int TestClientInfo_Teardown(void * apContext) -{ - Platform::MemoryShutdown(); - return SUCCESS; -} - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestClientInfoCount", TestClientInfoCount), - NL_TEST_DEF("TestClientInfoCountMultipleFabric", TestClientInfoCountMultipleFabric), - NL_TEST_DEF("TestProcessCheckInPayload", TestProcessCheckInPayload), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -static nlTestSuite sSuite = -{ - "TestDefaultICDClientStorage", - &sTests[0], - &TestClientInfo_Setup, &TestClientInfo_Teardown -}; -// clang-format on - -/** - * Main - */ -int TestDefaultICDClientStorage() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestDefaultICDClientStorage) diff --git a/src/app/tests/TestFailSafeContext.cpp b/src/app/tests/TestFailSafeContext.cpp index 2d2b9fa15d2b7d..96868ff241fa28 100644 --- a/src/app/tests/TestFailSafeContext.cpp +++ b/src/app/tests/TestFailSafeContext.cpp @@ -28,11 +28,11 @@ #include #include +#include + #include #include #include -#include -#include #include using namespace chip; @@ -44,100 +44,62 @@ namespace { constexpr FabricIndex kTestAccessingFabricIndex1 = 1; constexpr FabricIndex kTestAccessingFabricIndex2 = 2; +class TestFailSafeContext : public ::testing::Test +{ +public: + static void SetUpTestSuite() + { + ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); + ASSERT_EQ(PlatformMgr().InitChipStack(), CHIP_NO_ERROR); + } + static void TearDownTestSuite() + { + PlatformMgr().Shutdown(); + chip::Platform::MemoryShutdown(); + } +}; + // ================================= // Unit tests // ================================= -static void TestPlatformMgr_Init(nlTestSuite * inSuite, void * inContext) -{ - CHIP_ERROR err = PlatformMgr().InitChipStack(); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); -} - -static void TestFailSafeContext_ArmFailSafe(nlTestSuite * inSuite, void * inContext) +TEST_F(TestFailSafeContext, TestFailSafeContext_ArmFailSafe) { CHIP_ERROR err = CHIP_NO_ERROR; chip::app::FailSafeContext failSafeContext; err = failSafeContext.ArmFailSafe(kTestAccessingFabricIndex1, System::Clock::Seconds16(1)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, failSafeContext.IsFailSafeArmed() == true); - NL_TEST_ASSERT(inSuite, failSafeContext.GetFabricIndex() == kTestAccessingFabricIndex1); - NL_TEST_ASSERT(inSuite, failSafeContext.IsFailSafeArmed(kTestAccessingFabricIndex1) == true); - NL_TEST_ASSERT(inSuite, failSafeContext.IsFailSafeArmed(kTestAccessingFabricIndex2) == false); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(failSafeContext.IsFailSafeArmed()); + EXPECT_EQ(failSafeContext.GetFabricIndex(), kTestAccessingFabricIndex1); + EXPECT_TRUE(failSafeContext.IsFailSafeArmed(kTestAccessingFabricIndex1)); + EXPECT_FALSE(failSafeContext.IsFailSafeArmed(kTestAccessingFabricIndex2)); failSafeContext.DisarmFailSafe(); - NL_TEST_ASSERT(inSuite, failSafeContext.IsFailSafeArmed() == false); + EXPECT_FALSE(failSafeContext.IsFailSafeArmed()); } -static void TestFailSafeContext_NocCommandInvoked(nlTestSuite * inSuite, void * inContext) +TEST_F(TestFailSafeContext, TestFailSafeContext_NocCommandInvoked) { CHIP_ERROR err = CHIP_NO_ERROR; chip::app::FailSafeContext failSafeContext; err = failSafeContext.ArmFailSafe(kTestAccessingFabricIndex1, System::Clock::Seconds16(1)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, failSafeContext.GetFabricIndex() == kTestAccessingFabricIndex1); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(failSafeContext.GetFabricIndex(), kTestAccessingFabricIndex1); failSafeContext.SetAddNocCommandInvoked(kTestAccessingFabricIndex2); - NL_TEST_ASSERT(inSuite, failSafeContext.NocCommandHasBeenInvoked() == true); - NL_TEST_ASSERT(inSuite, failSafeContext.AddNocCommandHasBeenInvoked() == true); - NL_TEST_ASSERT(inSuite, failSafeContext.GetFabricIndex() == kTestAccessingFabricIndex2); + EXPECT_TRUE(failSafeContext.NocCommandHasBeenInvoked()); + EXPECT_TRUE(failSafeContext.AddNocCommandHasBeenInvoked()); + EXPECT_EQ(failSafeContext.GetFabricIndex(), kTestAccessingFabricIndex2); failSafeContext.SetUpdateNocCommandInvoked(); - NL_TEST_ASSERT(inSuite, failSafeContext.NocCommandHasBeenInvoked() == true); - NL_TEST_ASSERT(inSuite, failSafeContext.UpdateNocCommandHasBeenInvoked() == true); + EXPECT_TRUE(failSafeContext.NocCommandHasBeenInvoked()); + EXPECT_TRUE(failSafeContext.UpdateNocCommandHasBeenInvoked()); failSafeContext.DisarmFailSafe(); } -/** - * Test Suite. It lists all the test functions. - */ -static const nlTest sTests[] = { - - NL_TEST_DEF("Test PlatformMgr::Init", TestPlatformMgr_Init), - NL_TEST_DEF("Test FailSafeContext::ArmFailSafe", TestFailSafeContext_ArmFailSafe), - NL_TEST_DEF("Test FailSafeContext::NocCommandInvoked", TestFailSafeContext_NocCommandInvoked), - - NL_TEST_SENTINEL() -}; - -/** - * Set up the test suite. - */ -int TestFailSafeContext_Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestFailSafeContext_Teardown(void * inContext) -{ - PlatformMgr().Shutdown(); - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - } // namespace - -/** - * Main - */ -int TestFailSafeContext() -{ - nlTestSuite theSuite = { "FailSafeContext tests", &sTests[0], TestFailSafeContext_Setup, TestFailSafeContext_Teardown }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestFailSafeContext) diff --git a/src/app/tests/TestMessageDef.cpp b/src/app/tests/TestMessageDef.cpp index 10417fa2025522..01f3acb263877a 100644 --- a/src/app/tests/TestMessageDef.cpp +++ b/src/app/tests/TestMessageDef.cpp @@ -16,12 +16,6 @@ * limitations under the License. */ -/** - * @file - * This file implements a test for CHIP Interaction Model Message Def - * - */ - #include #include #include @@ -38,16 +32,23 @@ #include #include #include -#include #include #include -#include +#include +#include namespace { using namespace chip::app; +class TestMessageDef : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + void ENFORCE_FORMAT(1, 2) TLVPrettyPrinter(const char * aFormat, ...) { va_list args; @@ -75,7 +76,7 @@ CHIP_ERROR DebugPrettyPrint(const chip::System::PacketBufferHandle & aMsgBuf) return err; } -void BuildStatusIB(nlTestSuite * apSuite, StatusIB::Builder & aStatusIBBuilder) +void BuildStatusIB(StatusIB::Builder & aStatusIBBuilder) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -83,10 +84,10 @@ void BuildStatusIB(nlTestSuite * apSuite, StatusIB::Builder & aStatusIBBuilder) statusIB.mStatus = chip::Protocols::InteractionModel::Status::InvalidSubscription; aStatusIBBuilder.EncodeStatusIB(statusIB); err = aStatusIBBuilder.GetError(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void ParseStatusIB(nlTestSuite * apSuite, StatusIB::Parser & aStatusIBParser) +void ParseStatusIB(StatusIB::Parser & aStatusIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; StatusIB::Parser StatusIBParser; @@ -96,20 +97,20 @@ void ParseStatusIB(nlTestSuite * apSuite, StatusIB::Parser & aStatusIBParser) aStatusIBParser.PrettyPrint(); #endif err = aStatusIBParser.DecodeStatusIB(statusIB); - NL_TEST_ASSERT(apSuite, - err == CHIP_NO_ERROR && statusIB.mStatus == chip::Protocols::InteractionModel::Status::InvalidSubscription && - !statusIB.mClusterStatus.HasValue()); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(statusIB.mStatus, chip::Protocols::InteractionModel::Status::InvalidSubscription); + EXPECT_FALSE(statusIB.mClusterStatus.HasValue()); } -void BuildClusterPathIB(nlTestSuite * apSuite, ClusterPathIB::Builder & aClusterPathBuilder) +void BuildClusterPathIB(ClusterPathIB::Builder & aClusterPathBuilder) { CHIP_ERROR err = CHIP_NO_ERROR; aClusterPathBuilder.Node(1).Endpoint(2).Cluster(3).EndOfClusterPathIB(); err = aClusterPathBuilder.GetError(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void ParseClusterPathIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseClusterPathIB(chip::TLV::TLVReader & aReader) { ClusterPathIB::Parser clusterPathParser; CHIP_ERROR err = CHIP_NO_ERROR; @@ -118,31 +119,34 @@ void ParseClusterPathIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) chip::ClusterId cluster = 0; err = clusterPathParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT clusterPathParser.PrettyPrint(); #endif err = clusterPathParser.GetNode(&node); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && node == 1); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(node, 1u); err = clusterPathParser.GetEndpoint(&endpoint); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && endpoint == 2); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(endpoint, 2u); err = clusterPathParser.GetCluster(&cluster); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && cluster == 3); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(cluster, 3u); } -void BuildDataVersionFilterIB(nlTestSuite * apSuite, DataVersionFilterIB::Builder & aDataVersionFilterIBBuilder) +void BuildDataVersionFilterIB(DataVersionFilterIB::Builder & aDataVersionFilterIBBuilder) { ClusterPathIB::Builder & clusterPathBuilder = aDataVersionFilterIBBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, clusterPathBuilder.GetError() == CHIP_NO_ERROR); - BuildClusterPathIB(apSuite, clusterPathBuilder); + EXPECT_EQ(clusterPathBuilder.GetError(), CHIP_NO_ERROR); + BuildClusterPathIB(clusterPathBuilder); aDataVersionFilterIBBuilder.DataVersion(2).EndOfDataVersionFilterIB(); - NL_TEST_ASSERT(apSuite, aDataVersionFilterIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aDataVersionFilterIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseDataVersionFilterIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseDataVersionFilterIB(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; DataVersionFilterIB::Parser dataVersionFilterIBParser; @@ -150,46 +154,47 @@ void ParseDataVersionFilterIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aRea chip::DataVersion dataVersion = 2; err = dataVersionFilterIBParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT dataVersionFilterIBParser.PrettyPrint(); #endif err = dataVersionFilterIBParser.GetPath(&clusterPath); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = dataVersionFilterIBParser.GetDataVersion(&dataVersion); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && dataVersion == 2); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(dataVersion, 2u); } -void BuildDataVersionFilterIBs(nlTestSuite * apSuite, DataVersionFilterIBs::Builder & aDataVersionFilterIBsBuilder) +void BuildDataVersionFilterIBs(DataVersionFilterIBs::Builder & aDataVersionFilterIBsBuilder) { DataVersionFilterIB::Builder & dataVersionFilterIBBuilder = aDataVersionFilterIBsBuilder.CreateDataVersionFilter(); - NL_TEST_ASSERT(apSuite, aDataVersionFilterIBsBuilder.GetError() == CHIP_NO_ERROR); - BuildDataVersionFilterIB(apSuite, dataVersionFilterIBBuilder); + EXPECT_EQ(aDataVersionFilterIBsBuilder.GetError(), CHIP_NO_ERROR); + BuildDataVersionFilterIB(dataVersionFilterIBBuilder); aDataVersionFilterIBsBuilder.EndOfDataVersionFilterIBs(); - NL_TEST_ASSERT(apSuite, aDataVersionFilterIBsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aDataVersionFilterIBsBuilder.GetError(), CHIP_NO_ERROR); } -void ParseDataVersionFilterIBs(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseDataVersionFilterIBs(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; DataVersionFilterIBs::Parser dataVersionFilterIBsParser; err = dataVersionFilterIBsParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT dataVersionFilterIBsParser.PrettyPrint(); #endif } -void BuildEventFilterIB(nlTestSuite * apSuite, EventFilterIB::Builder & aEventFilterIBBuilder) +void BuildEventFilterIB(EventFilterIB::Builder & aEventFilterIBBuilder) { aEventFilterIBBuilder.Node(1).EventMin(2).EndOfEventFilterIB(); - NL_TEST_ASSERT(apSuite, aEventFilterIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aEventFilterIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseEventFilterIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseEventFilterIB(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; EventFilterIB::Parser eventFilterIBParser; @@ -197,39 +202,41 @@ void ParseEventFilterIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) uint64_t eventMin = 2; err = eventFilterIBParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT eventFilterIBParser.PrettyPrint(); #endif err = eventFilterIBParser.GetNode(&node); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && node == 1); + EXPECT_EQ(err, CHIP_NO_ERROR); + + EXPECT_EQ(node, 1u); err = eventFilterIBParser.GetEventMin(&eventMin); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && eventMin == 2); + EXPECT_EQ(eventMin, 2u); } -void BuildEventFilters(nlTestSuite * apSuite, EventFilterIBs::Builder & aEventFiltersBuilder) +void BuildEventFilters(EventFilterIBs::Builder & aEventFiltersBuilder) { EventFilterIB::Builder & eventFilterBuilder = aEventFiltersBuilder.CreateEventFilter(); - NL_TEST_ASSERT(apSuite, aEventFiltersBuilder.GetError() == CHIP_NO_ERROR); - BuildEventFilterIB(apSuite, eventFilterBuilder); + EXPECT_EQ(aEventFiltersBuilder.GetError(), CHIP_NO_ERROR); + BuildEventFilterIB(eventFilterBuilder); aEventFiltersBuilder.EndOfEventFilters(); - NL_TEST_ASSERT(apSuite, aEventFiltersBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aEventFiltersBuilder.GetError(), CHIP_NO_ERROR); } -void ParseEventFilters(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseEventFilters(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; EventFilterIBs::Parser eventFiltersParser; err = eventFiltersParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT eventFiltersParser.PrettyPrint(); #endif } -void BuildAttributePathIB(nlTestSuite * apSuite, AttributePathIB::Builder & aAttributePathBuilder) +void BuildAttributePathIB(AttributePathIB::Builder & aAttributePathBuilder) { CHIP_ERROR err = CHIP_NO_ERROR; err = aAttributePathBuilder.EnableTagCompression(false) @@ -239,10 +246,10 @@ void BuildAttributePathIB(nlTestSuite * apSuite, AttributePathIB::Builder & aAtt .Attribute(4) .ListIndex(5) .EndOfAttributePathIB(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void ParseAttributePathIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseAttributePathIB(chip::TLV::TLVReader & aReader) { AttributePathIB::Parser attributePathParser; CHIP_ERROR err = CHIP_NO_ERROR; @@ -254,63 +261,69 @@ void ParseAttributePathIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) chip::ListIndex listIndex = 5; err = attributePathParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT attributePathParser.PrettyPrint(); #endif err = attributePathParser.GetEnableTagCompression(&enableTagCompression); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && enableTagCompression == false); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_FALSE(enableTagCompression); err = attributePathParser.GetNode(&node); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && node == 1); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(node, 1u); err = attributePathParser.GetEndpoint(&endpoint); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && endpoint == 2); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(endpoint, 2u); err = attributePathParser.GetCluster(&cluster); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && cluster == 3); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(cluster, 3u); err = attributePathParser.GetAttribute(&attribute); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && attribute == 4); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(attribute, 4u); err = attributePathParser.GetListIndex(&listIndex); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && listIndex == 5); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(listIndex, 5u); } -void BuildAttributePathList(nlTestSuite * apSuite, AttributePathIBs::Builder & aAttributePathListBuilder) +void BuildAttributePathList(AttributePathIBs::Builder & aAttributePathListBuilder) { AttributePathIB::Builder & attributePathBuilder = aAttributePathListBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, attributePathBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributePathIB(apSuite, attributePathBuilder); + EXPECT_EQ(attributePathBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributePathIB(attributePathBuilder); aAttributePathListBuilder.EndOfAttributePathIBs(); - NL_TEST_ASSERT(apSuite, aAttributePathListBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aAttributePathListBuilder.GetError(), CHIP_NO_ERROR); } -void ParseAttributePathList(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseAttributePathList(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; AttributePathIBs::Parser attributePathListParser; AttributePathIB::Parser attributePathParser; err = attributePathListParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT attributePathListParser.PrettyPrint(); #endif } -void BuildEventPath(nlTestSuite * apSuite, EventPathIB::Builder & aEventPathBuilder) +void BuildEventPath(EventPathIB::Builder & aEventPathBuilder) { CHIP_ERROR err = CHIP_NO_ERROR; aEventPathBuilder.Node(1).Endpoint(2).Cluster(3).Event(4).IsUrgent(true).EndOfEventPathIB(); err = aEventPathBuilder.GetError(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void ParseEventPath(nlTestSuite * apSuite, EventPathIB::Parser & aEventPathParser) +void ParseEventPath(EventPathIB::Parser & aEventPathParser) { CHIP_ERROR err = CHIP_NO_ERROR; chip::NodeId node = 1; @@ -323,50 +336,55 @@ void ParseEventPath(nlTestSuite * apSuite, EventPathIB::Parser & aEventPathParse aEventPathParser.PrettyPrint(); #endif err = aEventPathParser.GetNode(&node); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && node == 1); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(node, 1u); err = aEventPathParser.GetEndpoint(&endpoint); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && endpoint == 2); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(endpoint, 2u); err = aEventPathParser.GetCluster(&cluster); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && cluster == 3); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(cluster, 3u); err = aEventPathParser.GetEvent(&event); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && event == 4); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(event, 4u); err = aEventPathParser.GetIsUrgent(&isUrgent); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && isUrgent == true); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(isUrgent); } -void BuildEventPaths(nlTestSuite * apSuite, EventPathIBs::Builder & aEventPathsBuilder) +void BuildEventPaths(EventPathIBs::Builder & aEventPathsBuilder) { EventPathIB::Builder & eventPathBuilder = aEventPathsBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, eventPathBuilder.GetError() == CHIP_NO_ERROR); - BuildEventPath(apSuite, eventPathBuilder); + EXPECT_EQ(eventPathBuilder.GetError(), CHIP_NO_ERROR); + BuildEventPath(eventPathBuilder); aEventPathsBuilder.EndOfEventPaths(); - NL_TEST_ASSERT(apSuite, aEventPathsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aEventPathsBuilder.GetError(), CHIP_NO_ERROR); } -void ParseEventPaths(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseEventPaths(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; EventPathIBs::Parser eventPathListParser; err = eventPathListParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT eventPathListParser.PrettyPrint(); #endif } -void BuildCommandPath(nlTestSuite * apSuite, CommandPathIB::Builder & aCommandPathBuilder) +void BuildCommandPath(CommandPathIB::Builder & aCommandPathBuilder) { aCommandPathBuilder.EndpointId(1).ClusterId(3).CommandId(4).EndOfCommandPathIB(); - NL_TEST_ASSERT(apSuite, aCommandPathBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aCommandPathBuilder.GetError(), CHIP_NO_ERROR); } -void ParseCommandPath(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseCommandPath(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; CommandPathIB::Parser commandPathParser; @@ -375,52 +393,55 @@ void ParseCommandPath(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) chip::CommandId commandId = 0; err = commandPathParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT commandPathParser.PrettyPrint(); #endif err = commandPathParser.GetEndpointId(&endpointId); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && endpointId == 1); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(endpointId, 1u); err = commandPathParser.GetClusterId(&clusterId); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && clusterId == 3); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(clusterId, 3u); err = commandPathParser.GetCommandId(&commandId); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && commandId == 4); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(commandId, 4u); } -void BuildEventDataIB(nlTestSuite * apSuite, EventDataIB::Builder & aEventDataIBBuilder) +void BuildEventDataIB(EventDataIB::Builder & aEventDataIBBuilder) { CHIP_ERROR err = CHIP_NO_ERROR; EventPathIB::Builder & eventPathBuilder = aEventDataIBBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, eventPathBuilder.GetError() == CHIP_NO_ERROR); - BuildEventPath(apSuite, eventPathBuilder); + EXPECT_EQ(eventPathBuilder.GetError(), CHIP_NO_ERROR); + BuildEventPath(eventPathBuilder); aEventDataIBBuilder.EventNumber(2).Priority(3).EpochTimestamp(4).SystemTimestamp(5).DeltaEpochTimestamp(6).DeltaSystemTimestamp( 7); err = aEventDataIBBuilder.GetError(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Construct test event data { chip::TLV::TLVWriter * pWriter = aEventDataIBBuilder.GetWriter(); chip::TLV::TLVType dummyType = chip::TLV::kTLVType_NotSpecified; err = pWriter->StartContainer(chip::TLV::ContextTag(chip::to_underlying(EventDataIB::Tag::kData)), chip::TLV::kTLVType_Structure, dummyType); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = pWriter->PutBoolean(chip::TLV::ContextTag(1), true); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = pWriter->EndContainer(dummyType); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } aEventDataIBBuilder.EndOfEventDataIB(); } -void ParseEventDataIB(nlTestSuite * apSuite, EventDataIB::Parser & aEventDataIBParser) +void ParseEventDataIB(EventDataIB::Parser & aEventDataIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; uint8_t priorityLevel = 0; @@ -437,20 +458,31 @@ void ParseEventDataIB(nlTestSuite * apSuite, EventDataIB::Parser & aEventDataIBP { EventPathIB::Parser eventPath; err = aEventDataIBParser.GetPath(&eventPath); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } err = aEventDataIBParser.GetEventNumber(&number); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && number == 2); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(number, 2u); + err = aEventDataIBParser.GetPriority(&priorityLevel); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && priorityLevel == 3); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(priorityLevel, 3u); + err = aEventDataIBParser.GetEpochTimestamp(&EpochTimestamp); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && EpochTimestamp == 4); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(EpochTimestamp, 4u); + err = aEventDataIBParser.GetSystemTimestamp(&systemTimestamp); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && systemTimestamp == 5); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(systemTimestamp, 5u); + err = aEventDataIBParser.GetDeltaEpochTimestamp(&deltaUTCTimestamp); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && deltaUTCTimestamp == 6); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(deltaUTCTimestamp, 6u); + err = aEventDataIBParser.GetDeltaSystemTimestamp(&deltaSystemTimestamp); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && deltaSystemTimestamp == 7); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(deltaSystemTimestamp, 7u); { chip::TLV::TLVReader reader; @@ -458,35 +490,36 @@ void ParseEventDataIB(nlTestSuite * apSuite, EventDataIB::Parser & aEventDataIBP chip::TLV::TLVType container; aEventDataIBParser.GetData(&reader); err = reader.EnterContainer(container); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.Get(val); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && val); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(val); err = reader.ExitContainer(container); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } } } -void BuildEventStatusIB(nlTestSuite * apSuite, EventStatusIB::Builder & aEventStatusIBBuilder) +void BuildEventStatusIB(EventStatusIB::Builder & aEventStatusIBBuilder) { EventPathIB::Builder & eventPathBuilder = aEventStatusIBBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, aEventStatusIBBuilder.GetError() == CHIP_NO_ERROR); - BuildEventPath(apSuite, eventPathBuilder); + EXPECT_EQ(aEventStatusIBBuilder.GetError(), CHIP_NO_ERROR); + BuildEventPath(eventPathBuilder); StatusIB::Builder & statusIBBuilder = aEventStatusIBBuilder.CreateErrorStatus(); - NL_TEST_ASSERT(apSuite, statusIBBuilder.GetError() == CHIP_NO_ERROR); - BuildStatusIB(apSuite, statusIBBuilder); + EXPECT_EQ(statusIBBuilder.GetError(), CHIP_NO_ERROR); + BuildStatusIB(statusIBBuilder); aEventStatusIBBuilder.EndOfEventStatusIB(); - NL_TEST_ASSERT(apSuite, aEventStatusIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aEventStatusIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseEventStatusIB(nlTestSuite * apSuite, EventStatusIB::Parser & aEventStatusIBParser) +void ParseEventStatusIB(EventStatusIB::Parser & aEventStatusIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; EventPathIB::Parser eventPathParser; @@ -495,23 +528,23 @@ void ParseEventStatusIB(nlTestSuite * apSuite, EventStatusIB::Parser & aEventSta aEventStatusIBParser.PrettyPrint(); #endif err = aEventStatusIBParser.GetPath(&eventPathParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = aEventStatusIBParser.GetErrorStatus(&statusParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void BuildEventReportIB(nlTestSuite * apSuite, EventReportIB::Builder & aEventReportIBBuilder) +void BuildEventReportIB(EventReportIB::Builder & aEventReportIBBuilder) { EventDataIB::Builder & eventDataIBBuilder = aEventReportIBBuilder.CreateEventData(); - NL_TEST_ASSERT(apSuite, aEventReportIBBuilder.GetError() == CHIP_NO_ERROR); - BuildEventDataIB(apSuite, eventDataIBBuilder); + EXPECT_EQ(aEventReportIBBuilder.GetError(), CHIP_NO_ERROR); + BuildEventDataIB(eventDataIBBuilder); aEventReportIBBuilder.EndOfEventReportIB(); - NL_TEST_ASSERT(apSuite, aEventReportIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aEventReportIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseEventReportIB(nlTestSuite * apSuite, EventReportIB::Parser & aEventReportIBParser) +void ParseEventReportIB(EventReportIB::Parser & aEventReportIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; EventStatusIB::Parser eventStatusParser; @@ -522,45 +555,45 @@ void ParseEventReportIB(nlTestSuite * apSuite, EventReportIB::Parser & aEventRep #endif err = aEventReportIBParser.GetEventData(&eventDataParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void BuildEventReports(nlTestSuite * apSuite, EventReportIBs::Builder & aEventReportsBuilder) +void BuildEventReports(EventReportIBs::Builder & aEventReportsBuilder) { EventReportIB::Builder & eventReportIBBuilder = aEventReportsBuilder.CreateEventReport(); - NL_TEST_ASSERT(apSuite, aEventReportsBuilder.GetError() == CHIP_NO_ERROR); - BuildEventReportIB(apSuite, eventReportIBBuilder); + EXPECT_EQ(aEventReportsBuilder.GetError(), CHIP_NO_ERROR); + BuildEventReportIB(eventReportIBBuilder); aEventReportsBuilder.EndOfEventReports(); - NL_TEST_ASSERT(apSuite, aEventReportsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aEventReportsBuilder.GetError(), CHIP_NO_ERROR); } -void ParseEventReports(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseEventReports(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; EventReportIBs::Parser eventReportsParser; err = eventReportsParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT eventReportsParser.PrettyPrint(); #endif } -void BuildAttributeStatusIB(nlTestSuite * apSuite, AttributeStatusIB::Builder & aAttributeStatusIBBuilder) +void BuildAttributeStatusIB(AttributeStatusIB::Builder & aAttributeStatusIBBuilder) { AttributePathIB::Builder & attributePathBuilder = aAttributeStatusIBBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, attributePathBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributePathIB(apSuite, attributePathBuilder); + EXPECT_EQ(attributePathBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributePathIB(attributePathBuilder); StatusIB::Builder & statusIBBuilder = aAttributeStatusIBBuilder.CreateErrorStatus(); - NL_TEST_ASSERT(apSuite, statusIBBuilder.GetError() == CHIP_NO_ERROR); - BuildStatusIB(apSuite, statusIBBuilder); + EXPECT_EQ(statusIBBuilder.GetError(), CHIP_NO_ERROR); + BuildStatusIB(statusIBBuilder); aAttributeStatusIBBuilder.EndOfAttributeStatusIB(); - NL_TEST_ASSERT(apSuite, aAttributeStatusIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aAttributeStatusIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseAttributeStatusIB(nlTestSuite * apSuite, AttributeStatusIB::Parser & aAttributeStatusIBParser) +void ParseAttributeStatusIB(AttributeStatusIB::Parser & aAttributeStatusIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; AttributePathIB::Parser attributePathParser; @@ -570,43 +603,43 @@ void ParseAttributeStatusIB(nlTestSuite * apSuite, AttributeStatusIB::Parser & a aAttributeStatusIBParser.PrettyPrint(); #endif err = aAttributeStatusIBParser.GetPath(&attributePathParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = aAttributeStatusIBParser.GetErrorStatus(&StatusIBParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void BuildAttributeStatuses(nlTestSuite * apSuite, AttributeStatusIBs::Builder & aAttributeStatusesBuilder) +void BuildAttributeStatuses(AttributeStatusIBs::Builder & aAttributeStatusesBuilder) { AttributeStatusIB::Builder & aAttributeStatusIBBuilder = aAttributeStatusesBuilder.CreateAttributeStatus(); - NL_TEST_ASSERT(apSuite, aAttributeStatusesBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeStatusIB(apSuite, aAttributeStatusIBBuilder); + EXPECT_EQ(aAttributeStatusesBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeStatusIB(aAttributeStatusIBBuilder); aAttributeStatusesBuilder.EndOfAttributeStatuses(); - NL_TEST_ASSERT(apSuite, aAttributeStatusesBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aAttributeStatusesBuilder.GetError(), CHIP_NO_ERROR); } -void ParseAttributeStatuses(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseAttributeStatuses(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; AttributeStatusIBs::Parser attributeStatusParser; err = attributeStatusParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT attributeStatusParser.PrettyPrint(); #endif } -void BuildAttributeDataIB(nlTestSuite * apSuite, AttributeDataIB::Builder & aAttributeDataIBBuilder) +void BuildAttributeDataIB(AttributeDataIB::Builder & aAttributeDataIBBuilder) { CHIP_ERROR err = CHIP_NO_ERROR; aAttributeDataIBBuilder.DataVersion(2); AttributePathIB::Builder & attributePathBuilder = aAttributeDataIBBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, aAttributeDataIBBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributePathIB(apSuite, attributePathBuilder); + EXPECT_EQ(aAttributeDataIBBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributePathIB(attributePathBuilder); // Construct attribute data { @@ -614,22 +647,22 @@ void BuildAttributeDataIB(nlTestSuite * apSuite, AttributeDataIB::Builder & aAtt chip::TLV::TLVType dummyType = chip::TLV::kTLVType_NotSpecified; err = pWriter->StartContainer(chip::TLV::ContextTag(chip::to_underlying(AttributeDataIB::Tag::kData)), chip::TLV::kTLVType_Structure, dummyType); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = pWriter->PutBoolean(chip::TLV::ContextTag(1), true); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = pWriter->EndContainer(dummyType); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } err = aAttributeDataIBBuilder.GetError(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); aAttributeDataIBBuilder.EndOfAttributeDataIB(); - NL_TEST_ASSERT(apSuite, aAttributeDataIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aAttributeDataIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseAttributeDataIB(nlTestSuite * apSuite, AttributeDataIB::Parser & aAttributeDataIBParser) +void ParseAttributeDataIB(AttributeDataIB::Parser & aAttributeDataIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; AttributePathIB::Parser attributePathParser; @@ -638,10 +671,11 @@ void ParseAttributeDataIB(nlTestSuite * apSuite, AttributeDataIB::Parser & aAttr aAttributeDataIBParser.PrettyPrint(); #endif err = aAttributeDataIBParser.GetPath(&attributePathParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = aAttributeDataIBParser.GetDataVersion(&version); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && version == 2); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(version, 2u); { chip::TLV::TLVReader reader; @@ -649,52 +683,53 @@ void ParseAttributeDataIB(nlTestSuite * apSuite, AttributeDataIB::Parser & aAttr chip::TLV::TLVType container; aAttributeDataIBParser.GetData(&reader); err = reader.EnterContainer(container); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.Get(val); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && val); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(val); err = reader.ExitContainer(container); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } } -void BuildAttributeDataIBs(nlTestSuite * apSuite, AttributeDataIBs::Builder & aAttributeDataIBsBuilder) +void BuildAttributeDataIBs(AttributeDataIBs::Builder & aAttributeDataIBsBuilder) { AttributeDataIB::Builder & attributeDataIBBuilder = aAttributeDataIBsBuilder.CreateAttributeDataIBBuilder(); - NL_TEST_ASSERT(apSuite, aAttributeDataIBsBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeDataIB(apSuite, attributeDataIBBuilder); + EXPECT_EQ(aAttributeDataIBsBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeDataIB(attributeDataIBBuilder); aAttributeDataIBsBuilder.EndOfAttributeDataIBs(); - NL_TEST_ASSERT(apSuite, aAttributeDataIBsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aAttributeDataIBsBuilder.GetError(), CHIP_NO_ERROR); } -void ParseAttributeDataIBs(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseAttributeDataIBs(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; AttributeDataIBs::Parser AttributeDataIBsParser; err = AttributeDataIBsParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT AttributeDataIBsParser.PrettyPrint(); #endif } -void BuildAttributeReportIB(nlTestSuite * apSuite, AttributeReportIB::Builder & aAttributeReportIBBuilder) +void BuildAttributeReportIB(AttributeReportIB::Builder & aAttributeReportIBBuilder) { AttributeDataIB::Builder & attributeDataIBBuilder = aAttributeReportIBBuilder.CreateAttributeData(); - NL_TEST_ASSERT(apSuite, aAttributeReportIBBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeDataIB(apSuite, attributeDataIBBuilder); + EXPECT_EQ(aAttributeReportIBBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeDataIB(attributeDataIBBuilder); aAttributeReportIBBuilder.EndOfAttributeReportIB(); - NL_TEST_ASSERT(apSuite, aAttributeReportIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aAttributeReportIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseAttributeReportIB(nlTestSuite * apSuite, AttributeReportIB::Parser & aAttributeReportIBParser) +void ParseAttributeReportIB(AttributeReportIB::Parser & aAttributeReportIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; AttributeStatusIB::Parser attributeStatusParser; @@ -704,38 +739,38 @@ void ParseAttributeReportIB(nlTestSuite * apSuite, AttributeReportIB::Parser & a aAttributeReportIBParser.PrettyPrint(); #endif err = aAttributeReportIBParser.GetAttributeData(&attributeDataParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void BuildAttributeReportIBs(nlTestSuite * apSuite, AttributeReportIBs::Builder & aAttributeReportIBsBuilder) +void BuildAttributeReportIBs(AttributeReportIBs::Builder & aAttributeReportIBsBuilder) { AttributeReportIB::Builder & attributeReportIBBuilder = aAttributeReportIBsBuilder.CreateAttributeReport(); - NL_TEST_ASSERT(apSuite, aAttributeReportIBsBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeReportIB(apSuite, attributeReportIBBuilder); + EXPECT_EQ(aAttributeReportIBsBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeReportIB(attributeReportIBBuilder); aAttributeReportIBsBuilder.EndOfAttributeReportIBs(); - NL_TEST_ASSERT(apSuite, aAttributeReportIBsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aAttributeReportIBsBuilder.GetError(), CHIP_NO_ERROR); } -void ParseAttributeReportIBs(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseAttributeReportIBs(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; AttributeReportIBs::Parser attributeReportIBsParser; err = attributeReportIBsParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT attributeReportIBsParser.PrettyPrint(); #endif } -void BuildCommandDataIB(nlTestSuite * apSuite, CommandDataIB::Builder & aCommandDataIBBuilder) +void BuildCommandDataIB(CommandDataIB::Builder & aCommandDataIBBuilder) { CHIP_ERROR err = CHIP_NO_ERROR; CommandPathIB::Builder & commandPathBuilder = aCommandDataIBBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, aCommandDataIBBuilder.GetError() == CHIP_NO_ERROR); - BuildCommandPath(apSuite, commandPathBuilder); + EXPECT_EQ(aCommandDataIBBuilder.GetError(), CHIP_NO_ERROR); + BuildCommandPath(commandPathBuilder); // Construct command data { @@ -743,20 +778,20 @@ void BuildCommandDataIB(nlTestSuite * apSuite, CommandDataIB::Builder & aCommand chip::TLV::TLVType dummyType = chip::TLV::kTLVType_NotSpecified; err = pWriter->StartContainer(chip::TLV::ContextTag(chip::to_underlying(CommandDataIB::Tag::kFields)), chip::TLV::kTLVType_Structure, dummyType); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = pWriter->PutBoolean(chip::TLV::ContextTag(1), true); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = pWriter->EndContainer(dummyType); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } aCommandDataIBBuilder.EndOfCommandDataIB(); - NL_TEST_ASSERT(apSuite, aCommandDataIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aCommandDataIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseCommandDataIB(nlTestSuite * apSuite, CommandDataIB::Parser & aCommandDataIBParser) +void ParseCommandDataIB(CommandDataIB::Parser & aCommandDataIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; CommandPathIB::Parser commandPathParser; @@ -764,7 +799,7 @@ void ParseCommandDataIB(nlTestSuite * apSuite, CommandDataIB::Parser & aCommandD aCommandDataIBParser.PrettyPrint(); #endif err = aCommandDataIBParser.GetPath(&commandPathParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); { chip::TLV::TLVReader reader; @@ -772,34 +807,35 @@ void ParseCommandDataIB(nlTestSuite * apSuite, CommandDataIB::Parser & aCommandD chip::TLV::TLVType container; aCommandDataIBParser.GetFields(&reader); err = reader.EnterContainer(container); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reader.Get(val); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && val); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(val); err = reader.ExitContainer(container); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } } -void BuildCommandStatusIB(nlTestSuite * apSuite, CommandStatusIB::Builder & aCommandStatusIBBuilder) +void BuildCommandStatusIB(CommandStatusIB::Builder & aCommandStatusIBBuilder) { CommandPathIB::Builder & commandPathBuilder = aCommandStatusIBBuilder.CreatePath(); - NL_TEST_ASSERT(apSuite, aCommandStatusIBBuilder.GetError() == CHIP_NO_ERROR); - BuildCommandPath(apSuite, commandPathBuilder); + EXPECT_EQ(aCommandStatusIBBuilder.GetError(), CHIP_NO_ERROR); + BuildCommandPath(commandPathBuilder); StatusIB::Builder & statusIBBuilder = aCommandStatusIBBuilder.CreateErrorStatus(); - NL_TEST_ASSERT(apSuite, statusIBBuilder.GetError() == CHIP_NO_ERROR); - BuildStatusIB(apSuite, statusIBBuilder); + EXPECT_EQ(statusIBBuilder.GetError(), CHIP_NO_ERROR); + BuildStatusIB(statusIBBuilder); aCommandStatusIBBuilder.EndOfCommandStatusIB(); - NL_TEST_ASSERT(apSuite, aCommandStatusIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aCommandStatusIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseCommandStatusIB(nlTestSuite * apSuite, CommandStatusIB::Parser & aCommandStatusIBParser) +void ParseCommandStatusIB(CommandStatusIB::Parser & aCommandStatusIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; CommandPathIB::Parser commandPathParser; @@ -808,37 +844,37 @@ void ParseCommandStatusIB(nlTestSuite * apSuite, CommandStatusIB::Parser & aComm aCommandStatusIBParser.PrettyPrint(); #endif err = aCommandStatusIBParser.GetPath(&commandPathParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = aCommandStatusIBParser.GetErrorStatus(&statusParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void BuildWrongInvokeResponseIB(nlTestSuite * apSuite, InvokeResponseIB::Builder & aInvokeResponseIBBuilder) +void BuildWrongInvokeResponseIB(InvokeResponseIB::Builder & aInvokeResponseIBBuilder) { aInvokeResponseIBBuilder.CreateCommand(); - NL_TEST_ASSERT(apSuite, aInvokeResponseIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aInvokeResponseIBBuilder.GetError(), CHIP_NO_ERROR); } -void BuildInvokeResponseIBWithCommandDataIB(nlTestSuite * apSuite, InvokeResponseIB::Builder & aInvokeResponseIBBuilder) +void BuildInvokeResponseIBWithCommandDataIB(InvokeResponseIB::Builder & aInvokeResponseIBBuilder) { CommandDataIB::Builder & commandDataBuilder = aInvokeResponseIBBuilder.CreateCommand(); - NL_TEST_ASSERT(apSuite, aInvokeResponseIBBuilder.GetError() == CHIP_NO_ERROR); - BuildCommandDataIB(apSuite, commandDataBuilder); + EXPECT_EQ(aInvokeResponseIBBuilder.GetError(), CHIP_NO_ERROR); + BuildCommandDataIB(commandDataBuilder); aInvokeResponseIBBuilder.EndOfInvokeResponseIB(); - NL_TEST_ASSERT(apSuite, aInvokeResponseIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aInvokeResponseIBBuilder.GetError(), CHIP_NO_ERROR); } -void BuildInvokeResponseIBWithCommandStatusIB(nlTestSuite * apSuite, InvokeResponseIB::Builder & aInvokeResponseIBBuilder) +void BuildInvokeResponseIBWithCommandStatusIB(InvokeResponseIB::Builder & aInvokeResponseIBBuilder) { CommandStatusIB::Builder & commandStatusBuilder = aInvokeResponseIBBuilder.CreateStatus(); - NL_TEST_ASSERT(apSuite, aInvokeResponseIBBuilder.GetError() == CHIP_NO_ERROR); - BuildCommandStatusIB(apSuite, commandStatusBuilder); + EXPECT_EQ(aInvokeResponseIBBuilder.GetError(), CHIP_NO_ERROR); + BuildCommandStatusIB(commandStatusBuilder); aInvokeResponseIBBuilder.EndOfInvokeResponseIB(); - NL_TEST_ASSERT(apSuite, aInvokeResponseIBBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aInvokeResponseIBBuilder.GetError(), CHIP_NO_ERROR); } -void ParseInvokeResponseIBWithCommandDataIB(nlTestSuite * apSuite, InvokeResponseIB::Parser & aInvokeResponseIBParser) +void ParseInvokeResponseIBWithCommandDataIB(InvokeResponseIB::Parser & aInvokeResponseIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; CommandDataIB::Parser commandDataParser; @@ -847,10 +883,10 @@ void ParseInvokeResponseIBWithCommandDataIB(nlTestSuite * apSuite, InvokeRespons aInvokeResponseIBParser.PrettyPrint(); #endif err = aInvokeResponseIBParser.GetCommand(&commandDataParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void ParseInvokeResponseIBWithCommandStatusIB(nlTestSuite * apSuite, InvokeResponseIB::Parser & aInvokeResponseIBParser) +void ParseInvokeResponseIBWithCommandStatusIB(InvokeResponseIB::Parser & aInvokeResponseIBParser) { CHIP_ERROR err = CHIP_NO_ERROR; CommandDataIB::Parser commandDataParser; @@ -859,90 +895,90 @@ void ParseInvokeResponseIBWithCommandStatusIB(nlTestSuite * apSuite, InvokeRespo aInvokeResponseIBParser.PrettyPrint(); #endif err = aInvokeResponseIBParser.GetStatus(&statusIBParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void BuildInvokeRequests(nlTestSuite * apSuite, InvokeRequests::Builder & aInvokeRequestsBuilder) +void BuildInvokeRequests(InvokeRequests::Builder & aInvokeRequestsBuilder) { CommandDataIB::Builder & aCommandDataIBBuilder = aInvokeRequestsBuilder.CreateCommandData(); - NL_TEST_ASSERT(apSuite, aInvokeRequestsBuilder.GetError() == CHIP_NO_ERROR); - BuildCommandDataIB(apSuite, aCommandDataIBBuilder); + EXPECT_EQ(aInvokeRequestsBuilder.GetError(), CHIP_NO_ERROR); + BuildCommandDataIB(aCommandDataIBBuilder); aInvokeRequestsBuilder.EndOfInvokeRequests(); - NL_TEST_ASSERT(apSuite, aInvokeRequestsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aInvokeRequestsBuilder.GetError(), CHIP_NO_ERROR); } -void ParseInvokeRequests(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseInvokeRequests(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeRequests::Parser invokeRequestsParser; err = invokeRequestsParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT invokeRequestsParser.PrettyPrint(); #endif } -void BuildInvokeResponses(nlTestSuite * apSuite, InvokeResponseIBs::Builder & aInvokeResponsesBuilder) +void BuildInvokeResponses(InvokeResponseIBs::Builder & aInvokeResponsesBuilder) { InvokeResponseIB::Builder & invokeResponseIBBuilder = aInvokeResponsesBuilder.CreateInvokeResponse(); - NL_TEST_ASSERT(apSuite, aInvokeResponsesBuilder.GetError() == CHIP_NO_ERROR); - BuildInvokeResponseIBWithCommandDataIB(apSuite, invokeResponseIBBuilder); + EXPECT_EQ(aInvokeResponsesBuilder.GetError(), CHIP_NO_ERROR); + BuildInvokeResponseIBWithCommandDataIB(invokeResponseIBBuilder); aInvokeResponsesBuilder.EndOfInvokeResponses(); - NL_TEST_ASSERT(apSuite, aInvokeResponsesBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(aInvokeResponsesBuilder.GetError(), CHIP_NO_ERROR); } -void ParseInvokeResponses(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseInvokeResponses(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeResponseIBs::Parser invokeResponsesParser; err = invokeResponsesParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT invokeResponsesParser.PrettyPrint(); #endif } -void BuildInvokeRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildInvokeRequestMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeRequestMessage::Builder invokeRequestMessageBuilder; err = invokeRequestMessageBuilder.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); invokeRequestMessageBuilder.SuppressResponse(true); invokeRequestMessageBuilder.TimedRequest(true); InvokeRequests::Builder & invokeRequestsBuilder = invokeRequestMessageBuilder.CreateInvokeRequests(); - NL_TEST_ASSERT(apSuite, invokeRequestsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(invokeRequestsBuilder.GetError(), CHIP_NO_ERROR); - BuildInvokeRequests(apSuite, invokeRequestsBuilder); + BuildInvokeRequests(invokeRequestsBuilder); invokeRequestMessageBuilder.EndOfInvokeRequestMessage(); - NL_TEST_ASSERT(apSuite, invokeRequestMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(invokeRequestMessageBuilder.GetError(), CHIP_NO_ERROR); } -void ParseInvokeRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseInvokeRequestMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeRequestMessage::Parser invokeRequestMessageParser; err = invokeRequestMessageParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); bool suppressResponse = false; bool timedRequest = false; invokeRequestMessageParser.GetSuppressResponse(&suppressResponse); invokeRequestMessageParser.GetTimedRequest(&timedRequest); - NL_TEST_ASSERT(apSuite, suppressResponse == true); - NL_TEST_ASSERT(apSuite, timedRequest == true); + EXPECT_TRUE(suppressResponse); + EXPECT_TRUE(timedRequest); #if CHIP_CONFIG_IM_PRETTY_PRINT invokeRequestMessageParser.PrettyPrint(); #endif - NL_TEST_ASSERT(apSuite, invokeRequestMessageParser.ExitContainer() == CHIP_NO_ERROR); + EXPECT_EQ(invokeRequestMessageParser.ExitContainer(), CHIP_NO_ERROR); } -void BuildInvokeResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildInvokeResponseMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeResponseMessage::Builder invokeResponseMessageBuilder; @@ -950,67 +986,67 @@ void BuildInvokeResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aW invokeResponseMessageBuilder.SuppressResponse(true); InvokeResponseIBs::Builder & invokeResponsesBuilder = invokeResponseMessageBuilder.CreateInvokeResponses(); - NL_TEST_ASSERT(apSuite, invokeResponseMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(invokeResponseMessageBuilder.GetError(), CHIP_NO_ERROR); - BuildInvokeResponses(apSuite, invokeResponsesBuilder); + BuildInvokeResponses(invokeResponsesBuilder); invokeResponseMessageBuilder.MoreChunkedMessages(true); - NL_TEST_ASSERT(apSuite, invokeResponseMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(invokeResponseMessageBuilder.GetError(), CHIP_NO_ERROR); invokeResponseMessageBuilder.EndOfInvokeResponseMessage(); - NL_TEST_ASSERT(apSuite, invokeResponseMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(invokeResponseMessageBuilder.GetError(), CHIP_NO_ERROR); } -void ParseInvokeResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseInvokeResponseMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeResponseMessage::Parser invokeResponseMessageParser; err = invokeResponseMessageParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); bool suppressResponse = false; err = invokeResponseMessageParser.GetSuppressResponse(&suppressResponse); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, suppressResponse == true); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(suppressResponse); bool moreChunkedMessages = true; err = invokeResponseMessageParser.GetMoreChunkedMessages(&suppressResponse); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, moreChunkedMessages == true); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(moreChunkedMessages); #if CHIP_CONFIG_IM_PRETTY_PRINT invokeResponseMessageParser.PrettyPrint(); #endif - NL_TEST_ASSERT(apSuite, invokeResponseMessageParser.ExitContainer() == CHIP_NO_ERROR); + EXPECT_EQ(invokeResponseMessageParser.ExitContainer(), CHIP_NO_ERROR); } -void BuildReportDataMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildReportDataMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; ReportDataMessage::Builder reportDataMessageBuilder; err = reportDataMessageBuilder.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); reportDataMessageBuilder.SubscriptionId(2); - NL_TEST_ASSERT(apSuite, reportDataMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(reportDataMessageBuilder.GetError(), CHIP_NO_ERROR); AttributeReportIBs::Builder & attributeReportIBs = reportDataMessageBuilder.CreateAttributeReportIBs(); - NL_TEST_ASSERT(apSuite, reportDataMessageBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeReportIBs(apSuite, attributeReportIBs); + EXPECT_EQ(reportDataMessageBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeReportIBs(attributeReportIBs); EventReportIBs::Builder & eventReportIBs = reportDataMessageBuilder.CreateEventReports(); - NL_TEST_ASSERT(apSuite, reportDataMessageBuilder.GetError() == CHIP_NO_ERROR); - BuildEventReports(apSuite, eventReportIBs); + EXPECT_EQ(reportDataMessageBuilder.GetError(), CHIP_NO_ERROR); + BuildEventReports(eventReportIBs); reportDataMessageBuilder.MoreChunkedMessages(true).SuppressResponse(true); - NL_TEST_ASSERT(apSuite, reportDataMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(reportDataMessageBuilder.GetError(), CHIP_NO_ERROR); reportDataMessageBuilder.EndOfReportDataMessage(); - NL_TEST_ASSERT(apSuite, reportDataMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(reportDataMessageBuilder.GetError(), CHIP_NO_ERROR); } -void ParseReportDataMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseReportDataMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; ReportDataMessage::Parser reportDataParser; @@ -1026,55 +1062,58 @@ void ParseReportDataMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReade reportDataParser.PrettyPrint(); #endif err = reportDataParser.GetSuppressResponse(&suppressResponse); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && suppressResponse); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(suppressResponse); err = reportDataParser.GetSubscriptionId(&subscriptionId); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && subscriptionId == 2); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(subscriptionId, 2u); err = reportDataParser.GetAttributeReportIBs(&attributeReportIBsParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reportDataParser.GetEventReports(&eventReportsParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = reportDataParser.GetMoreChunkedMessages(&moreChunkedMessages); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && moreChunkedMessages); - NL_TEST_ASSERT(apSuite, reportDataParser.ExitContainer() == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(moreChunkedMessages); + EXPECT_EQ(reportDataParser.ExitContainer(), CHIP_NO_ERROR); } -void BuildReadRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildReadRequestMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; ReadRequestMessage::Builder readRequestBuilder; err = readRequestBuilder.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); AttributePathIBs::Builder & attributePathIBs = readRequestBuilder.CreateAttributeRequests(); - NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributePathList(apSuite, attributePathIBs); + EXPECT_EQ(readRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributePathList(attributePathIBs); EventPathIBs::Builder & eventPathList = readRequestBuilder.CreateEventRequests(); - NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildEventPaths(apSuite, eventPathList); + EXPECT_EQ(readRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildEventPaths(eventPathList); EventFilterIBs::Builder & eventFilters = readRequestBuilder.CreateEventFilters(); - NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildEventFilters(apSuite, eventFilters); + EXPECT_EQ(readRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildEventFilters(eventFilters); readRequestBuilder.IsFabricFiltered(true); - NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(readRequestBuilder.GetError(), CHIP_NO_ERROR); DataVersionFilterIBs::Builder & dataVersionFilters = readRequestBuilder.CreateDataVersionFilters(); - NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildDataVersionFilterIBs(apSuite, dataVersionFilters); + EXPECT_EQ(readRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildDataVersionFilterIBs(dataVersionFilters); readRequestBuilder.EndOfReadRequestMessage(); - NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(readRequestBuilder.GetError(), CHIP_NO_ERROR); } -void ParseReadRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseReadRequestMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -1086,53 +1125,54 @@ void ParseReadRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aRead bool isFabricFiltered = false; err = readRequestParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT readRequestParser.PrettyPrint(); #endif err = readRequestParser.GetAttributeRequests(&attributePathListParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = readRequestParser.GetDataVersionFilters(&dataVersionFilterIBsParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = readRequestParser.GetEventRequests(&eventPathListParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = readRequestParser.GetEventFilters(&eventFiltersParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = readRequestParser.GetIsFabricFiltered(&isFabricFiltered); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && isFabricFiltered); - NL_TEST_ASSERT(apSuite, readRequestParser.ExitContainer() == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(isFabricFiltered); + EXPECT_EQ(readRequestParser.ExitContainer(), CHIP_NO_ERROR); } -void BuildWriteRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildWriteRequestMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; WriteRequestMessage::Builder writeRequestBuilder; err = writeRequestBuilder.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); writeRequestBuilder.SuppressResponse(true); - NL_TEST_ASSERT(apSuite, writeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(writeRequestBuilder.GetError(), CHIP_NO_ERROR); writeRequestBuilder.TimedRequest(true); - NL_TEST_ASSERT(apSuite, writeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(writeRequestBuilder.GetError(), CHIP_NO_ERROR); AttributeDataIBs::Builder & attributeDataIBs = writeRequestBuilder.CreateWriteRequests(); - NL_TEST_ASSERT(apSuite, writeRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeDataIBs(apSuite, attributeDataIBs); + EXPECT_EQ(writeRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeDataIBs(attributeDataIBs); writeRequestBuilder.MoreChunkedMessages(true); - NL_TEST_ASSERT(apSuite, writeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(writeRequestBuilder.GetError(), CHIP_NO_ERROR); writeRequestBuilder.EndOfWriteRequestMessage(); - NL_TEST_ASSERT(apSuite, writeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(writeRequestBuilder.GetError(), CHIP_NO_ERROR); } -void ParseWriteRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseWriteRequestMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -1143,97 +1183,100 @@ void ParseWriteRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aRea bool moreChunkedMessages = false; err = writeRequestParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT writeRequestParser.PrettyPrint(); #endif err = writeRequestParser.GetSuppressResponse(&suppressResponse); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && suppressResponse); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(suppressResponse); err = writeRequestParser.GetTimedRequest(&timeRequest); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && timeRequest); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(timeRequest); err = writeRequestParser.GetWriteRequests(&writeRequests); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writeRequestParser.GetMoreChunkedMessages(&moreChunkedMessages); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR && moreChunkedMessages); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(moreChunkedMessages); } -void BuildWriteResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildWriteResponseMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; WriteResponseMessage::Builder writeResponseBuilder; err = writeResponseBuilder.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); AttributeStatusIBs::Builder & attributeStatuses = writeResponseBuilder.CreateWriteResponses(); - NL_TEST_ASSERT(apSuite, writeResponseBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeStatuses(apSuite, attributeStatuses); + EXPECT_EQ(writeResponseBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeStatuses(attributeStatuses); writeResponseBuilder.EndOfWriteResponseMessage(); - NL_TEST_ASSERT(apSuite, writeResponseBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(writeResponseBuilder.GetError(), CHIP_NO_ERROR); } -void ParseWriteResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseWriteResponseMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; WriteResponseMessage::Parser writeResponseParser; AttributeStatusIBs::Parser attributeStatusesParser; err = writeResponseParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT writeResponseParser.PrettyPrint(); #endif err = writeResponseParser.GetWriteResponses(&attributeStatusesParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, writeResponseParser.ExitContainer() == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(writeResponseParser.ExitContainer(), CHIP_NO_ERROR); } -void BuildSubscribeRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildSubscribeRequestMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; SubscribeRequestMessage::Builder subscribeRequestBuilder; err = subscribeRequestBuilder.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); subscribeRequestBuilder.KeepSubscriptions(true); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); subscribeRequestBuilder.MinIntervalFloorSeconds(2); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); subscribeRequestBuilder.MaxIntervalCeilingSeconds(3); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); AttributePathIBs::Builder & attributePathIBs = subscribeRequestBuilder.CreateAttributeRequests(); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributePathList(apSuite, attributePathIBs); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributePathList(attributePathIBs); EventPathIBs::Builder & eventPathList = subscribeRequestBuilder.CreateEventRequests(); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildEventPaths(apSuite, eventPathList); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildEventPaths(eventPathList); EventFilterIBs::Builder & eventFilters = subscribeRequestBuilder.CreateEventFilters(); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildEventFilters(apSuite, eventFilters); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildEventFilters(eventFilters); subscribeRequestBuilder.IsFabricFiltered(true); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); DataVersionFilterIBs::Builder & dataVersionFilters = subscribeRequestBuilder.CreateDataVersionFilters(); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); - BuildDataVersionFilterIBs(apSuite, dataVersionFilters); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); + BuildDataVersionFilterIBs(dataVersionFilters); subscribeRequestBuilder.EndOfSubscribeRequestMessage(); - NL_TEST_ASSERT(apSuite, subscribeRequestBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeRequestBuilder.GetError(), CHIP_NO_ERROR); } -void ParseSubscribeRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseSubscribeRequestMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -1248,55 +1291,57 @@ void ParseSubscribeRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & bool isFabricFiltered = false; err = subscribeRequestParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT subscribeRequestParser.PrettyPrint(); #endif err = subscribeRequestParser.GetAttributeRequests(&attributePathListParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = subscribeRequestParser.GetDataVersionFilters(&dataVersionFilterIBsParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = subscribeRequestParser.GetEventRequests(&eventPathListParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = subscribeRequestParser.GetEventFilters(&eventFiltersParser); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = subscribeRequestParser.GetMinIntervalFloorSeconds(&minIntervalFloorSeconds); - NL_TEST_ASSERT(apSuite, minIntervalFloorSeconds == 2 && err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(minIntervalFloorSeconds, 2u); err = subscribeRequestParser.GetMaxIntervalCeilingSeconds(&maxIntervalCeilingSeconds); - NL_TEST_ASSERT(apSuite, maxIntervalCeilingSeconds == 3 && err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(maxIntervalCeilingSeconds, 3u); err = subscribeRequestParser.GetKeepSubscriptions(&keepExistingSubscription); - NL_TEST_ASSERT(apSuite, keepExistingSubscription && err == CHIP_NO_ERROR); + EXPECT_TRUE(keepExistingSubscription); err = subscribeRequestParser.GetIsFabricFiltered(&isFabricFiltered); - NL_TEST_ASSERT(apSuite, isFabricFiltered && err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, subscribeRequestParser.ExitContainer() == CHIP_NO_ERROR); + EXPECT_TRUE(isFabricFiltered); + EXPECT_EQ(subscribeRequestParser.ExitContainer(), CHIP_NO_ERROR); } -void BuildSubscribeResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildSubscribeResponseMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; SubscribeResponseMessage::Builder subscribeResponseBuilder; err = subscribeResponseBuilder.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); subscribeResponseBuilder.SubscriptionId(1); - NL_TEST_ASSERT(apSuite, subscribeResponseBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeResponseBuilder.GetError(), CHIP_NO_ERROR); subscribeResponseBuilder.MaxInterval(2); - NL_TEST_ASSERT(apSuite, subscribeResponseBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeResponseBuilder.GetError(), CHIP_NO_ERROR); subscribeResponseBuilder.EndOfSubscribeResponseMessage(); - NL_TEST_ASSERT(apSuite, subscribeResponseBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeResponseBuilder.GetError(), CHIP_NO_ERROR); } -void ParseSubscribeResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseSubscribeResponseMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -1304,32 +1349,34 @@ void ParseSubscribeResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & chip::SubscriptionId subscriptionId = 0; uint16_t maxInterval = 0; err = subscribeResponseParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT subscribeResponseParser.PrettyPrint(); #endif err = subscribeResponseParser.GetSubscriptionId(&subscriptionId); - NL_TEST_ASSERT(apSuite, subscriptionId == 1 && err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(subscriptionId, 1u); err = subscribeResponseParser.GetMaxInterval(&maxInterval); - NL_TEST_ASSERT(apSuite, maxInterval == 2 && err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(maxInterval, 2u); - NL_TEST_ASSERT(apSuite, subscribeResponseParser.ExitContainer() == CHIP_NO_ERROR); + EXPECT_EQ(subscribeResponseParser.ExitContainer(), CHIP_NO_ERROR); } -void BuildTimedRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +void BuildTimedRequestMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; TimedRequestMessage::Builder TimedRequestMessageBuilder; err = TimedRequestMessageBuilder.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); TimedRequestMessageBuilder.TimeoutMs(1); - NL_TEST_ASSERT(apSuite, TimedRequestMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(TimedRequestMessageBuilder.GetError(), CHIP_NO_ERROR); } -void ParseTimedRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) +void ParseTimedRequestMessage(chip::TLV::TLVReader & aReader) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -1337,17 +1384,19 @@ void ParseTimedRequestMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aRea uint16_t timeout = 0; err = timedRequestMessageParser.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT timedRequestMessageParser.PrettyPrint(); #endif err = timedRequestMessageParser.GetTimeoutMs(&timeout); - NL_TEST_ASSERT(apSuite, timeout == 1 && err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + + EXPECT_EQ(timeout, 1u); - NL_TEST_ASSERT(apSuite, timedRequestMessageParser.ExitContainer() == CHIP_NO_ERROR); + EXPECT_EQ(timedRequestMessageParser.ExitContainer(), CHIP_NO_ERROR); } -void DataVersionFilterIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestDataVersionFilterIB) { CHIP_ERROR err = CHIP_NO_ERROR; DataVersionFilterIB::Builder dataVersionFilterIBBuilder; @@ -1355,20 +1404,20 @@ void DataVersionFilterIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); dataVersionFilterIBBuilder.Init(&writer); - BuildDataVersionFilterIB(apSuite, dataVersionFilterIBBuilder); + BuildDataVersionFilterIB(dataVersionFilterIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseDataVersionFilterIB(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseDataVersionFilterIB(reader); } -void DataVersionFilterIBsTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestDataVersionFilterIBs) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1377,22 +1426,22 @@ void DataVersionFilterIBsTest(nlTestSuite * apSuite, void * apContext) writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); err = dataVersionFilterIBsBuilder.Init(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - BuildDataVersionFilterIBs(apSuite, dataVersionFilterIBsBuilder); + BuildDataVersionFilterIBs(dataVersionFilterIBsBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseDataVersionFilterIBs(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseDataVersionFilterIBs(reader); } -void EventFilterTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEventFilter) { CHIP_ERROR err = CHIP_NO_ERROR; EventFilterIB::Builder eventFilterBuilder; @@ -1400,20 +1449,20 @@ void EventFilterTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); eventFilterBuilder.Init(&writer); - BuildEventFilterIB(apSuite, eventFilterBuilder); + BuildEventFilterIB(eventFilterBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseEventFilterIB(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseEventFilterIB(reader); } -void EventFiltersTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEventFilters) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1423,22 +1472,22 @@ void EventFiltersTest(nlTestSuite * apSuite, void * apContext) writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); err = eventFiltersBuilder.Init(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - BuildEventFilters(apSuite, eventFiltersBuilder); + BuildEventFilters(eventFiltersBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseEventFilters(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseEventFilters(reader); } -void ClusterPathIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestClusterPathIB) { CHIP_ERROR err = CHIP_NO_ERROR; ClusterPathIB::Builder clusterPathBuilder; @@ -1446,21 +1495,21 @@ void ClusterPathIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); clusterPathBuilder.Init(&writer); - BuildClusterPathIB(apSuite, clusterPathBuilder); + BuildClusterPathIB(clusterPathBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - ParseClusterPathIB(apSuite, reader); + ParseClusterPathIB(reader); } -void AttributePathTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestAttributePath) { CHIP_ERROR err = CHIP_NO_ERROR; AttributePathIB::Builder attributePathBuilder; @@ -1468,21 +1517,21 @@ void AttributePathTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); attributePathBuilder.Init(&writer); - BuildAttributePathIB(apSuite, attributePathBuilder); + BuildAttributePathIB(attributePathBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - ParseAttributePathIB(apSuite, reader); + ParseAttributePathIB(reader); } -void AttributePathListTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestAttributePathList) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1492,22 +1541,22 @@ void AttributePathListTest(nlTestSuite * apSuite, void * apContext) writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); err = attributePathListBuilder.Init(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - BuildAttributePathList(apSuite, attributePathListBuilder); + BuildAttributePathList(attributePathListBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseAttributePathList(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseAttributePathList(reader); } -void EventPathTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEventPath) { CHIP_ERROR err = CHIP_NO_ERROR; EventPathIB::Parser eventPathParser; @@ -1516,22 +1565,22 @@ void EventPathTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); eventPathBuilder.Init(&writer); - BuildEventPath(apSuite, eventPathBuilder); + BuildEventPath(eventPathBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); eventPathParser.Init(reader); - ParseEventPath(apSuite, eventPathParser); + ParseEventPath(eventPathParser); } -void EventPathsTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEventPaths) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1541,22 +1590,22 @@ void EventPathsTest(nlTestSuite * apSuite, void * apContext) writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); err = eventPathListBuilder.Init(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - BuildEventPaths(apSuite, eventPathListBuilder); + BuildEventPaths(eventPathListBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseEventPaths(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseEventPaths(reader); } -void CommandPathIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestCommandPathIB) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1564,24 +1613,24 @@ void CommandPathIBTest(nlTestSuite * apSuite, void * apContext) CommandPathIB::Builder commandPathBuilder; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); err = commandPathBuilder.Init(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - BuildCommandPath(apSuite, commandPathBuilder); + BuildCommandPath(commandPathBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - ParseCommandPath(apSuite, reader); + ParseCommandPath(reader); } -void EventDataIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEventDataIB) { CHIP_ERROR err = CHIP_NO_ERROR; EventDataIB::Builder eventDataIBBuilder; @@ -1590,22 +1639,22 @@ void EventDataIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); eventDataIBBuilder.Init(&writer); - BuildEventDataIB(apSuite, eventDataIBBuilder); + BuildEventDataIB(eventDataIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); eventDataIBParser.Init(reader); - ParseEventDataIB(apSuite, eventDataIBParser); + ParseEventDataIB(eventDataIBParser); } -void EventReportIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEventReportIB) { CHIP_ERROR err = CHIP_NO_ERROR; EventReportIB::Builder eventReportIBBuilder; @@ -1614,22 +1663,22 @@ void EventReportIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); eventReportIBBuilder.Init(&writer); - BuildEventReportIB(apSuite, eventReportIBBuilder); + BuildEventReportIB(eventReportIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); eventReportIBParser.Init(reader); - ParseEventReportIB(apSuite, eventReportIBParser); + ParseEventReportIB(eventReportIBParser); } -void EventReportsTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEventReports) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1637,20 +1686,20 @@ void EventReportsTest(nlTestSuite * apSuite, void * apContext) EventReportIBs::Builder eventReportsBuilder; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); eventReportsBuilder.Init(&writer); - BuildEventReports(apSuite, eventReportsBuilder); + BuildEventReports(eventReportsBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseEventReports(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseEventReports(reader); } -void EmptyEventReportsTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEmptyEventReports) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1659,20 +1708,20 @@ void EmptyEventReportsTest(nlTestSuite * apSuite, void * apContext) writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); eventReportsBuilder.Init(&writer); eventReportsBuilder.EndOfEventReports(); - NL_TEST_ASSERT(apSuite, eventReportsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(eventReportsBuilder.GetError(), CHIP_NO_ERROR); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseEventReports(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseEventReports(reader); } -void AttributeReportIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestAttributeReportIB) { CHIP_ERROR err = CHIP_NO_ERROR; AttributeReportIB::Builder attributeReportIBBuilder; @@ -1681,22 +1730,22 @@ void AttributeReportIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); attributeReportIBBuilder.Init(&writer); - BuildAttributeReportIB(apSuite, attributeReportIBBuilder); + BuildAttributeReportIB(attributeReportIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); attributeReportIBParser.Init(reader); - ParseAttributeReportIB(apSuite, attributeReportIBParser); + ParseAttributeReportIB(attributeReportIBParser); } -void AttributeReportIBsTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestAttributeReportIBs) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1704,20 +1753,20 @@ void AttributeReportIBsTest(nlTestSuite * apSuite, void * apContext) AttributeReportIBs::Builder attributeReportIBsBuilder; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); attributeReportIBsBuilder.Init(&writer); - BuildAttributeReportIBs(apSuite, attributeReportIBsBuilder); + BuildAttributeReportIBs(attributeReportIBsBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseAttributeReportIBs(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseAttributeReportIBs(reader); } -void EmptyAttributeReportIBsTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEmptyAttributeReportIBs) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1726,20 +1775,20 @@ void EmptyAttributeReportIBsTest(nlTestSuite * apSuite, void * apContext) writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); attributeReportIBsBuilder.Init(&writer); attributeReportIBsBuilder.EndOfAttributeReportIBs(); - NL_TEST_ASSERT(apSuite, attributeReportIBsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(attributeReportIBsBuilder.GetError(), CHIP_NO_ERROR); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseAttributeReportIBs(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseAttributeReportIBs(reader); } -void StatusIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestStatusIB) { CHIP_ERROR err = CHIP_NO_ERROR; StatusIB::Builder statusIBBuilder; @@ -1748,22 +1797,22 @@ void StatusIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); statusIBBuilder.Init(&writer); - BuildStatusIB(apSuite, statusIBBuilder); + BuildStatusIB(statusIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); StatusIBParser.Init(reader); - ParseStatusIB(apSuite, StatusIBParser); + ParseStatusIB(StatusIBParser); } -void EventStatusIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestEventStatusIB) { CHIP_ERROR err = CHIP_NO_ERROR; EventStatusIB::Builder eventStatusIBBuilder; @@ -1772,22 +1821,22 @@ void EventStatusIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); eventStatusIBBuilder.Init(&writer); - BuildEventStatusIB(apSuite, eventStatusIBBuilder); + BuildEventStatusIB(eventStatusIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); eventStatusIBParser.Init(reader); - ParseEventStatusIB(apSuite, eventStatusIBParser); + ParseEventStatusIB(eventStatusIBParser); } -void AttributeStatusIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestAttributeStatusIB) { CHIP_ERROR err = CHIP_NO_ERROR; AttributeStatusIB::Builder attributeStatusIBBuilder; @@ -1796,22 +1845,22 @@ void AttributeStatusIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); attributeStatusIBBuilder.Init(&writer); - BuildAttributeStatusIB(apSuite, attributeStatusIBBuilder); + BuildAttributeStatusIB(attributeStatusIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); attributeStatusIBParser.Init(reader); - ParseAttributeStatusIB(apSuite, attributeStatusIBParser); + ParseAttributeStatusIB(attributeStatusIBParser); } -void AttributeStatusesTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestAttributeStatuses) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1819,21 +1868,21 @@ void AttributeStatusesTest(nlTestSuite * apSuite, void * apContext) writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); AttributeStatusIBs::Builder attributeStatusesBuilder; err = attributeStatusesBuilder.Init(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - BuildAttributeStatuses(apSuite, attributeStatusesBuilder); + EXPECT_EQ(err, CHIP_NO_ERROR); + BuildAttributeStatuses(attributeStatusesBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseAttributeStatuses(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseAttributeStatuses(reader); } -void AttributeDataIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestAttributeDataIB) { CHIP_ERROR err = CHIP_NO_ERROR; AttributeDataIB::Builder AttributeDataIBBuilder; @@ -1842,22 +1891,22 @@ void AttributeDataIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); AttributeDataIBBuilder.Init(&writer); - BuildAttributeDataIB(apSuite, AttributeDataIBBuilder); + BuildAttributeDataIB(AttributeDataIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); AttributeDataIBParser.Init(reader); - ParseAttributeDataIB(apSuite, AttributeDataIBParser); + ParseAttributeDataIB(AttributeDataIBParser); } -void AttributeDataIBsTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestAttributeDataIBs) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -1865,20 +1914,20 @@ void AttributeDataIBsTest(nlTestSuite * apSuite, void * apContext) writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); AttributeDataIBs::Builder AttributeDataIBsBuilder; AttributeDataIBsBuilder.Init(&writer); - BuildAttributeDataIBs(apSuite, AttributeDataIBsBuilder); + BuildAttributeDataIBs(AttributeDataIBsBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseAttributeDataIBs(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseAttributeDataIBs(reader); } -void CommandDataIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestCommandDataIB) { CHIP_ERROR err = CHIP_NO_ERROR; CommandDataIB::Builder commandDataIBBuilder; @@ -1887,22 +1936,22 @@ void CommandDataIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); commandDataIBBuilder.Init(&writer); - BuildCommandDataIB(apSuite, commandDataIBBuilder); + BuildCommandDataIB(commandDataIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); commandDataIBParser.Init(reader); - ParseCommandDataIB(apSuite, commandDataIBParser); + ParseCommandDataIB(commandDataIBParser); } -void CommandStatusIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestCommandStatusIB) { CHIP_ERROR err = CHIP_NO_ERROR; CommandStatusIB::Builder commandStatusIBBuilder; @@ -1911,22 +1960,22 @@ void CommandStatusIBTest(nlTestSuite * apSuite, void * apContext) chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); commandStatusIBBuilder.Init(&writer); - BuildCommandStatusIB(apSuite, commandStatusIBBuilder); + BuildCommandStatusIB(commandStatusIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); commandStatusIBParser.Init(reader); - ParseCommandStatusIB(apSuite, commandStatusIBParser); + ParseCommandStatusIB(commandStatusIBParser); } -void InvokeResponseIBWithCommandDataIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeResponseIBWithCommandDataIB) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeResponseIB::Builder invokeResponseIBBuilder; @@ -1935,22 +1984,22 @@ void InvokeResponseIBWithCommandDataIBTest(nlTestSuite * apSuite, void * apConte chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); invokeResponseIBBuilder.Init(&writer); - BuildInvokeResponseIBWithCommandDataIB(apSuite, invokeResponseIBBuilder); + BuildInvokeResponseIBWithCommandDataIB(invokeResponseIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); invokeResponseIBParser.Init(reader); - ParseInvokeResponseIBWithCommandDataIB(apSuite, invokeResponseIBParser); + ParseInvokeResponseIBWithCommandDataIB(invokeResponseIBParser); } -void InvokeResponseIBWithCommandStatusIBTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeResponseIBWithCommandStatusIB) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeResponseIB::Builder invokeResponseIBBuilder; @@ -1959,22 +2008,22 @@ void InvokeResponseIBWithCommandStatusIBTest(nlTestSuite * apSuite, void * apCon chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); invokeResponseIBBuilder.Init(&writer); - BuildInvokeResponseIBWithCommandStatusIB(apSuite, invokeResponseIBBuilder); + BuildInvokeResponseIBWithCommandStatusIB(invokeResponseIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); invokeResponseIBParser.Init(reader); - ParseInvokeResponseIBWithCommandStatusIB(apSuite, invokeResponseIBParser); + ParseInvokeResponseIBWithCommandStatusIB(invokeResponseIBParser); } -void InvokeResponseIBWithMalformDataTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeResponseIBWithMalformData) { CHIP_ERROR err = CHIP_NO_ERROR; InvokeResponseIB::Builder invokeResponseIBBuilder; @@ -1983,22 +2032,22 @@ void InvokeResponseIBWithMalformDataTest(nlTestSuite * apSuite, void * apContext chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); invokeResponseIBBuilder.Init(&writer); - BuildWrongInvokeResponseIB(apSuite, invokeResponseIBBuilder); + BuildWrongInvokeResponseIB(invokeResponseIBBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = invokeResponseIBParser.Init(reader); - NL_TEST_ASSERT(apSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); } -void InvokeRequestsTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeRequests) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -2006,20 +2055,20 @@ void InvokeRequestsTest(nlTestSuite * apSuite, void * apContext) InvokeRequests::Builder invokeRequestsBuilder; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); invokeRequestsBuilder.Init(&writer); - BuildInvokeRequests(apSuite, invokeRequestsBuilder); + BuildInvokeRequests(invokeRequestsBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseInvokeRequests(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseInvokeRequests(reader); } -void InvokeResponsesTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeResponses) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -2027,37 +2076,37 @@ void InvokeResponsesTest(nlTestSuite * apSuite, void * apContext) InvokeResponseIBs::Builder invokeResponsesBuilder; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); invokeResponsesBuilder.Init(&writer); - BuildInvokeResponses(apSuite, invokeResponsesBuilder); + BuildInvokeResponses(invokeResponsesBuilder); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ParseInvokeResponses(apSuite, reader); + EXPECT_EQ(err, CHIP_NO_ERROR); + ParseInvokeResponses(reader); } -void InvokeInvokeRequestMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeInvokeRequestMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildInvokeRequestMessage(apSuite, writer); + BuildInvokeRequestMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseInvokeRequestMessage(apSuite, reader); + ParseInvokeRequestMessage(reader); } -void InvokeRequestMessageEndOfMessageReservationTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeRequestMessageEndOfMessageReservation) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -2065,18 +2114,18 @@ void InvokeRequestMessageEndOfMessageReservationTest(nlTestSuite * apSuite, void const uint32_t kSmallBufferSize = 100; writer.Init(chip::System::PacketBufferHandle::New(kSmallBufferSize, /* aReservedSize = */ 0), /* useChainedBuffers = */ false); err = invokeRequestMessageBuilder.InitWithEndBufferReserved(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t remainingLengthAfterInitWithReservation = writer.GetRemainingFreeLength(); err = invokeRequestMessageBuilder.EndOfInvokeRequestMessage(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t remainingLengthAfterEndingInvokeRequestMessage = writer.GetRemainingFreeLength(); - NL_TEST_ASSERT(apSuite, remainingLengthAfterInitWithReservation == remainingLengthAfterEndingInvokeRequestMessage); + EXPECT_EQ(remainingLengthAfterInitWithReservation, remainingLengthAfterEndingInvokeRequestMessage); } -void InvokeRequestsEndOfRequestReservationTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeRequestsEndOfRequestReservation) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -2084,41 +2133,41 @@ void InvokeRequestsEndOfRequestReservationTest(nlTestSuite * apSuite, void * apC const uint32_t kSmallBufferSize = 100; writer.Init(chip::System::PacketBufferHandle::New(kSmallBufferSize, /* aReservedSize = */ 0), /* useChainedBuffers = */ false); err = invokeRequestMessageBuilder.InitWithEndBufferReserved(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); invokeRequestMessageBuilder.CreateInvokeRequests(/* aReserveEndBuffer = */ true); InvokeRequests::Builder & invokeRequestsBuilder = invokeRequestMessageBuilder.GetInvokeRequests(); err = invokeRequestsBuilder.GetError(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); auto * invokeRequestsWriter = invokeRequestsBuilder.GetWriter(); uint32_t remainingLengthAfterInitWithReservation = invokeRequestsWriter->GetRemainingFreeLength(); err = invokeRequestsBuilder.EndOfInvokeRequests(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t remainingLengthAfterEndingInvokeRequests = invokeRequestsWriter->GetRemainingFreeLength(); - NL_TEST_ASSERT(apSuite, remainingLengthAfterInitWithReservation == remainingLengthAfterEndingInvokeRequests); + EXPECT_EQ(remainingLengthAfterInitWithReservation, remainingLengthAfterEndingInvokeRequests); } -void InvokeInvokeResponseMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeInvokeResponseMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildInvokeResponseMessage(apSuite, writer); + BuildInvokeResponseMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseInvokeResponseMessage(apSuite, reader); + ParseInvokeResponseMessage(reader); } -void InvokeResponseMessageEndOfMessageReservationTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeResponseMessageEndOfMessageReservation) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -2126,17 +2175,17 @@ void InvokeResponseMessageEndOfMessageReservationTest(nlTestSuite * apSuite, voi const uint32_t kSmallBufferSize = 100; writer.Init(chip::System::PacketBufferHandle::New(kSmallBufferSize, /* aReservedSize = */ 0), /* useChainedBuffers = */ false); err = invokeResponseMessageBuilder.InitWithEndBufferReserved(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t remainingLengthAfterInitWithReservation = writer.GetRemainingFreeLength(); err = invokeResponseMessageBuilder.EndOfInvokeResponseMessage(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t remainingLengthAfterEndingInvokeResponseMessage = writer.GetRemainingFreeLength(); - NL_TEST_ASSERT(apSuite, remainingLengthAfterInitWithReservation == remainingLengthAfterEndingInvokeResponseMessage); + EXPECT_EQ(remainingLengthAfterInitWithReservation, remainingLengthAfterEndingInvokeResponseMessage); } -void InvokeResponseMessageReservationForEndandMoreChunkTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeResponseMessageReservationForEndandMoreChunk) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -2144,22 +2193,22 @@ void InvokeResponseMessageReservationForEndandMoreChunkTest(nlTestSuite * apSuit const uint32_t kSmallBufferSize = 100; writer.Init(chip::System::PacketBufferHandle::New(kSmallBufferSize, /* aReservedSize = */ 0), /* useChainedBuffers = */ false); err = invokeResponseMessageBuilder.InitWithEndBufferReserved(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = invokeResponseMessageBuilder.ReserveSpaceForMoreChunkedMessages(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t remainingLengthAllReservations = writer.GetRemainingFreeLength(); invokeResponseMessageBuilder.MoreChunkedMessages(/* aMoreChunkedMessages = */ true); - NL_TEST_ASSERT(apSuite, invokeResponseMessageBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(invokeResponseMessageBuilder.GetError(), CHIP_NO_ERROR); err = invokeResponseMessageBuilder.EndOfInvokeResponseMessage(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t remainingLengthAfterEndingInvokeResponseMessage = writer.GetRemainingFreeLength(); - NL_TEST_ASSERT(apSuite, remainingLengthAllReservations == remainingLengthAfterEndingInvokeResponseMessage); + EXPECT_EQ(remainingLengthAllReservations, remainingLengthAfterEndingInvokeResponseMessage); } -void InvokeResponsesEndOfResponseReservationTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestInvokeResponsesEndOfResponseReservation) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; @@ -2167,142 +2216,142 @@ void InvokeResponsesEndOfResponseReservationTest(nlTestSuite * apSuite, void * a const uint32_t kSmallBufferSize = 100; writer.Init(chip::System::PacketBufferHandle::New(kSmallBufferSize, /* aReservedSize = */ 0), /* useChainedBuffers = */ false); err = invokeResponseMessageBuilder.InitWithEndBufferReserved(&writer); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); invokeResponseMessageBuilder.CreateInvokeResponses(/* aReserveEndBuffer = */ true); InvokeResponseIBs::Builder & invokeResponsesBuilder = invokeResponseMessageBuilder.GetInvokeResponses(); err = invokeResponsesBuilder.GetError(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); auto * invokeResponsesWriter = invokeResponsesBuilder.GetWriter(); uint32_t remainingLengthAfterInitWithReservation = invokeResponsesWriter->GetRemainingFreeLength(); err = invokeResponsesBuilder.EndOfInvokeResponses(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint32_t remainingLengthAfterEndingInvokeResponses = invokeResponsesWriter->GetRemainingFreeLength(); - NL_TEST_ASSERT(apSuite, remainingLengthAfterInitWithReservation == remainingLengthAfterEndingInvokeResponses); + EXPECT_EQ(remainingLengthAfterInitWithReservation, remainingLengthAfterEndingInvokeResponses); } -void ReportDataMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestReportDataMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildReportDataMessage(apSuite, writer); + BuildReportDataMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseReportDataMessage(apSuite, reader); + ParseReportDataMessage(reader); } -void ReadRequestMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestReadRequestMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildReadRequestMessage(apSuite, writer); + BuildReadRequestMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseReadRequestMessage(apSuite, reader); + ParseReadRequestMessage(reader); } -void WriteRequestMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestWriteRequestMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildWriteRequestMessage(apSuite, writer); + BuildWriteRequestMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseWriteRequestMessage(apSuite, reader); + ParseWriteRequestMessage(reader); } -void WriteResponseMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestWriteResponseMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildWriteResponseMessage(apSuite, writer); + BuildWriteResponseMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseWriteResponseMessage(apSuite, reader); + ParseWriteResponseMessage(reader); } -void SubscribeRequestMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestSubscribeRequestMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildSubscribeRequestMessage(apSuite, writer); + BuildSubscribeRequestMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseSubscribeRequestMessage(apSuite, reader); + ParseSubscribeRequestMessage(reader); } -void SubscribeResponseMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestSubscribeResponseMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildSubscribeResponseMessage(apSuite, writer); + BuildSubscribeResponseMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseSubscribeResponseMessage(apSuite, reader); + ParseSubscribeResponseMessage(reader); } -void TimedRequestMessageTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestTimedRequestMessage) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildTimedRequestMessage(apSuite, writer); + BuildTimedRequestMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); - ParseTimedRequestMessage(apSuite, reader); + ParseTimedRequestMessage(reader); } -void CheckPointRollbackTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestMessageDef, TestCheckPointRollback) { CHIP_ERROR err = CHIP_NO_ERROR; size_t NumDataElement = 0; @@ -2316,32 +2365,32 @@ void CheckPointRollbackTest(nlTestSuite * apSuite, void * apContext) // encode one attribute element AttributeDataIB::Builder & attributeDataIBBuilder1 = attributeDataIBsBuilder.CreateAttributeDataIBBuilder(); - NL_TEST_ASSERT(apSuite, attributeDataIBsBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeDataIB(apSuite, attributeDataIBBuilder1); + EXPECT_EQ(attributeDataIBsBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeDataIB(attributeDataIBBuilder1); // checkpoint attributeDataIBsBuilder.Checkpoint(checkpoint); // encode another attribute element AttributeDataIB::Builder & attributeDataIBBuilder2 = attributeDataIBsBuilder.CreateAttributeDataIBBuilder(); - NL_TEST_ASSERT(apSuite, attributeDataIBsBuilder.GetError() == CHIP_NO_ERROR); - BuildAttributeDataIB(apSuite, attributeDataIBBuilder2); + EXPECT_EQ(attributeDataIBsBuilder.GetError(), CHIP_NO_ERROR); + BuildAttributeDataIB(attributeDataIBBuilder2); // rollback to previous checkpoint attributeDataIBsBuilder.Rollback(checkpoint); attributeDataIBsBuilder.EndOfAttributeDataIBs(); - NL_TEST_ASSERT(apSuite, attributeDataIBsBuilder.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(attributeDataIBsBuilder.GetError(), CHIP_NO_ERROR); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); DebugPrettyPrint(buf); reader.Init(std::move(buf)); err = reader.Next(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = AttributeDataIBsParser.Init(reader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT AttributeDataIBsParser.PrettyPrint(); @@ -2351,101 +2400,7 @@ void CheckPointRollbackTest(nlTestSuite * apSuite, void * apContext) ++NumDataElement; } - NL_TEST_ASSERT(apSuite, NumDataElement == 1); + EXPECT_EQ(NumDataElement, 1u); } -/** - * Test Suite. It lists all the test functions. - */ - -// clang-format off -const nlTest sTests[] = - { - NL_TEST_DEF("ClusterPathIBTest", ClusterPathIBTest), - NL_TEST_DEF("DataVersionFilterIBTest", DataVersionFilterIBTest), - NL_TEST_DEF("DataVersionFilterIBsTest", DataVersionFilterIBsTest), - NL_TEST_DEF("EventFilterTest", EventFilterTest), - NL_TEST_DEF("EventFiltersTest", EventFiltersTest), - NL_TEST_DEF("AttributePathTest", AttributePathTest), - NL_TEST_DEF("AttributePathListTest", AttributePathListTest), - NL_TEST_DEF("AttributeStatusIBTest", AttributeStatusIBTest), - NL_TEST_DEF("AttributeStatusesTest", AttributeStatusesTest), - NL_TEST_DEF("AttributeDataIBTest", AttributeDataIBTest), - NL_TEST_DEF("AttributeDataIBsTest", AttributeDataIBsTest), - NL_TEST_DEF("AttributeReportIBTest", AttributeReportIBTest), - NL_TEST_DEF("AttributeReportIBsTest", AttributeReportIBsTest), - NL_TEST_DEF("EmptyAttributeReportIBsTest", EmptyAttributeReportIBsTest), - NL_TEST_DEF("EventPathTest", EventPathTest), - NL_TEST_DEF("EventPathsTest", EventPathsTest), - NL_TEST_DEF("EventDataIBTest", EventDataIBTest), - NL_TEST_DEF("EventReportIBTest", EventReportIBTest), - NL_TEST_DEF("EventReportsTest", EventReportsTest), - NL_TEST_DEF("EmptyEventReportsTest", EmptyEventReportsTest), - NL_TEST_DEF("StatusIBTest", StatusIBTest), - NL_TEST_DEF("EventStatusIBTest", EventStatusIBTest), - NL_TEST_DEF("CommandPathIBTest", CommandPathIBTest), - NL_TEST_DEF("CommandDataIBTest", CommandDataIBTest), - NL_TEST_DEF("CommandStatusIBTest", CommandStatusIBTest), - NL_TEST_DEF("InvokeResponseIBWithCommandDataIBTest", InvokeResponseIBWithCommandDataIBTest), - NL_TEST_DEF("InvokeResponseIBWithCommandStatusIBTest", InvokeResponseIBWithCommandStatusIBTest), - NL_TEST_DEF("InvokeResponseIBWithMalformDataTest", InvokeResponseIBWithMalformDataTest), - NL_TEST_DEF("InvokeRequestsTest", InvokeRequestsTest), - NL_TEST_DEF("InvokeResponsesTest", InvokeResponsesTest), - NL_TEST_DEF("InvokeInvokeRequestMessageTest", InvokeInvokeRequestMessageTest), - NL_TEST_DEF("InvokeRequestMessageEndOfMessageReservationTest", InvokeRequestMessageEndOfMessageReservationTest), - NL_TEST_DEF("InvokeRequestsEndOfRequestReservationTest", InvokeRequestsEndOfRequestReservationTest), - NL_TEST_DEF("InvokeInvokeResponseMessageTest", InvokeInvokeResponseMessageTest), - NL_TEST_DEF("InvokeResponseMessageEndOfMessageReservationTest", InvokeResponseMessageEndOfMessageReservationTest), - NL_TEST_DEF("InvokeResponseMessageReservationForEndandMoreChunkTest", InvokeResponseMessageReservationForEndandMoreChunkTest), - NL_TEST_DEF("InvokeResponsesEndOfResponseReservationTest", InvokeResponsesEndOfResponseReservationTest), - NL_TEST_DEF("ReportDataMessageTest", ReportDataMessageTest), - NL_TEST_DEF("ReadRequestMessageTest", ReadRequestMessageTest), - NL_TEST_DEF("WriteRequestMessageTest", WriteRequestMessageTest), - NL_TEST_DEF("WriteResponseMessageTest", WriteResponseMessageTest), - NL_TEST_DEF("SubscribeRequestMessageTest", SubscribeRequestMessageTest), - NL_TEST_DEF("SubscribeResponseMessageTest", SubscribeResponseMessageTest), - NL_TEST_DEF("TimedRequestMessageTest", TimedRequestMessageTest), - NL_TEST_DEF("CheckPointRollbackTest", CheckPointRollbackTest), - NL_TEST_SENTINEL() - }; -// clang-format on } // namespace - -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -int TestMessageDef() -{ - // clang-format off - nlTestSuite theSuite = - { - "MessageDef", - &sTests[0], - TestSetup, - TestTeardown, - }; - // clang-format on - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestMessageDef) diff --git a/src/app/tests/TestNullable.cpp b/src/app/tests/TestNullable.cpp index 660037339d44e1..9a8104f86ce4d3 100644 --- a/src/app/tests/TestNullable.cpp +++ b/src/app/tests/TestNullable.cpp @@ -21,10 +21,11 @@ #include #include +#include +#include + #include #include -#include -#include using namespace chip; using namespace chip::app::DataModel; @@ -79,7 +80,7 @@ int CtorDtorCounter::destroyed = 0; } // namespace -static void TestBasic(nlTestSuite * inSuite, void * inContext) +TEST(TestNullable, TestBasic) { // Set up our test CtorDtorCounter objects, which will mess with counts, before we reset the // counts. @@ -89,109 +90,109 @@ static void TestBasic(nlTestSuite * inSuite, void * inContext) { auto testNullable = MakeNullable(100); - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 0); - NL_TEST_ASSERT(inSuite, !testNullable.IsNull() && testNullable.Value().m == 100); - NL_TEST_ASSERT(inSuite, testNullable == c100); - NL_TEST_ASSERT(inSuite, testNullable != c101); - NL_TEST_ASSERT(inSuite, testNullable != c102); + EXPECT_TRUE(CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 0); + EXPECT_TRUE(!testNullable.IsNull() && testNullable.Value().m == 100); + EXPECT_EQ(testNullable, c100); + EXPECT_NE(testNullable, c101); + EXPECT_NE(testNullable, c102); testNullable.SetNull(); - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 1); - NL_TEST_ASSERT(inSuite, !!testNullable.IsNull()); - NL_TEST_ASSERT(inSuite, testNullable != c100); - NL_TEST_ASSERT(inSuite, testNullable != c101); - NL_TEST_ASSERT(inSuite, testNullable != c102); + EXPECT_TRUE(CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 1); + EXPECT_TRUE(testNullable.IsNull()); + EXPECT_NE(testNullable, c100); + EXPECT_NE(testNullable, c101); + EXPECT_NE(testNullable, c102); testNullable.SetNonNull(CtorDtorCounter(101)); - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 3 && CtorDtorCounter::destroyed == 2); - NL_TEST_ASSERT(inSuite, !testNullable.IsNull() && testNullable.Value().m == 101); - NL_TEST_ASSERT(inSuite, testNullable != c100); - NL_TEST_ASSERT(inSuite, testNullable == c101); - NL_TEST_ASSERT(inSuite, testNullable != c102); + EXPECT_TRUE(CtorDtorCounter::created == 3 && CtorDtorCounter::destroyed == 2); + EXPECT_TRUE(!testNullable.IsNull() && testNullable.Value().m == 101); + EXPECT_NE(testNullable, c100); + EXPECT_EQ(testNullable, c101); + EXPECT_NE(testNullable, c102); testNullable.SetNonNull(102); - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 4 && CtorDtorCounter::destroyed == 3); - NL_TEST_ASSERT(inSuite, !testNullable.IsNull() && testNullable.Value().m == 102); - NL_TEST_ASSERT(inSuite, testNullable != c100); - NL_TEST_ASSERT(inSuite, testNullable != c101); - NL_TEST_ASSERT(inSuite, testNullable == c102); + EXPECT_TRUE(CtorDtorCounter::created == 4 && CtorDtorCounter::destroyed == 3); + EXPECT_TRUE(!testNullable.IsNull() && testNullable.Value().m == 102); + EXPECT_NE(testNullable, c100); + EXPECT_NE(testNullable, c101); + EXPECT_EQ(testNullable, c102); } // Our test CtorDtorCounter objects are still in scope here. - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 4 && CtorDtorCounter::destroyed == 4); + EXPECT_TRUE(CtorDtorCounter::created == 4 && CtorDtorCounter::destroyed == 4); } -static void TestMake(nlTestSuite * inSuite, void * inContext) +TEST(TestNullable, TestMake) { CtorDtorCounter::ResetCounter(); { auto testNullable = MakeNullable(200); - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 0); - NL_TEST_ASSERT(inSuite, !testNullable.IsNull() && testNullable.Value().m == 200); + EXPECT_TRUE(CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 0); + EXPECT_TRUE(!testNullable.IsNull() && testNullable.Value().m == 200); } - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 1); + EXPECT_TRUE(CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 1); } -static void TestCopy(nlTestSuite * inSuite, void * inContext) +TEST(TestNullable, TestCopy) { CtorDtorCounter::ResetCounter(); { auto testSrc = MakeNullable(300); - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 0); - NL_TEST_ASSERT(inSuite, !testSrc.IsNull() && testSrc.Value().m == 300); + EXPECT_TRUE(CtorDtorCounter::created == 1 && CtorDtorCounter::destroyed == 0); + EXPECT_TRUE(!testSrc.IsNull() && testSrc.Value().m == 300); { Nullable testDst(testSrc); - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 0); - NL_TEST_ASSERT(inSuite, !testDst.IsNull() && testDst.Value().m == 300); + EXPECT_TRUE(CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 0); + EXPECT_TRUE(!testDst.IsNull() && testDst.Value().m == 300); } - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 1); + EXPECT_TRUE(CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 1); { Nullable testDst; - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 1); - NL_TEST_ASSERT(inSuite, !!testDst.IsNull()); + EXPECT_TRUE(CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 1); + EXPECT_TRUE(testDst.IsNull()); testDst = testSrc; - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 3 && CtorDtorCounter::destroyed == 1); - NL_TEST_ASSERT(inSuite, !testDst.IsNull() && testDst.Value().m == 300); + EXPECT_TRUE(CtorDtorCounter::created == 3 && CtorDtorCounter::destroyed == 1); + EXPECT_TRUE(!testDst.IsNull() && testDst.Value().m == 300); } - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 3 && CtorDtorCounter::destroyed == 2); + EXPECT_TRUE(CtorDtorCounter::created == 3 && CtorDtorCounter::destroyed == 2); } - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 3 && CtorDtorCounter::destroyed == 3); + EXPECT_TRUE(CtorDtorCounter::created == 3 && CtorDtorCounter::destroyed == 3); } -static void TestMove(nlTestSuite * inSuite, void * inContext) +TEST(TestNullable, TestMove) { CtorDtorCounter::ResetCounter(); { auto testSrc = MakeNullable(400); // construct Nullable testDst(std::move(testSrc)); // move construct - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 0); - NL_TEST_ASSERT(inSuite, !testDst.IsNull() && testDst.Value().m == 400); + EXPECT_TRUE(CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 0); + EXPECT_TRUE(!testDst.IsNull() && testDst.Value().m == 400); // destroy both testsSrc and testDst } - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 2); + EXPECT_TRUE(CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 2); CtorDtorCounter::ResetCounter(); { Nullable testDst; // no object construction - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 0 && CtorDtorCounter::destroyed == 0); - NL_TEST_ASSERT(inSuite, !!testDst.IsNull()); + EXPECT_TRUE(CtorDtorCounter::created == 0 && CtorDtorCounter::destroyed == 0); + EXPECT_TRUE(testDst.IsNull()); auto testSrc = MakeNullable(401); // construct object testDst = std::move(testSrc); // construct a copy - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 0); - NL_TEST_ASSERT(inSuite, !testDst.IsNull() && testDst.Value().m == 401); + EXPECT_TRUE(CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 0); + EXPECT_TRUE(!testDst.IsNull() && testDst.Value().m == 401); } - NL_TEST_ASSERT(inSuite, CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 2); + EXPECT_TRUE(CtorDtorCounter::created == 2 && CtorDtorCounter::destroyed == 2); } -static void TestUpdate(nlTestSuite * inSuite, void * inContext) +TEST(TestNullable, TestUpdate) { using SmallArray = std::array; // Arrays @@ -199,19 +200,19 @@ static void TestUpdate(nlTestSuite * inSuite, void * inContext) auto nullable1 = MakeNullable({ 1, 2, 3 }); auto nullable2 = MakeNullable({ 1, 2, 3 }); - NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); - NL_TEST_ASSERT(inSuite, !nullable2.IsNull()); - NL_TEST_ASSERT(inSuite, nullable1 == nullable2); + EXPECT_FALSE(nullable1.IsNull()); + EXPECT_FALSE(nullable2.IsNull()); + EXPECT_EQ(nullable1, nullable2); // No-op on change to same. - NL_TEST_ASSERT(inSuite, nullable1.Update(nullable2) == false); - NL_TEST_ASSERT(inSuite, nullable1 == nullable2); + EXPECT_FALSE(nullable1.Update(nullable2)); + EXPECT_EQ(nullable1, nullable2); nullable1.Value()[0] = 100; - NL_TEST_ASSERT(inSuite, nullable1 != nullable2); - NL_TEST_ASSERT(inSuite, nullable2.Update(nullable1) == true); - NL_TEST_ASSERT(inSuite, nullable1 == nullable2); + EXPECT_NE(nullable1, nullable2); + EXPECT_TRUE(nullable2.Update(nullable1)); + EXPECT_EQ(nullable1, nullable2); } // Structs @@ -227,83 +228,52 @@ static void TestUpdate(nlTestSuite * inSuite, void * inContext) auto nullable1 = MakeNullable({ 1, 2 }); auto nullable2 = MakeNullable({ 1, 2 }); - NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); - NL_TEST_ASSERT(inSuite, !nullable2.IsNull()); - NL_TEST_ASSERT(inSuite, nullable1 == nullable2); + EXPECT_FALSE(nullable1.IsNull()); + EXPECT_FALSE(nullable2.IsNull()); + EXPECT_EQ(nullable1, nullable2); // No-op on change to same. - NL_TEST_ASSERT(inSuite, nullable1.Update(nullable2) == false); - NL_TEST_ASSERT(inSuite, nullable1 == nullable2); + EXPECT_FALSE(nullable1.Update(nullable2)); + EXPECT_EQ(nullable1, nullable2); nullable1.Value().a = 100; - NL_TEST_ASSERT(inSuite, nullable1 != nullable2); - NL_TEST_ASSERT(inSuite, nullable2.Update(nullable1) == true); - NL_TEST_ASSERT(inSuite, nullable1 == nullable2); + EXPECT_NE(nullable1, nullable2); + EXPECT_TRUE(nullable2.Update(nullable1)); + EXPECT_EQ(nullable1, nullable2); } // Scalar cases { auto nullable1 = MakeNullable(static_cast(1)); - NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); + EXPECT_FALSE(nullable1.IsNull()); // Non-null to non-null same value - NL_TEST_ASSERT(inSuite, nullable1.Update(nullable1) == false); - NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); + EXPECT_FALSE(nullable1.Update(nullable1)); + EXPECT_FALSE(nullable1.IsNull()); // Non-null to null - NL_TEST_ASSERT(inSuite, nullable1.Update(NullNullable) == true); - NL_TEST_ASSERT(inSuite, nullable1.IsNull()); + EXPECT_TRUE(nullable1.Update(NullNullable)); + EXPECT_TRUE(nullable1.IsNull()); // Null to null - NL_TEST_ASSERT(inSuite, nullable1.Update(NullNullable) == false); - NL_TEST_ASSERT(inSuite, nullable1.IsNull()); + EXPECT_FALSE(nullable1.Update(NullNullable)); + EXPECT_TRUE(nullable1.IsNull()); // Null to non-null - NL_TEST_ASSERT(inSuite, nullable1.Update(MakeNullable(static_cast(1))) == true); - NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); - NL_TEST_ASSERT(inSuite, nullable1.Value() == 1); + EXPECT_TRUE(nullable1.Update(MakeNullable(static_cast(1)))); + EXPECT_FALSE(nullable1.IsNull()); + EXPECT_EQ(nullable1.Value(), 1); // Non-null to non-null different value - NL_TEST_ASSERT(inSuite, nullable1.Update(MakeNullable(static_cast(2))) == true); - NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); - NL_TEST_ASSERT(inSuite, nullable1.Value() == 2); + EXPECT_TRUE(nullable1.Update(MakeNullable(static_cast(2)))); + EXPECT_FALSE(nullable1.IsNull()); + EXPECT_EQ(nullable1.Value(), 2); // Non-null to extent of range --> changes to "invalid" value in range. - NL_TEST_ASSERT(inSuite, nullable1.Update(MakeNullable(static_cast(255))) == true); - NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); - NL_TEST_ASSERT(inSuite, nullable1.Value() == 255); + EXPECT_TRUE(nullable1.Update(MakeNullable(static_cast(255)))); + EXPECT_FALSE(nullable1.IsNull()); + EXPECT_EQ(nullable1.Value(), 255); } } - -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("NullableBasic", TestBasic), - NL_TEST_DEF("NullableMake", TestMake), - NL_TEST_DEF("NullableCopy", TestCopy), - NL_TEST_DEF("NullableMove", TestMove), - NL_TEST_DEF("Nullable Update operation", TestUpdate), - NL_TEST_SENTINEL() -}; -// clang-format on - -int TestNullable() -{ - // clang-format off - nlTestSuite theSuite = - { - "Test for Nullable abstraction", - &sTests[0], - nullptr, - nullptr - }; - // clang-format on - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestNullable) diff --git a/src/app/tests/TestNumericAttributeTraits.cpp b/src/app/tests/TestNumericAttributeTraits.cpp index a88f3925c2a1d0..6d6c35735066a4 100644 --- a/src/app/tests/TestNumericAttributeTraits.cpp +++ b/src/app/tests/TestNumericAttributeTraits.cpp @@ -27,8 +27,8 @@ * */ -#include -#include +#include +#include // We are testing the odd-sized-integers.h module #include @@ -38,7 +38,7 @@ using namespace chip::app; namespace { -void Test_UINT8(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT8) { // Unsigned 8-bit Integer : 1 byte, endianness does not matter. using IntType = NumericAttributeTraits; @@ -53,8 +53,8 @@ void Test_UINT8(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = 0xFF; // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 1); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 1); + EXPECT_EQ(sizeof(sValue), 1u); + EXPECT_GE(sizeof(wValue), 1u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, &storageTestData, sizeof(sValue)); @@ -63,7 +63,7 @@ void Test_UINT8(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 17); + EXPECT_EQ(wValue, 17u); StorageType sNewValue; @@ -71,22 +71,22 @@ void Test_UINT8(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(&storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(&storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_SINT8(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT8) { // Signed 8-bit Integer : 1 byte, endianness does not matter. using IntType = NumericAttributeTraits; @@ -101,8 +101,8 @@ void Test_SINT8(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = -128; // 0x80 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 1); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 1); + EXPECT_EQ(sizeof(sValue), 1u); + EXPECT_GE(sizeof(wValue), 1u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, &storageTestData, sizeof(sValue)); @@ -111,7 +111,7 @@ void Test_SINT8(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 17); + EXPECT_EQ(wValue, 17); StorageType sNewValue; @@ -119,19 +119,19 @@ void Test_SINT8(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(&storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(&storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } enum class SimpleEnum : uint8_t @@ -140,7 +140,7 @@ enum class SimpleEnum : uint8_t kOne = 1, }; -void Test_SimpleEnum(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SimpleEnum) { // Unsigned 8-bit Integer : 1 byte, endianness does not matter. using IntType = NumericAttributeTraits; @@ -155,8 +155,8 @@ void Test_SimpleEnum(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = static_cast(0xFF); // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 1); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 1); + EXPECT_EQ(sizeof(sValue), 1u); + EXPECT_GE(sizeof(wValue), 1u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, &storageTestData, sizeof(sValue)); @@ -165,7 +165,7 @@ void Test_SimpleEnum(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == SimpleEnum::kOne); + EXPECT_EQ(wValue, SimpleEnum::kOne); StorageType sNewValue; @@ -173,19 +173,19 @@ void Test_SimpleEnum(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(&storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(&storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } //////////////////////////////////////////////////////////// @@ -200,7 +200,7 @@ void Test_SimpleEnum(nlTestSuite * apSuite, void * apContext) // $$$$$$$$/ $$/ $$$$$$$/ $$$$$$/ $$/ // // // //////////////////////////////////////////////////////////// -void Test_UINT24_LE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT24_LE) { // Unsigned 24-bit Integer : 3 bytes - little-endian using IntType = NumericAttributeTraits, false>; @@ -215,8 +215,8 @@ void Test_UINT24_LE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = 16777215; // 0xFFFFFF // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 3); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 3); + EXPECT_EQ(sizeof(sValue), 3u); + EXPECT_GE(sizeof(wValue), 3u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, storageTestData, sizeof(sValue)); @@ -225,7 +225,7 @@ void Test_UINT24_LE(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 0x123456); + EXPECT_EQ(wValue, 0x123456u); StorageType sNewValue; @@ -233,22 +233,22 @@ void Test_UINT24_LE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_UINT24_BE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT24_BE) { // Unsigned 24-bit Integer : 3 bytes - big-endian using IntType = NumericAttributeTraits, true>; @@ -263,8 +263,8 @@ void Test_UINT24_BE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = 16777215; // 0xFFFFFF // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 3); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 3); + EXPECT_EQ(sizeof(sValue), 3u); + EXPECT_GE(sizeof(wValue), 3u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, storageTestData, sizeof(sValue)); @@ -273,7 +273,7 @@ void Test_UINT24_BE(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 0x123456); + EXPECT_EQ(wValue, 0x123456u); StorageType sNewValue; @@ -281,22 +281,22 @@ void Test_UINT24_BE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_SINT24_LE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT24_LE) { // Signed 24-bit Integer : 3 bytes - little-endian using IntType = NumericAttributeTraits, false>; @@ -315,10 +315,10 @@ void Test_SINT24_LE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestSignedNullValue = -8388608; // -0x800000 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValuePos) == 3); - NL_TEST_ASSERT(apSuite, sizeof(wValuePos) >= 3); - NL_TEST_ASSERT(apSuite, sizeof(sValueNeg) == 3); - NL_TEST_ASSERT(apSuite, sizeof(wValueNeg) >= 3); + EXPECT_EQ(sizeof(sValuePos), 3u); + EXPECT_GE(sizeof(wValuePos), 3u); + EXPECT_EQ(sizeof(sValueNeg), 3u); + EXPECT_GE(sizeof(wValueNeg), 3u); // Initialize the Storage Values with the test-buffer memcpy(&sValuePos, storageTestDataPos, sizeof(sValuePos)); @@ -329,8 +329,8 @@ void Test_SINT24_LE(nlTestSuite * apSuite, void * apContext) wValueNeg = IntType::StorageToWorking(sValueNeg); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValuePos == workingDataPos); - NL_TEST_ASSERT(apSuite, wValueNeg == workingDataNeg); + EXPECT_EQ(wValuePos, workingDataPos); + EXPECT_EQ(wValueNeg, workingDataNeg); StorageType sNewValuePos; StorageType sNewValueNeg; @@ -340,8 +340,8 @@ void Test_SINT24_LE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValueNeg, sNewValueNeg); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)) == 0); - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)) == 0); + EXPECT_EQ(memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)), 0); + EXPECT_EQ(memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)), 0); StorageType sNullValue; WorkingType wNullValue; @@ -349,19 +349,19 @@ void Test_SINT24_LE(nlTestSuite * apSuite, void * apContext) // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestSignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestSignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, wNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); + EXPECT_TRUE(IntType::CanRepresentValue(false, wNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, wNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); + EXPECT_FALSE(IntType::CanRepresentValue(true, wNullValue)); } -void Test_SINT24_BE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT24_BE) { // Signed 24-bit Integer : 3 bytes - big-endian using IntType = NumericAttributeTraits, true>; @@ -380,10 +380,10 @@ void Test_SINT24_BE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestSignedNullValue = -8388608; // -0x800000 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValuePos) == 3); - NL_TEST_ASSERT(apSuite, sizeof(wValuePos) >= 3); - NL_TEST_ASSERT(apSuite, sizeof(sValueNeg) == 3); - NL_TEST_ASSERT(apSuite, sizeof(wValueNeg) >= 3); + EXPECT_EQ(sizeof(sValuePos), 3u); + EXPECT_GE(sizeof(wValuePos), 3u); + EXPECT_EQ(sizeof(sValueNeg), 3u); + EXPECT_GE(sizeof(wValueNeg), 3u); // Initialize the Storage Values with the test-buffer memcpy(&sValuePos, storageTestDataPos, sizeof(sValuePos)); @@ -394,8 +394,8 @@ void Test_SINT24_BE(nlTestSuite * apSuite, void * apContext) wValueNeg = IntType::StorageToWorking(sValueNeg); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValuePos == workingDataPos); - NL_TEST_ASSERT(apSuite, wValueNeg == workingDataNeg); + EXPECT_EQ(wValuePos, workingDataPos); + EXPECT_EQ(wValueNeg, workingDataNeg); StorageType sNewValuePos; StorageType sNewValueNeg; @@ -405,8 +405,8 @@ void Test_SINT24_BE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValueNeg, sNewValueNeg); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)) == 0); - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)) == 0); + EXPECT_EQ(memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)), 0); + EXPECT_EQ(memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)), 0); StorageType sNullValue; WorkingType wNullValue; @@ -414,16 +414,16 @@ void Test_SINT24_BE(nlTestSuite * apSuite, void * apContext) // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestSignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestSignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, wNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); + EXPECT_TRUE(IntType::CanRepresentValue(false, wNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, wNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); + EXPECT_FALSE(IntType::CanRepresentValue(true, wNullValue)); } //////////////////////////////////////////////////////////// @@ -438,7 +438,7 @@ void Test_SINT24_BE(nlTestSuite * apSuite, void * apContext) // $$/ $$$$$$/ $$$$$$$/ $$$$$$/ $$/ // // // //////////////////////////////////////////////////////////// -void Test_UINT40_LE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT40_LE) { // Unsigned 40-bit Integer : 5 bytes - little-endian using IntType = NumericAttributeTraits, false>; @@ -453,8 +453,8 @@ void Test_UINT40_LE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = 1099511627775; // 0xFFFFFFFFFF // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 5); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 5); + EXPECT_EQ(sizeof(sValue), 5u); + EXPECT_GE(sizeof(wValue), 5u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, storageTestData, sizeof(sValue)); @@ -463,7 +463,7 @@ void Test_UINT40_LE(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 0x123456789A); + EXPECT_EQ(wValue, 0x123456789Au); StorageType sNewValue; @@ -471,22 +471,22 @@ void Test_UINT40_LE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_UINT40_BE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT40_BE) { // Unsigned 40-bit Integer : 5 bytes - big-endian using IntType = NumericAttributeTraits, true>; @@ -500,8 +500,8 @@ void Test_UINT40_BE(nlTestSuite * apSuite, void * apContext) const StorageType storageTestData = { 0x12, 0x34, 0x56, 0x78, 0x9A }; const WorkingType workingTestUnsignedNullValue = 1099511627775; // 0xFFFFFFFFFF // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 5); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 5); + EXPECT_EQ(sizeof(sValue), 5u); + EXPECT_GE(sizeof(wValue), 5u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, storageTestData, sizeof(sValue)); @@ -510,7 +510,7 @@ void Test_UINT40_BE(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 0x123456789A); + EXPECT_EQ(wValue, 0x123456789Au); StorageType sNewValue; @@ -518,22 +518,22 @@ void Test_UINT40_BE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_SINT40_LE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT40_LE) { // Signed 40-bit Integer : 5 bytes - little-endian using IntType = NumericAttributeTraits, false>; @@ -552,10 +552,10 @@ void Test_SINT40_LE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestSignedNullValue = -549755813888; // -0x8000000000 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValuePos) == 5); - NL_TEST_ASSERT(apSuite, sizeof(wValuePos) >= 5); - NL_TEST_ASSERT(apSuite, sizeof(sValueNeg) == 5); - NL_TEST_ASSERT(apSuite, sizeof(wValueNeg) >= 5); + EXPECT_EQ(sizeof(sValuePos), 5u); + EXPECT_GE(sizeof(wValuePos), 5u); + EXPECT_EQ(sizeof(sValueNeg), 5u); + EXPECT_GE(sizeof(wValueNeg), 5u); // Initialize the Storage Values with the test-buffer memcpy(&sValuePos, storageTestDataPos, sizeof(sValuePos)); @@ -566,8 +566,8 @@ void Test_SINT40_LE(nlTestSuite * apSuite, void * apContext) wValueNeg = IntType::StorageToWorking(sValueNeg); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValuePos == workingDataPos); - NL_TEST_ASSERT(apSuite, wValueNeg == workingDataNeg); + EXPECT_EQ(wValuePos, workingDataPos); + EXPECT_EQ(wValueNeg, workingDataNeg); StorageType sNewValuePos; StorageType sNewValueNeg; @@ -577,8 +577,8 @@ void Test_SINT40_LE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValueNeg, sNewValueNeg); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)) == 0); - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)) == 0); + EXPECT_EQ(memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)), 0); + EXPECT_EQ(memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)), 0); StorageType sNullValue; WorkingType wNullValue; @@ -586,19 +586,19 @@ void Test_SINT40_LE(nlTestSuite * apSuite, void * apContext) // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestSignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestSignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, wNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); + EXPECT_TRUE(IntType::CanRepresentValue(false, wNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, wNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); + EXPECT_FALSE(IntType::CanRepresentValue(true, wNullValue)); } -void Test_SINT40_BE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT40_BE) { // Signed 40-bit Integer : 5 bytes - big-endian using IntType = NumericAttributeTraits, true>; @@ -617,10 +617,10 @@ void Test_SINT40_BE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestSignedNullValue = -549755813888; // -0x8000000000 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValuePos) == 5); - NL_TEST_ASSERT(apSuite, sizeof(wValuePos) >= 5); - NL_TEST_ASSERT(apSuite, sizeof(sValueNeg) == 5); - NL_TEST_ASSERT(apSuite, sizeof(wValueNeg) >= 5); + EXPECT_EQ(sizeof(sValuePos), 5u); + EXPECT_GE(sizeof(wValuePos), 5u); + EXPECT_EQ(sizeof(sValueNeg), 5u); + EXPECT_GE(sizeof(wValueNeg), 5u); // Initialize the Storage Values with the test-buffer memcpy(&sValuePos, storageTestDataPos, sizeof(sValuePos)); @@ -631,8 +631,8 @@ void Test_SINT40_BE(nlTestSuite * apSuite, void * apContext) wValueNeg = IntType::StorageToWorking(sValueNeg); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValuePos == workingDataPos); - NL_TEST_ASSERT(apSuite, wValueNeg == workingDataNeg); + EXPECT_EQ(wValuePos, workingDataPos); + EXPECT_EQ(wValueNeg, workingDataNeg); StorageType sNewValuePos; StorageType sNewValueNeg; @@ -642,8 +642,8 @@ void Test_SINT40_BE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValueNeg, sNewValueNeg); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)) == 0); - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)) == 0); + EXPECT_EQ(memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)), 0); + EXPECT_EQ(memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)), 0); StorageType sNullValue; WorkingType wNullValue; @@ -651,16 +651,16 @@ void Test_SINT40_BE(nlTestSuite * apSuite, void * apContext) // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestSignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestSignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, wNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); + EXPECT_TRUE(IntType::CanRepresentValue(false, wNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, wNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); + EXPECT_FALSE(IntType::CanRepresentValue(true, wNullValue)); } //////////////////////////////////////////////////////////// @@ -675,7 +675,7 @@ void Test_SINT40_BE(nlTestSuite * apSuite, void * apContext) // $$/ $$$$$$/ $$$$$$$/ $$$$$$/ $$/ // // // //////////////////////////////////////////////////////////// -void Test_UINT48_LE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT48_LE) { // Unsigned 48-bit Integer : 6 bytes - little-endian using IntType = NumericAttributeTraits, false>; @@ -690,8 +690,8 @@ void Test_UINT48_LE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = 281474976710655; // 0xFFFFFFFFFFFF // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 6); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 6); + EXPECT_EQ(sizeof(sValue), 6u); + EXPECT_GE(sizeof(wValue), 6u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, storageTestData, sizeof(sValue)); @@ -700,7 +700,7 @@ void Test_UINT48_LE(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 0x123456789ABC); + EXPECT_EQ(wValue, 0x123456789ABCu); StorageType sNewValue; @@ -708,22 +708,22 @@ void Test_UINT48_LE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_UINT48_BE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT48_BE) { // Unsigned 48-bit Integer : 6 bytes - big-endian using IntType = NumericAttributeTraits, true>; @@ -738,8 +738,8 @@ void Test_UINT48_BE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = 281474976710655; // 0xFFFFFFFFFFFF // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 6); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 6); + EXPECT_EQ(sizeof(sValue), 6u); + EXPECT_GE(sizeof(wValue), 6u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, storageTestData, sizeof(sValue)); @@ -748,7 +748,7 @@ void Test_UINT48_BE(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 0x123456789ABC); + EXPECT_EQ(wValue, 0x123456789ABCu); StorageType sNewValue; @@ -756,22 +756,22 @@ void Test_UINT48_BE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_SINT48_LE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT48_LE) { // Signed 48-bit Integer : 6 bytes - little-endian using IntType = NumericAttributeTraits, false>; @@ -790,10 +790,10 @@ void Test_SINT48_LE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestSignedNullValue = -140737488355328; // -0x800000000000 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValuePos) == 6); - NL_TEST_ASSERT(apSuite, sizeof(wValuePos) >= 6); - NL_TEST_ASSERT(apSuite, sizeof(sValueNeg) == 6); - NL_TEST_ASSERT(apSuite, sizeof(wValueNeg) >= 6); + EXPECT_EQ(sizeof(sValuePos), 6u); + EXPECT_GE(sizeof(wValuePos), 6u); + EXPECT_EQ(sizeof(sValueNeg), 6u); + EXPECT_GE(sizeof(wValueNeg), 6u); // Initialize the Storage Values with the test-buffer memcpy(&sValuePos, storageTestDataPos, sizeof(sValuePos)); @@ -804,8 +804,8 @@ void Test_SINT48_LE(nlTestSuite * apSuite, void * apContext) wValueNeg = IntType::StorageToWorking(sValueNeg); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValuePos == workingDataPos); - NL_TEST_ASSERT(apSuite, wValueNeg == workingDataNeg); + EXPECT_EQ(wValuePos, workingDataPos); + EXPECT_EQ(wValueNeg, workingDataNeg); StorageType sNewValuePos; StorageType sNewValueNeg; @@ -815,8 +815,8 @@ void Test_SINT48_LE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValueNeg, sNewValueNeg); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)) == 0); - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)) == 0); + EXPECT_EQ(memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)), 0); + EXPECT_EQ(memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)), 0); StorageType sNullValue; WorkingType wNullValue; @@ -824,19 +824,19 @@ void Test_SINT48_LE(nlTestSuite * apSuite, void * apContext) // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestSignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestSignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, wNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); + EXPECT_TRUE(IntType::CanRepresentValue(false, wNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, wNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); + EXPECT_FALSE(IntType::CanRepresentValue(true, wNullValue)); } -void Test_SINT48_BE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT48_BE) { // Signed 48-bit Integer : 6 bytes - big-endian using IntType = NumericAttributeTraits, true>; @@ -855,10 +855,10 @@ void Test_SINT48_BE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestSignedNullValue = -140737488355328; // -0x800000000000 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValuePos) == 6); - NL_TEST_ASSERT(apSuite, sizeof(wValuePos) >= 6); - NL_TEST_ASSERT(apSuite, sizeof(sValueNeg) == 6); - NL_TEST_ASSERT(apSuite, sizeof(wValueNeg) >= 6); + EXPECT_EQ(sizeof(sValuePos), 6u); + EXPECT_GE(sizeof(wValuePos), 6u); + EXPECT_EQ(sizeof(sValueNeg), 6u); + EXPECT_GE(sizeof(wValueNeg), 6u); // Initialize the Storage Values with the test-buffer memcpy(&sValuePos, storageTestDataPos, sizeof(sValuePos)); @@ -869,8 +869,8 @@ void Test_SINT48_BE(nlTestSuite * apSuite, void * apContext) wValueNeg = IntType::StorageToWorking(sValueNeg); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValuePos == workingDataPos); - NL_TEST_ASSERT(apSuite, wValueNeg == workingDataNeg); + EXPECT_EQ(wValuePos, workingDataPos); + EXPECT_EQ(wValueNeg, workingDataNeg); StorageType sNewValuePos; StorageType sNewValueNeg; @@ -880,8 +880,8 @@ void Test_SINT48_BE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValueNeg, sNewValueNeg); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)) == 0); - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)) == 0); + EXPECT_EQ(memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)), 0); + EXPECT_EQ(memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)), 0); StorageType sNullValue; WorkingType wNullValue; @@ -889,16 +889,16 @@ void Test_SINT48_BE(nlTestSuite * apSuite, void * apContext) // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestSignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestSignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, wNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); + EXPECT_TRUE(IntType::CanRepresentValue(false, wNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, wNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); + EXPECT_FALSE(IntType::CanRepresentValue(true, wNullValue)); } //////////////////////////////////////////////////////////// @@ -913,7 +913,7 @@ void Test_SINT48_BE(nlTestSuite * apSuite, void * apContext) // $$$$$$/ $$$$$$/ $$$$$$$/ $$$$$$/ $$/ // // // //////////////////////////////////////////////////////////// -void Test_UINT56_LE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT56_LE) { // Unsigned 56-bit Integer : 7 bytes - little-endian using IntType = NumericAttributeTraits, false>; @@ -928,8 +928,8 @@ void Test_UINT56_LE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = 72057594037927935; // 0xFFFFFFFFFFFFFF // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 7); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 7); + EXPECT_EQ(sizeof(sValue), 7u); + EXPECT_GE(sizeof(wValue), 7u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, storageTestData, sizeof(sValue)); @@ -938,7 +938,7 @@ void Test_UINT56_LE(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 0x123456789ABCDE); + EXPECT_EQ(wValue, 0x123456789ABCDEu); StorageType sNewValue; @@ -946,22 +946,22 @@ void Test_UINT56_LE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_UINT56_BE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_UINT56_BE) { // Unsigned 56-bit Integer : 7 bytes - big-endian using IntType = NumericAttributeTraits, true>; @@ -976,8 +976,8 @@ void Test_UINT56_BE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestUnsignedNullValue = 72057594037927935; // 0xFFFFFFFFFFFFFF // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValue) == 7); - NL_TEST_ASSERT(apSuite, sizeof(wValue) >= 7); + EXPECT_EQ(sizeof(sValue), 7u); + EXPECT_GE(sizeof(wValue), 7u); // Initialize the Storage Value with the test-buffer memcpy(&sValue, storageTestData, sizeof(sValue)); @@ -986,7 +986,7 @@ void Test_UINT56_BE(nlTestSuite * apSuite, void * apContext) wValue = IntType::StorageToWorking(sValue); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValue == 0x123456789ABCDE); + EXPECT_EQ(wValue, 0x123456789ABCDEu); StorageType sNewValue; @@ -994,22 +994,22 @@ void Test_UINT56_BE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValue, sNewValue); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestData, &sNewValue, sizeof(sNewValue)) == 0); + EXPECT_EQ(memcmp(storageTestData, &sNewValue, sizeof(sNewValue)), 0); // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestUnsignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestUnsignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); } -void Test_SINT56_LE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT56_LE) { // Signed 56-bit Integer : 6 bytes - little-endian using IntType = NumericAttributeTraits, false>; @@ -1028,10 +1028,10 @@ void Test_SINT56_LE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestSignedNullValue = -36028797018963968; // -0x80000000000000 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValuePos) == 7); - NL_TEST_ASSERT(apSuite, sizeof(wValuePos) >= 7); - NL_TEST_ASSERT(apSuite, sizeof(sValueNeg) == 7); - NL_TEST_ASSERT(apSuite, sizeof(wValueNeg) >= 7); + EXPECT_EQ(sizeof(sValuePos), 7u); + EXPECT_GE(sizeof(wValuePos), 7u); + EXPECT_EQ(sizeof(sValueNeg), 7u); + EXPECT_GE(sizeof(wValueNeg), 7u); // Initialize the Storage Values with the test-buffer memcpy(&sValuePos, storageTestDataPos, sizeof(sValuePos)); @@ -1042,8 +1042,8 @@ void Test_SINT56_LE(nlTestSuite * apSuite, void * apContext) wValueNeg = IntType::StorageToWorking(sValueNeg); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValuePos == workingDataPos); - NL_TEST_ASSERT(apSuite, wValueNeg == workingDataNeg); + EXPECT_EQ(wValuePos, workingDataPos); + EXPECT_EQ(wValueNeg, workingDataNeg); StorageType sNewValuePos; StorageType sNewValueNeg; @@ -1053,8 +1053,8 @@ void Test_SINT56_LE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValueNeg, sNewValueNeg); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)) == 0); - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)) == 0); + EXPECT_EQ(memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)), 0); + EXPECT_EQ(memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)), 0); StorageType sNullValue; WorkingType wNullValue; @@ -1062,19 +1062,19 @@ void Test_SINT56_LE(nlTestSuite * apSuite, void * apContext) // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestSignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestSignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, wNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); + EXPECT_TRUE(IntType::CanRepresentValue(false, wNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, wNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); + EXPECT_FALSE(IntType::CanRepresentValue(true, wNullValue)); } -void Test_SINT56_BE(nlTestSuite * apSuite, void * apContext) +TEST(TestNumericAttributeTraits, Test_SINT56_BE) { // Signed 56-bit Integer : 7 bytes - big-endian using IntType = NumericAttributeTraits, true>; @@ -1093,10 +1093,10 @@ void Test_SINT56_BE(nlTestSuite * apSuite, void * apContext) const WorkingType workingTestSignedNullValue = -36028797018963968; // -0x80000000000000 // 1) Verify the size of the types - NL_TEST_ASSERT(apSuite, sizeof(sValuePos) == 7); - NL_TEST_ASSERT(apSuite, sizeof(wValuePos) >= 7); - NL_TEST_ASSERT(apSuite, sizeof(sValueNeg) == 7); - NL_TEST_ASSERT(apSuite, sizeof(wValueNeg) >= 7); + EXPECT_EQ(sizeof(sValuePos), 7u); + EXPECT_GE(sizeof(wValuePos), 7u); + EXPECT_EQ(sizeof(sValueNeg), 7u); + EXPECT_GE(sizeof(wValueNeg), 7u); // Initialize the Storage Values with the test-buffer memcpy(&sValuePos, storageTestDataPos, sizeof(sValuePos)); @@ -1107,8 +1107,8 @@ void Test_SINT56_BE(nlTestSuite * apSuite, void * apContext) wValueNeg = IntType::StorageToWorking(sValueNeg); // 2) Verify that the correct storage format has been used - NL_TEST_ASSERT(apSuite, wValuePos == workingDataPos); - NL_TEST_ASSERT(apSuite, wValueNeg == workingDataNeg); + EXPECT_EQ(wValuePos, workingDataPos); + EXPECT_EQ(wValueNeg, workingDataNeg); StorageType sNewValuePos; StorageType sNewValueNeg; @@ -1118,8 +1118,8 @@ void Test_SINT56_BE(nlTestSuite * apSuite, void * apContext) IntType::WorkingToStorage(wValueNeg, sNewValueNeg); // 3) Verify that the bytes are located as intended - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)) == 0); - NL_TEST_ASSERT(apSuite, memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)) == 0); + EXPECT_EQ(memcmp(storageTestDataPos, &sNewValuePos, sizeof(sNewValuePos)), 0); + EXPECT_EQ(memcmp(storageTestDataNeg, &sNewValueNeg, sizeof(sNewValueNeg)), 0); StorageType sNullValue; WorkingType wNullValue; @@ -1127,82 +1127,16 @@ void Test_SINT56_BE(nlTestSuite * apSuite, void * apContext) // Set Storage value to Null IntType::SetNull(sNullValue); wNullValue = IntType::StorageToWorking(sNullValue); - NL_TEST_ASSERT(apSuite, wNullValue == workingTestSignedNullValue); - NL_TEST_ASSERT(apSuite, (IntType::IsNullValue(sNullValue) == true)); + EXPECT_EQ(wNullValue, workingTestSignedNullValue); + EXPECT_TRUE(IntType::IsNullValue(sNullValue)); // Verify that null values can fit into not nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, sNullValue) == true)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(false, wNullValue) == true)); + EXPECT_TRUE(IntType::CanRepresentValue(false, sNullValue)); + EXPECT_TRUE(IntType::CanRepresentValue(false, wNullValue)); // Verify that null values can't fit into nullable - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, sNullValue) == false)); - NL_TEST_ASSERT(apSuite, (IntType::CanRepresentValue(true, wNullValue) == false)); + EXPECT_FALSE(IntType::CanRepresentValue(true, sNullValue)); + EXPECT_FALSE(IntType::CanRepresentValue(true, wNullValue)); } -static int TestSetup(void * inContext) -{ - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - return SUCCESS; -} - -/** - * Test Suite. It lists all the test functions. - */ - -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("Test_UINT8", Test_UINT8), - NL_TEST_DEF("Test_SINT8", Test_SINT8), - NL_TEST_DEF("Test_SimpleEnum", Test_SimpleEnum), - - NL_TEST_DEF("Test_UINT24_LE",Test_UINT24_LE), - NL_TEST_DEF("Test_SINT24_LE",Test_SINT24_LE), - NL_TEST_DEF("Test_UINT24_BE",Test_UINT24_BE), - NL_TEST_DEF("Test_SINT24_BE",Test_SINT24_BE), - - NL_TEST_DEF("Test_UINT40_LE",Test_UINT40_LE), - NL_TEST_DEF("Test_SINT40_LE",Test_SINT40_LE), - NL_TEST_DEF("Test_UINT40_BE",Test_UINT40_BE), - NL_TEST_DEF("Test_SINT40_BE",Test_SINT40_BE), - - NL_TEST_DEF("Test_UINT48_LE",Test_UINT48_LE), - NL_TEST_DEF("Test_SINT48_LE",Test_SINT48_LE), - NL_TEST_DEF("Test_UINT48_BE",Test_UINT48_BE), - NL_TEST_DEF("Test_SINT48_BE",Test_SINT48_BE), - - NL_TEST_DEF("Test_UINT56_LE",Test_UINT56_LE), - NL_TEST_DEF("Test_SINT56_LE",Test_SINT56_LE), - NL_TEST_DEF("Test_UINT56_BE",Test_UINT56_BE), - NL_TEST_DEF("Test_SINT56_BE",Test_SINT56_BE), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -nlTestSuite theSuite = -{ - "TestNumericAttributeTraits", - &sTests[0], - TestSetup, - TestTeardown -}; -// clang-format on - } // namespace - -int TestNumericAttributeTraits() -{ - nlTestRunner(&theSuite, nullptr); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestNumericAttributeTraits) diff --git a/src/app/tests/TestOperationalStateClusterObjects.cpp b/src/app/tests/TestOperationalStateClusterObjects.cpp index 9f7d1e1efcadac..2b305949d8fe8d 100644 --- a/src/app/tests/TestOperationalStateClusterObjects.cpp +++ b/src/app/tests/TestOperationalStateClusterObjects.cpp @@ -17,9 +17,8 @@ #include #include -#include - -#include +#include +#include using namespace chip; using namespace chip::DeviceLayer; @@ -27,31 +26,38 @@ using namespace chip::app::Clusters::OperationalState; namespace { -void TestStructGenericOperationalStateConstructorWithOnlyStateID(nlTestSuite * inSuite, void * inContext) +class TestOperationalStateClusterObjects : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalStateConstructorWithOnlyStateID) { using namespace chip::app::Clusters::OperationalState; // General state: Stopped GenericOperationalState operationalStateStopped(to_underlying(OperationalStateEnum::kStopped)); - NL_TEST_ASSERT(inSuite, operationalStateStopped.operationalStateID == to_underlying(OperationalStateEnum::kStopped)); - NL_TEST_ASSERT(inSuite, operationalStateStopped.operationalStateLabel.HasValue() == false); + EXPECT_EQ(operationalStateStopped.operationalStateID, to_underlying(OperationalStateEnum::kStopped)); + EXPECT_FALSE(operationalStateStopped.operationalStateLabel.HasValue()); // General state: Running GenericOperationalState operationalStateRunning(to_underlying(OperationalStateEnum::kRunning)); - NL_TEST_ASSERT(inSuite, operationalStateRunning.operationalStateID == to_underlying(OperationalStateEnum::kRunning)); - NL_TEST_ASSERT(inSuite, operationalStateRunning.operationalStateLabel.HasValue() == false); + EXPECT_EQ(operationalStateRunning.operationalStateID, to_underlying(OperationalStateEnum::kRunning)); + EXPECT_FALSE(operationalStateRunning.operationalStateLabel.HasValue()); // General state: Paused GenericOperationalState operationalStatePaused(to_underlying(OperationalStateEnum::kPaused)); - NL_TEST_ASSERT(inSuite, operationalStatePaused.operationalStateID == to_underlying(OperationalStateEnum::kPaused)); - NL_TEST_ASSERT(inSuite, operationalStatePaused.operationalStateLabel.HasValue() == false); + EXPECT_EQ(operationalStatePaused.operationalStateID, to_underlying(OperationalStateEnum::kPaused)); + EXPECT_FALSE(operationalStatePaused.operationalStateLabel.HasValue()); // General state: Error GenericOperationalState operationalStateError(to_underlying(OperationalStateEnum::kError)); - NL_TEST_ASSERT(inSuite, operationalStateError.operationalStateID == to_underlying(OperationalStateEnum::kError)); - NL_TEST_ASSERT(inSuite, operationalStateError.operationalStateLabel.HasValue() == false); + EXPECT_EQ(operationalStateError.operationalStateID, to_underlying(OperationalStateEnum::kError)); + EXPECT_FALSE(operationalStateError.operationalStateLabel.HasValue()); } -void TestStructGenericOperationalStateConstructorWithStateIDAndStateLabel(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalStateConstructorWithStateIDAndStateLabel) { using namespace chip::app::Clusters::OperationalState; @@ -66,14 +72,13 @@ void TestStructGenericOperationalStateConstructorWithStateIDAndStateLabel(nlTest GenericOperationalState operationalState(to_underlying(ManufactureOperationalStateEnum::kRebooting), Optional(CharSpan::fromCharString(buffer))); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateID == to_underlying(ManufactureOperationalStateEnum::kRebooting)); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.Value().size() == strlen(buffer)); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalState.operationalStateLabel.Value().data()), buffer, strlen(buffer)) == 0); + EXPECT_EQ(operationalState.operationalStateID, to_underlying(ManufactureOperationalStateEnum::kRebooting)); + EXPECT_TRUE(operationalState.operationalStateLabel.HasValue()); + EXPECT_EQ(operationalState.operationalStateLabel.Value().size(), strlen(buffer)); + EXPECT_EQ(memcmp(const_cast(operationalState.operationalStateLabel.Value().data()), buffer, strlen(buffer)), 0); } -void TestStructGenericOperationalStateCopyConstructor(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalStateCopyConstructor) { using namespace chip::app::Clusters::OperationalState; @@ -89,18 +94,16 @@ void TestStructGenericOperationalStateCopyConstructor(nlTestSuite * inSuite, voi GenericOperationalState desOperationalState(srcOperationalState); - NL_TEST_ASSERT(inSuite, desOperationalState.operationalStateID == srcOperationalState.operationalStateID); - NL_TEST_ASSERT(inSuite, desOperationalState.operationalStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, - desOperationalState.operationalStateLabel.Value().size() == - srcOperationalState.operationalStateLabel.Value().size()); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(desOperationalState.operationalStateLabel.Value().data()), - const_cast(srcOperationalState.operationalStateLabel.Value().data()), - desOperationalState.operationalStateLabel.Value().size()) == 0); + EXPECT_EQ(desOperationalState.operationalStateID, srcOperationalState.operationalStateID); + EXPECT_TRUE(desOperationalState.operationalStateLabel.HasValue()); + EXPECT_EQ(desOperationalState.operationalStateLabel.Value().size(), srcOperationalState.operationalStateLabel.Value().size()); + EXPECT_EQ(memcmp(const_cast(desOperationalState.operationalStateLabel.Value().data()), + const_cast(srcOperationalState.operationalStateLabel.Value().data()), + desOperationalState.operationalStateLabel.Value().size()), + 0); } -void TestStructGenericOperationalStateCopyAssignment(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalStateCopyAssignment) { using namespace chip::app::Clusters::OperationalState; @@ -116,18 +119,16 @@ void TestStructGenericOperationalStateCopyAssignment(nlTestSuite * inSuite, void GenericOperationalState desOperationalState = srcOperationalState; - NL_TEST_ASSERT(inSuite, desOperationalState.operationalStateID == srcOperationalState.operationalStateID); - NL_TEST_ASSERT(inSuite, desOperationalState.operationalStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, - desOperationalState.operationalStateLabel.Value().size() == - srcOperationalState.operationalStateLabel.Value().size()); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(desOperationalState.operationalStateLabel.Value().data()), - const_cast(srcOperationalState.operationalStateLabel.Value().data()), - desOperationalState.operationalStateLabel.Value().size()) == 0); + EXPECT_EQ(desOperationalState.operationalStateID, srcOperationalState.operationalStateID); + EXPECT_TRUE(desOperationalState.operationalStateLabel.HasValue()); + EXPECT_EQ(desOperationalState.operationalStateLabel.Value().size(), srcOperationalState.operationalStateLabel.Value().size()); + EXPECT_EQ(memcmp(const_cast(desOperationalState.operationalStateLabel.Value().data()), + const_cast(srcOperationalState.operationalStateLabel.Value().data()), + desOperationalState.operationalStateLabel.Value().size()), + 0); } -void TestStructGenericOperationalStateFuncSet(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalStateFuncSet) { using namespace chip::app::Clusters::OperationalState; @@ -144,17 +145,16 @@ void TestStructGenericOperationalStateFuncSet(nlTestSuite * inSuite, void * inCo // change state without label operationalState.Set(to_underlying(OperationalStateEnum::kStopped)); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateID == to_underlying(OperationalStateEnum::kStopped)); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.HasValue() == false); + EXPECT_EQ(operationalState.operationalStateID, to_underlying(OperationalStateEnum::kStopped)); + EXPECT_FALSE(operationalState.operationalStateLabel.HasValue()); // change state with label operationalState.Set(to_underlying(ManufactureOperationalStateEnum::kRebooting), Optional(CharSpan::fromCharString(buffer))); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateID == to_underlying(ManufactureOperationalStateEnum::kRebooting)); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.Value().size() == strlen(buffer)); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalState.operationalStateLabel.Value().data()), buffer, strlen(buffer)) == 0); + EXPECT_EQ(operationalState.operationalStateID, to_underlying(ManufactureOperationalStateEnum::kRebooting)); + EXPECT_TRUE(operationalState.operationalStateLabel.HasValue()); + EXPECT_EQ(operationalState.operationalStateLabel.Value().size(), strlen(buffer)); + EXPECT_EQ(memcmp(const_cast(operationalState.operationalStateLabel.Value().data()), buffer, strlen(buffer)), 0); // change state with label, label len = kOperationalStateLabelMaxSize for (size_t i = 0; i < sizeof(buffer); i++) @@ -163,11 +163,10 @@ void TestStructGenericOperationalStateFuncSet(nlTestSuite * inSuite, void * inCo } operationalState.Set(to_underlying(ManufactureOperationalStateEnum::kRebooting), Optional(CharSpan(buffer, sizeof(buffer)))); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateID == to_underlying(ManufactureOperationalStateEnum::kRebooting)); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.Value().size() == sizeof(buffer)); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalState.operationalStateLabel.Value().data()), buffer, sizeof(buffer)) == 0); + EXPECT_EQ(operationalState.operationalStateID, to_underlying(ManufactureOperationalStateEnum::kRebooting)); + EXPECT_TRUE(operationalState.operationalStateLabel.HasValue()); + EXPECT_EQ(operationalState.operationalStateLabel.Value().size(), sizeof(buffer)); + EXPECT_EQ(memcmp(const_cast(operationalState.operationalStateLabel.Value().data()), buffer, sizeof(buffer)), 0); // change state with label, label len larger than kOperationalStateLabelMaxSize char buffer2[kOperationalStateLabelMaxSize + 1]; @@ -178,51 +177,47 @@ void TestStructGenericOperationalStateFuncSet(nlTestSuite * inSuite, void * inCo } operationalState.Set(to_underlying(ManufactureOperationalStateEnum::kRebooting), Optional(CharSpan(buffer2, sizeof(buffer2)))); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateID == to_underlying(ManufactureOperationalStateEnum::kRebooting)); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalState.operationalStateLabel.Value().size() == kOperationalStateLabelMaxSize); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalState.operationalStateLabel.Value().data()), buffer2, - kOperationalStateLabelMaxSize) == 0); + EXPECT_EQ(operationalState.operationalStateID, to_underlying(ManufactureOperationalStateEnum::kRebooting)); + EXPECT_TRUE(operationalState.operationalStateLabel.HasValue()); + EXPECT_EQ(operationalState.operationalStateLabel.Value().size(), kOperationalStateLabelMaxSize); + EXPECT_EQ( + memcmp(const_cast(operationalState.operationalStateLabel.Value().data()), buffer2, kOperationalStateLabelMaxSize), + 0); } -void TestStructGenericOperationalErrorConstructorWithOnlyStateID(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalErrorConstructorWithOnlyStateID) { using namespace chip::app::Clusters::OperationalState; // General errors: NoError GenericOperationalError operationalErrorNoErr(to_underlying(ErrorStateEnum::kNoError)); - NL_TEST_ASSERT(inSuite, operationalErrorNoErr.errorStateID == to_underlying(ErrorStateEnum::kNoError)); - NL_TEST_ASSERT(inSuite, operationalErrorNoErr.errorStateLabel.HasValue() == false); - NL_TEST_ASSERT(inSuite, operationalErrorNoErr.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalErrorNoErr.errorStateID, to_underlying(ErrorStateEnum::kNoError)); + EXPECT_FALSE(operationalErrorNoErr.errorStateLabel.HasValue()); + EXPECT_FALSE(operationalErrorNoErr.errorStateDetails.HasValue()); // General errors: UnableToStartOrResume GenericOperationalError operationalErrorUnableToStartOrResume(to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, - operationalErrorUnableToStartOrResume.errorStateID == to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, operationalErrorUnableToStartOrResume.errorStateLabel.HasValue() == false); - NL_TEST_ASSERT(inSuite, operationalErrorUnableToStartOrResume.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalErrorUnableToStartOrResume.errorStateID, to_underlying(ErrorStateEnum::kUnableToStartOrResume)); + EXPECT_FALSE(operationalErrorUnableToStartOrResume.errorStateLabel.HasValue()); + EXPECT_FALSE(operationalErrorUnableToStartOrResume.errorStateDetails.HasValue()); // General errors: UnableToCompleteOperation GenericOperationalError operationalErrorkUnableToCompleteOperation(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); - NL_TEST_ASSERT(inSuite, - operationalErrorkUnableToCompleteOperation.errorStateID == - to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); - NL_TEST_ASSERT(inSuite, operationalErrorkUnableToCompleteOperation.errorStateLabel.HasValue() == false); - NL_TEST_ASSERT(inSuite, operationalErrorkUnableToCompleteOperation.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalErrorkUnableToCompleteOperation.errorStateID, to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + EXPECT_FALSE(operationalErrorkUnableToCompleteOperation.errorStateLabel.HasValue()); + EXPECT_FALSE(operationalErrorkUnableToCompleteOperation.errorStateDetails.HasValue()); // General errors: CommandInvalidInState GenericOperationalError operationalErrorCommandInvalidInState(to_underlying(ErrorStateEnum::kCommandInvalidInState)); - NL_TEST_ASSERT(inSuite, - operationalErrorCommandInvalidInState.errorStateID == to_underlying(ErrorStateEnum::kCommandInvalidInState)); - NL_TEST_ASSERT(inSuite, operationalErrorCommandInvalidInState.errorStateLabel.HasValue() == false); - NL_TEST_ASSERT(inSuite, operationalErrorCommandInvalidInState.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalErrorCommandInvalidInState.errorStateID, to_underlying(ErrorStateEnum::kCommandInvalidInState)); + EXPECT_FALSE(operationalErrorCommandInvalidInState.errorStateLabel.HasValue()); + EXPECT_FALSE(operationalErrorCommandInvalidInState.errorStateDetails.HasValue()); } -void TestStructGenericOperationalErrorConstructorWithStateIDAndStateLabel(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalErrorConstructorWithStateIDAndStateLabel) { using namespace chip::app::Clusters::OperationalState; @@ -237,16 +232,14 @@ void TestStructGenericOperationalErrorConstructorWithStateIDAndStateLabel(nlTest GenericOperationalError operationalError(to_underlying(ManufactureOperationalErrorEnum::kLowBattery), Optional(CharSpan::fromCharString(labelBuffer))); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ManufactureOperationalErrorEnum::kLowBattery)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.Value().size() == strlen(labelBuffer)); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, strlen(labelBuffer)) == - 0); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalError.errorStateID, to_underlying(ManufactureOperationalErrorEnum::kLowBattery)); + EXPECT_TRUE(operationalError.errorStateLabel.HasValue()); + EXPECT_EQ(operationalError.errorStateLabel.Value().size(), strlen(labelBuffer)); + EXPECT_EQ(memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, strlen(labelBuffer)), 0); + EXPECT_FALSE(operationalError.errorStateDetails.HasValue()); } -void TestStructGenericOperationalErrorConstructorWithFullParam(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalErrorConstructorWithFullParam) { using namespace chip::app::Clusters::OperationalState; @@ -263,21 +256,17 @@ void TestStructGenericOperationalErrorConstructorWithFullParam(nlTestSuite * inS Optional(CharSpan::fromCharString(labelBuffer)), Optional(CharSpan::fromCharString(detailBuffer))); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ManufactureOperationalErrorEnum::kLowBattery)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.Value().size() == strlen(labelBuffer)); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, strlen(labelBuffer)) == - 0); - - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.Value().size() == strlen(detailBuffer)); - NL_TEST_ASSERT( - inSuite, - memcmp(const_cast(operationalError.errorStateDetails.Value().data()), detailBuffer, strlen(detailBuffer)) == 0); + EXPECT_EQ(operationalError.errorStateID, to_underlying(ManufactureOperationalErrorEnum::kLowBattery)); + EXPECT_TRUE(operationalError.errorStateLabel.HasValue()); + EXPECT_EQ(operationalError.errorStateLabel.Value().size(), strlen(labelBuffer)); + EXPECT_EQ(memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, strlen(labelBuffer)), 0); + + EXPECT_TRUE(operationalError.errorStateDetails.HasValue()); + EXPECT_EQ(operationalError.errorStateDetails.Value().size(), strlen(detailBuffer)); + EXPECT_EQ(memcmp(const_cast(operationalError.errorStateDetails.Value().data()), detailBuffer, strlen(detailBuffer)), 0); } -void TestStructGenericOperationalErrorCopyConstructor(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalErrorCopyConstructor) { using namespace chip::app::Clusters::OperationalState; @@ -296,25 +285,23 @@ void TestStructGenericOperationalErrorCopyConstructor(nlTestSuite * inSuite, voi // call copy constructor GenericOperationalError desOperationalError(srcOperationalError); - NL_TEST_ASSERT(inSuite, desOperationalError.errorStateID == srcOperationalError.errorStateID); - NL_TEST_ASSERT(inSuite, desOperationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, - desOperationalError.errorStateLabel.Value().size() == srcOperationalError.errorStateLabel.Value().size()); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(desOperationalError.errorStateLabel.Value().data()), - const_cast(srcOperationalError.errorStateLabel.Value().data()), - desOperationalError.errorStateLabel.Value().size()) == 0); - - NL_TEST_ASSERT(inSuite, desOperationalError.errorStateDetails.HasValue() == true); - NL_TEST_ASSERT(inSuite, - desOperationalError.errorStateDetails.Value().size() == srcOperationalError.errorStateDetails.Value().size()); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(desOperationalError.errorStateDetails.Value().data()), - const_cast(srcOperationalError.errorStateDetails.Value().data()), - desOperationalError.errorStateDetails.Value().size()) == 0); + EXPECT_EQ(desOperationalError.errorStateID, srcOperationalError.errorStateID); + EXPECT_TRUE(desOperationalError.errorStateLabel.HasValue()); + EXPECT_EQ(desOperationalError.errorStateLabel.Value().size(), srcOperationalError.errorStateLabel.Value().size()); + EXPECT_EQ(memcmp(const_cast(desOperationalError.errorStateLabel.Value().data()), + const_cast(srcOperationalError.errorStateLabel.Value().data()), + desOperationalError.errorStateLabel.Value().size()), + 0); + + EXPECT_TRUE(desOperationalError.errorStateDetails.HasValue()); + EXPECT_EQ(desOperationalError.errorStateDetails.Value().size(), srcOperationalError.errorStateDetails.Value().size()); + EXPECT_EQ(memcmp(const_cast(desOperationalError.errorStateDetails.Value().data()), + const_cast(srcOperationalError.errorStateDetails.Value().data()), + desOperationalError.errorStateDetails.Value().size()), + 0); } -void TestStructGenericOperationalErrorCopyAssignment(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalErrorCopyAssignment) { using namespace chip::app::Clusters::OperationalState; @@ -333,25 +320,23 @@ void TestStructGenericOperationalErrorCopyAssignment(nlTestSuite * inSuite, void // call copy assignment GenericOperationalError desOperationalError = srcOperationalError; - NL_TEST_ASSERT(inSuite, desOperationalError.errorStateID == srcOperationalError.errorStateID); - NL_TEST_ASSERT(inSuite, desOperationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, - desOperationalError.errorStateLabel.Value().size() == srcOperationalError.errorStateLabel.Value().size()); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(desOperationalError.errorStateLabel.Value().data()), - const_cast(srcOperationalError.errorStateLabel.Value().data()), - desOperationalError.errorStateLabel.Value().size()) == 0); - - NL_TEST_ASSERT(inSuite, desOperationalError.errorStateDetails.HasValue() == true); - NL_TEST_ASSERT(inSuite, - desOperationalError.errorStateDetails.Value().size() == srcOperationalError.errorStateDetails.Value().size()); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(desOperationalError.errorStateDetails.Value().data()), - const_cast(srcOperationalError.errorStateDetails.Value().data()), - desOperationalError.errorStateDetails.Value().size()) == 0); + EXPECT_EQ(desOperationalError.errorStateID, srcOperationalError.errorStateID); + EXPECT_TRUE(desOperationalError.errorStateLabel.HasValue()); + EXPECT_EQ(desOperationalError.errorStateLabel.Value().size(), srcOperationalError.errorStateLabel.Value().size()); + EXPECT_EQ(memcmp(const_cast(desOperationalError.errorStateLabel.Value().data()), + const_cast(srcOperationalError.errorStateLabel.Value().data()), + desOperationalError.errorStateLabel.Value().size()), + 0); + + EXPECT_TRUE(desOperationalError.errorStateDetails.HasValue()); + EXPECT_EQ(desOperationalError.errorStateDetails.Value().size(), srcOperationalError.errorStateDetails.Value().size()); + EXPECT_EQ(memcmp(const_cast(desOperationalError.errorStateDetails.Value().data()), + const_cast(srcOperationalError.errorStateDetails.Value().data()), + desOperationalError.errorStateDetails.Value().size()), + 0); } -void TestStructGenericOperationalErrorFuncSet(nlTestSuite * inSuite, void * inContext) +TEST_F(TestOperationalStateClusterObjects, TestStructGenericOperationalErrorFuncSet) { using namespace chip::app::Clusters::OperationalState; enum class ManufactureOperationalErrorEnum : uint8_t @@ -366,46 +351,40 @@ void TestStructGenericOperationalErrorFuncSet(nlTestSuite * inSuite, void * inCo // General errors: NoError GenericOperationalError operationalError(to_underlying(ErrorStateEnum::kNoError)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ErrorStateEnum::kNoError)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == false); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalError.errorStateID, to_underlying(ErrorStateEnum::kNoError)); + EXPECT_FALSE(operationalError.errorStateLabel.HasValue()); + EXPECT_FALSE(operationalError.errorStateDetails.HasValue()); // call Set with stateId operationalError.Set(to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == false); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalError.errorStateID, to_underlying(ErrorStateEnum::kUnableToStartOrResume)); + EXPECT_FALSE(operationalError.errorStateLabel.HasValue()); + EXPECT_FALSE(operationalError.errorStateDetails.HasValue()); // call Set with stateId and StateLabel operationalError.Set(to_underlying(ErrorStateEnum::kUnableToStartOrResume), Optional(CharSpan::fromCharString(labelBuffer))); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.Value().size() == strlen(labelBuffer)); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, strlen(labelBuffer)) == - 0); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalError.errorStateID, to_underlying(ErrorStateEnum::kUnableToStartOrResume)); + EXPECT_TRUE(operationalError.errorStateLabel.HasValue()); + EXPECT_EQ(operationalError.errorStateLabel.Value().size(), strlen(labelBuffer)); + EXPECT_EQ(memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, strlen(labelBuffer)), 0); + EXPECT_FALSE(operationalError.errorStateDetails.HasValue()); // call Set with stateId, StateLabel and StateDetails operationalError.Set(to_underlying(ErrorStateEnum::kUnableToStartOrResume), Optional(CharSpan::fromCharString(labelBuffer)), Optional(CharSpan::fromCharString(detailBuffer))); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.Value().size() == strlen(labelBuffer)); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, strlen(labelBuffer)) == - 0); + EXPECT_EQ(operationalError.errorStateID, to_underlying(ErrorStateEnum::kUnableToStartOrResume)); + EXPECT_TRUE(operationalError.errorStateLabel.HasValue()); + EXPECT_EQ(operationalError.errorStateLabel.Value().size(), strlen(labelBuffer)); + EXPECT_EQ(memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, strlen(labelBuffer)), 0); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.Value().size() == strlen(detailBuffer)); - NL_TEST_ASSERT( - inSuite, - memcmp(const_cast(operationalError.errorStateDetails.Value().data()), detailBuffer, strlen(detailBuffer)) == 0); + EXPECT_TRUE(operationalError.errorStateDetails.HasValue()); + EXPECT_EQ(operationalError.errorStateDetails.Value().size(), strlen(detailBuffer)); + EXPECT_EQ(memcmp(const_cast(operationalError.errorStateDetails.Value().data()), detailBuffer, strlen(detailBuffer)), 0); // change state with label, label len = kOperationalStateLabelMaxSize for (size_t i = 0; i < sizeof(labelBuffer); i++) @@ -415,13 +394,11 @@ void TestStructGenericOperationalErrorFuncSet(nlTestSuite * inSuite, void * inCo operationalError.Set(to_underlying(ErrorStateEnum::kUnableToStartOrResume), Optional(CharSpan(labelBuffer, sizeof(labelBuffer)))); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.Value().size() == sizeof(labelBuffer)); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, sizeof(labelBuffer)) == - 0); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalError.errorStateID, to_underlying(ErrorStateEnum::kUnableToStartOrResume)); + EXPECT_TRUE(operationalError.errorStateLabel.HasValue()); + EXPECT_EQ(operationalError.errorStateLabel.Value().size(), sizeof(labelBuffer)); + EXPECT_EQ(memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer, sizeof(labelBuffer)), 0); + EXPECT_FALSE(operationalError.errorStateDetails.HasValue()); // change state with label, label len = kOperationalStateLabelMaxSize + 1 char labelBuffer2[kOperationalErrorLabelMaxSize + 1]; @@ -432,13 +409,13 @@ void TestStructGenericOperationalErrorFuncSet(nlTestSuite * inSuite, void * inCo operationalError.Set(to_underlying(ErrorStateEnum::kUnableToStartOrResume), Optional(CharSpan(labelBuffer2, sizeof(labelBuffer2)))); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.Value().size() == kOperationalErrorLabelMaxSize); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer2, - kOperationalErrorLabelMaxSize) == 0); - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == false); + EXPECT_EQ(operationalError.errorStateID, to_underlying(ErrorStateEnum::kUnableToStartOrResume)); + EXPECT_TRUE(operationalError.errorStateLabel.HasValue()); + EXPECT_EQ(operationalError.errorStateLabel.Value().size(), kOperationalErrorLabelMaxSize); + EXPECT_EQ( + memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer2, kOperationalErrorLabelMaxSize), + 0); + EXPECT_FALSE(operationalError.errorStateDetails.HasValue()); // change state with label and details, details len = kOperationalErrorDetailsMaxSize + 1 char detailBuffer2[kOperationalErrorDetailsMaxSize + 1]; @@ -450,62 +427,19 @@ void TestStructGenericOperationalErrorFuncSet(nlTestSuite * inSuite, void * inCo Optional(CharSpan(labelBuffer2, sizeof(labelBuffer2))), Optional(CharSpan(detailBuffer2, sizeof(detailBuffer2)))); - NL_TEST_ASSERT(inSuite, operationalError.errorStateID == to_underlying(ErrorStateEnum::kUnableToStartOrResume)); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.HasValue() == true); - NL_TEST_ASSERT(inSuite, operationalError.errorStateLabel.Value().size() == kOperationalErrorLabelMaxSize); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer2, - kOperationalErrorLabelMaxSize) == 0); - - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.HasValue() == true); - - NL_TEST_ASSERT(inSuite, operationalError.errorStateDetails.Value().size() == kOperationalErrorDetailsMaxSize); - NL_TEST_ASSERT(inSuite, - memcmp(const_cast(operationalError.errorStateDetails.Value().data()), detailBuffer2, - kOperationalErrorDetailsMaxSize) == 0); -} - -const nlTest sTests[] = { - NL_TEST_DEF("Test struct GenericOperationalState: constructor with only StateID", - TestStructGenericOperationalStateConstructorWithOnlyStateID), - NL_TEST_DEF("Test struct GenericOperationalState: constructor with StateID and StateLabel", - TestStructGenericOperationalStateConstructorWithStateIDAndStateLabel), - NL_TEST_DEF("Test struct GenericOperationalState: copy constructor", TestStructGenericOperationalStateCopyConstructor), - NL_TEST_DEF("Test struct GenericOperationalState: copy assignment", TestStructGenericOperationalStateCopyAssignment), - NL_TEST_DEF("Test struct GenericOperationalState: member function 'Set'", TestStructGenericOperationalStateFuncSet), - NL_TEST_DEF("Test struct GenericOperationalError: constructor with only StateID", - TestStructGenericOperationalErrorConstructorWithOnlyStateID), - NL_TEST_DEF("Test struct GenericOperationalError: constructor with StateID and StateLabel", - TestStructGenericOperationalErrorConstructorWithStateIDAndStateLabel), - NL_TEST_DEF("Test struct GenericOperationalError: constructor with StateID, StateLabel and StateDetail", - TestStructGenericOperationalErrorConstructorWithFullParam), - NL_TEST_DEF("Test struct GenericOperationalError: copy constructor", TestStructGenericOperationalErrorCopyConstructor), - NL_TEST_DEF("Test struct GenericOperationalError: copy assignment", TestStructGenericOperationalErrorCopyAssignment), - NL_TEST_DEF("Test struct GenericOperationalError: member function 'Set'", TestStructGenericOperationalErrorFuncSet), - NL_TEST_SENTINEL() -}; + EXPECT_EQ(operationalError.errorStateID, to_underlying(ErrorStateEnum::kUnableToStartOrResume)); + EXPECT_TRUE(operationalError.errorStateLabel.HasValue()); + EXPECT_EQ(operationalError.errorStateLabel.Value().size(), kOperationalErrorLabelMaxSize); + EXPECT_EQ( + memcmp(const_cast(operationalError.errorStateLabel.Value().data()), labelBuffer2, kOperationalErrorLabelMaxSize), + 0); -int TestSetup(void * inContext) -{ - VerifyOrReturnError(CHIP_NO_ERROR == chip::Platform::MemoryInit(), FAILURE); - return SUCCESS; -} + EXPECT_TRUE(operationalError.errorStateDetails.HasValue()); -int TestTearDown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; + EXPECT_EQ(operationalError.errorStateDetails.Value().size(), kOperationalErrorDetailsMaxSize); + EXPECT_EQ(memcmp(const_cast(operationalError.errorStateDetails.Value().data()), detailBuffer2, + kOperationalErrorDetailsMaxSize), + 0); } } // namespace - -int TestOperationalStateClusterObjects() -{ - nlTestSuite theSuite = { "Test Operational State Cluster Objects tests", &sTests[0], TestSetup, TestTearDown }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestOperationalStateClusterObjects) diff --git a/src/app/tests/TestPendingNotificationMap.cpp b/src/app/tests/TestPendingNotificationMap.cpp index 98e27cb5f7b45a..94089e372d367e 100644 --- a/src/app/tests/TestPendingNotificationMap.cpp +++ b/src/app/tests/TestPendingNotificationMap.cpp @@ -18,9 +18,9 @@ #include #include #include +#include #include -#include -#include +#include using chip::BindingTable; using chip::ClusterId; @@ -33,6 +33,16 @@ using chip::PendingNotificationMap; namespace { +class TestPendingNotificationMap : public ::testing::Test +{ +public: + static void SetUpTestSuite() + { + static chip::TestPersistentStorageDelegate storage; + BindingTable::GetInstance().SetPersistentStorage(&storage); + } +}; + void ClearBindingTable(BindingTable & table) { auto iter = table.begin(); @@ -50,103 +60,83 @@ void CreateDefaultFullBindingTable(BindingTable & table) } } -void TestEmptyMap(nlTestSuite * aSuite, void * aContext) +TEST_F(TestPendingNotificationMap, TestEmptyMap) { PendingNotificationMap pendingMap; - NL_TEST_ASSERT(aSuite, pendingMap.begin() == pendingMap.end()); + EXPECT_EQ(pendingMap.begin(), pendingMap.end()); chip::ScopedNodeId peer; - NL_TEST_ASSERT(aSuite, pendingMap.FindLRUConnectPeer(peer) == CHIP_ERROR_NOT_FOUND); + EXPECT_EQ(pendingMap.FindLRUConnectPeer(peer), CHIP_ERROR_NOT_FOUND); } -void TestAddRemove(nlTestSuite * aSuite, void * aContext) +TEST_F(TestPendingNotificationMap, TestAddRemove) { PendingNotificationMap pendingMap; ClearBindingTable(BindingTable::GetInstance()); CreateDefaultFullBindingTable(BindingTable::GetInstance()); for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(i, nullptr) == CHIP_NO_ERROR); + EXPECT_EQ(pendingMap.AddPendingNotification(i, nullptr), CHIP_NO_ERROR); } // Confirm adding in one more element fails - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(MATTER_BINDING_TABLE_SIZE, nullptr) == CHIP_ERROR_NO_MEMORY); + EXPECT_EQ(pendingMap.AddPendingNotification(MATTER_BINDING_TABLE_SIZE, nullptr), CHIP_ERROR_NO_MEMORY); auto iter = pendingMap.begin(); for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { PendingNotificationEntry entry = *iter; - NL_TEST_ASSERT(aSuite, entry.mBindingEntryId == i); + EXPECT_EQ(entry.mBindingEntryId, i); ++iter; } - NL_TEST_ASSERT(aSuite, iter == pendingMap.end()); + EXPECT_EQ(iter, pendingMap.end()); pendingMap.RemoveAllEntriesForNode(chip::ScopedNodeId()); uint8_t expectedEntryIndecies[] = { 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; iter = pendingMap.begin(); for (uint8_t ch : expectedEntryIndecies) { PendingNotificationEntry entry = *iter; - NL_TEST_ASSERT(aSuite, entry.mBindingEntryId == ch); + EXPECT_EQ(entry.mBindingEntryId, ch); ++iter; } - NL_TEST_ASSERT(aSuite, iter == pendingMap.end()); + EXPECT_EQ(iter, pendingMap.end()); pendingMap.RemoveAllEntriesForFabric(0); iter = pendingMap.begin(); for (uint8_t i = 0; i < 10; i++) { PendingNotificationEntry entry = *iter; - NL_TEST_ASSERT(aSuite, entry.mBindingEntryId == 10 + i); + EXPECT_EQ(entry.mBindingEntryId, 10u + i); ++iter; } - NL_TEST_ASSERT(aSuite, iter == pendingMap.end()); + EXPECT_EQ(iter, pendingMap.end()); pendingMap.RemoveAllEntriesForFabric(1); - NL_TEST_ASSERT(aSuite, pendingMap.begin() == pendingMap.end()); + EXPECT_EQ(pendingMap.begin(), pendingMap.end()); } -void TestLRUEntry(nlTestSuite * aSuite, void * aContext) +TEST_F(TestPendingNotificationMap, TestLRUEntry) { PendingNotificationMap pendingMap; ClearBindingTable(BindingTable::GetInstance()); CreateDefaultFullBindingTable(BindingTable::GetInstance()); - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(0, nullptr) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(1, nullptr) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(5, nullptr) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(7, nullptr) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(11, nullptr) == CHIP_NO_ERROR); + EXPECT_EQ(pendingMap.AddPendingNotification(0, nullptr), CHIP_NO_ERROR); + EXPECT_EQ(pendingMap.AddPendingNotification(1, nullptr), CHIP_NO_ERROR); + EXPECT_EQ(pendingMap.AddPendingNotification(5, nullptr), CHIP_NO_ERROR); + EXPECT_EQ(pendingMap.AddPendingNotification(7, nullptr), CHIP_NO_ERROR); + EXPECT_EQ(pendingMap.AddPendingNotification(11, nullptr), CHIP_NO_ERROR); chip::ScopedNodeId node; - NL_TEST_ASSERT(aSuite, pendingMap.FindLRUConnectPeer(node) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, node.GetFabricIndex() == 0 && node.GetNodeId() == 1); + EXPECT_EQ(pendingMap.FindLRUConnectPeer(node), CHIP_NO_ERROR); + EXPECT_EQ(node.GetFabricIndex(), 0u); + EXPECT_EQ(node.GetNodeId(), 1u); pendingMap.RemoveEntry(1); - NL_TEST_ASSERT(aSuite, pendingMap.FindLRUConnectPeer(node) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, node.GetFabricIndex() == 0 && node.GetNodeId() == 0); + EXPECT_EQ(pendingMap.FindLRUConnectPeer(node), CHIP_NO_ERROR); + EXPECT_EQ(node.GetFabricIndex(), 0u); + EXPECT_EQ(node.GetNodeId(), 0u); pendingMap.RemoveAllEntriesForFabric(0); - NL_TEST_ASSERT(aSuite, pendingMap.FindLRUConnectPeer(node) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, node.GetFabricIndex() == 1 && node.GetNodeId() == 1); + EXPECT_EQ(pendingMap.FindLRUConnectPeer(node), CHIP_NO_ERROR); + EXPECT_EQ(node.GetFabricIndex(), 1u); + EXPECT_EQ(node.GetNodeId(), 1u); } } // namespace - -int TestPeindingNotificationMap() -{ - static nlTest sTests[] = { - NL_TEST_DEF("TestEmptyMap", TestEmptyMap), - NL_TEST_DEF("TestAddRemove", TestAddRemove), - NL_TEST_DEF("TestLRUEntry", TestLRUEntry), - NL_TEST_SENTINEL(), - }; - - nlTestSuite theSuite = { - "PendingNotificationMap", - &sTests[0], - nullptr, - nullptr, - }; - chip::TestPersistentStorageDelegate storage; - BindingTable::GetInstance().SetPersistentStorage(&storage); - nlTestRunner(&theSuite, nullptr); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestPeindingNotificationMap) diff --git a/src/app/tests/TestPendingResponseTrackerImpl.cpp b/src/app/tests/TestPendingResponseTrackerImpl.cpp index da6239434cd3b1..556bf3d87e2b30 100644 --- a/src/app/tests/TestPendingResponseTrackerImpl.cpp +++ b/src/app/tests/TestPendingResponseTrackerImpl.cpp @@ -15,75 +15,76 @@ * limitations under the License. */ -#include -#include - #include #include #include +#include +#include +#include + namespace { using namespace chip; -void TestPendingResponseTracker_FillEntireTracker(nlTestSuite * inSuite, void * inContext) +TEST(TestPendingResponseTrackerImpl, TestPendingResponseTracker_FillEntireTracker) { chip::app::PendingResponseTrackerImpl pendingResponseTracker; for (uint16_t commandRef = 0; commandRef < std::numeric_limits::max(); commandRef++) { - NL_TEST_ASSERT(inSuite, false == pendingResponseTracker.IsTracked(commandRef)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == pendingResponseTracker.Add(commandRef)); - NL_TEST_ASSERT(inSuite, true == pendingResponseTracker.IsTracked(commandRef)); + EXPECT_FALSE(pendingResponseTracker.IsTracked(commandRef)); + EXPECT_EQ(CHIP_NO_ERROR, pendingResponseTracker.Add(commandRef)); + EXPECT_TRUE(pendingResponseTracker.IsTracked(commandRef)); } - NL_TEST_ASSERT(inSuite, std::numeric_limits::max() == pendingResponseTracker.Count()); + EXPECT_EQ(std::numeric_limits::max(), pendingResponseTracker.Count()); for (uint16_t commandRef = 0; commandRef < std::numeric_limits::max(); commandRef++) { - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == pendingResponseTracker.Remove(commandRef)); - NL_TEST_ASSERT(inSuite, false == pendingResponseTracker.IsTracked(commandRef)); + EXPECT_EQ(CHIP_NO_ERROR, pendingResponseTracker.Remove(commandRef)); + EXPECT_FALSE(pendingResponseTracker.IsTracked(commandRef)); } - NL_TEST_ASSERT(inSuite, 0 == pendingResponseTracker.Count()); + EXPECT_EQ(0u, pendingResponseTracker.Count()); } -void TestPendingResponseTracker_FillSingleEntryInTracker(nlTestSuite * inSuite, void * inContext) +TEST(TestPendingResponseTrackerImpl, TestPendingResponseTracker_FillSingleEntryInTracker) { chip::app::PendingResponseTrackerImpl pendingResponseTracker; // The value 40 is arbitrary; any value would work for this purpose. uint16_t commandRefToSet = 40; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == pendingResponseTracker.Add(commandRefToSet)); + EXPECT_EQ(CHIP_NO_ERROR, pendingResponseTracker.Add(commandRefToSet)); for (uint16_t commandRef = 0; commandRef < std::numeric_limits::max(); commandRef++) { bool expectedIsSetResult = (commandRef == commandRefToSet); - NL_TEST_ASSERT(inSuite, expectedIsSetResult == pendingResponseTracker.IsTracked(commandRef)); + EXPECT_EQ(expectedIsSetResult, pendingResponseTracker.IsTracked(commandRef)); } } -void TestPendingResponseTracker_RemoveNonExistentEntryInTrackerFails(nlTestSuite * inSuite, void * inContext) +TEST(TestPendingResponseTrackerImpl, TestPendingResponseTracker_RemoveNonExistentEntryInTrackerFails) { chip::app::PendingResponseTrackerImpl pendingResponseTracker; // The value 40 is arbitrary; any value would work for this purpose. uint16_t commandRef = 40; - NL_TEST_ASSERT(inSuite, false == pendingResponseTracker.IsTracked(commandRef)); - NL_TEST_ASSERT(inSuite, CHIP_ERROR_KEY_NOT_FOUND == pendingResponseTracker.Remove(commandRef)); + EXPECT_FALSE(pendingResponseTracker.IsTracked(commandRef)); + EXPECT_EQ(CHIP_ERROR_KEY_NOT_FOUND, pendingResponseTracker.Remove(commandRef)); } -void TestPendingResponseTracker_AddingSecondEntryFails(nlTestSuite * inSuite, void * inContext) +TEST(TestPendingResponseTrackerImpl, TestPendingResponseTracker_AddingSecondEntryFails) { chip::app::PendingResponseTrackerImpl pendingResponseTracker; // The value 40 is arbitrary; any value would work for this purpose. uint16_t commandRef = 40; - NL_TEST_ASSERT(inSuite, false == pendingResponseTracker.IsTracked(commandRef)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == pendingResponseTracker.Add(commandRef)); - NL_TEST_ASSERT(inSuite, true == pendingResponseTracker.IsTracked(commandRef)); - NL_TEST_ASSERT(inSuite, CHIP_ERROR_INVALID_ARGUMENT == pendingResponseTracker.Add(commandRef)); + EXPECT_FALSE(pendingResponseTracker.IsTracked(commandRef)); + EXPECT_EQ(CHIP_NO_ERROR, pendingResponseTracker.Add(commandRef)); + EXPECT_TRUE(pendingResponseTracker.IsTracked(commandRef)); + EXPECT_EQ(CHIP_ERROR_INVALID_ARGUMENT, pendingResponseTracker.Add(commandRef)); } -void TestPendingResponseTracker_PopFindsAllPendingRequests(nlTestSuite * inSuite, void * inContext) +TEST(TestPendingResponseTrackerImpl, TestPendingResponseTracker_PopFindsAllPendingRequests) { chip::app::PendingResponseTrackerImpl pendingResponseTracker; @@ -91,45 +92,23 @@ void TestPendingResponseTracker_PopFindsAllPendingRequests(nlTestSuite * inSuite std::vector requestsToAdd = { 0, 50, 2, 2000 }; for (const uint16_t & commandRef : requestsToAdd) { - NL_TEST_ASSERT(inSuite, false == pendingResponseTracker.IsTracked(commandRef)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == pendingResponseTracker.Add(commandRef)); - NL_TEST_ASSERT(inSuite, true == pendingResponseTracker.IsTracked(commandRef)); + EXPECT_FALSE(pendingResponseTracker.IsTracked(commandRef)); + EXPECT_EQ(CHIP_NO_ERROR, pendingResponseTracker.Add(commandRef)); + EXPECT_TRUE(pendingResponseTracker.IsTracked(commandRef)); } - NL_TEST_ASSERT(inSuite, requestsToAdd.size() == pendingResponseTracker.Count()); + EXPECT_EQ(requestsToAdd.size(), pendingResponseTracker.Count()); for (size_t i = 0; i < requestsToAdd.size(); i++) { auto commandRef = pendingResponseTracker.PopPendingResponse(); - NL_TEST_ASSERT(inSuite, true == commandRef.HasValue()); + EXPECT_TRUE(commandRef.HasValue()); bool expectedCommandRef = std::find(requestsToAdd.begin(), requestsToAdd.end(), commandRef.Value()) != requestsToAdd.end(); - NL_TEST_ASSERT(inSuite, true == expectedCommandRef); + EXPECT_TRUE(expectedCommandRef); } - NL_TEST_ASSERT(inSuite, 0 == pendingResponseTracker.Count()); + EXPECT_EQ(0u, pendingResponseTracker.Count()); auto commandRef = pendingResponseTracker.PopPendingResponse(); - NL_TEST_ASSERT(inSuite, false == commandRef.HasValue()); + EXPECT_FALSE(commandRef.HasValue()); } } // namespace - -#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) -/** - * Test Suite. It lists all the test functions. - */ -static const nlTest sTests[] = { NL_TEST_DEF_FN(TestPendingResponseTracker_FillEntireTracker), - NL_TEST_DEF_FN(TestPendingResponseTracker_FillSingleEntryInTracker), - NL_TEST_DEF_FN(TestPendingResponseTracker_RemoveNonExistentEntryInTrackerFails), - NL_TEST_DEF_FN(TestPendingResponseTracker_AddingSecondEntryFails), - NL_TEST_DEF_FN(TestPendingResponseTracker_PopFindsAllPendingRequests), - NL_TEST_SENTINEL() }; - -int TestPendingResponseTracker() -{ - nlTestSuite theSuite = { "CHIP PendingResponseTrackerImpl tests", &sTests[0], nullptr, nullptr }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestPendingResponseTracker) diff --git a/src/app/tests/TestPowerSourceCluster.cpp b/src/app/tests/TestPowerSourceCluster.cpp index 374b9619d38684..0ec0b6e14a801c 100644 --- a/src/app/tests/TestPowerSourceCluster.cpp +++ b/src/app/tests/TestPowerSourceCluster.cpp @@ -15,50 +15,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include "lib/support/CHIPMem.h" #include #include +#include #include #include +#include #include #include #include #include -#include -#include #include #include -#include #include - -#include - -namespace { -chip::EndpointId numEndpoints = 0; -} -extern uint16_t emberAfGetClusterServerEndpointIndex(chip::EndpointId endpoint, chip::ClusterId cluster, - uint16_t fixedClusterServerEndpointCount) -{ - // Very simple mapping here, we're just going to return the endpoint that matches the given endpoint index because the test - // uses the endpoints in order. - if (endpoint >= numEndpoints) - { - return kEmberInvalidEndpointIndex; - } - return endpoint; -} +#include namespace chip { namespace app { -class TestPowerSourceCluster +class TestPowerSourceCluster : public ::testing::Test { public: - static void TestEndpointList(nlTestSuite * apSuite, void * apContext); + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() + { + chip::app::Clusters::PowerSourceServer::Instance().Shutdown(); + chip::Platform::MemoryShutdown(); + } }; -std::vector ReadEndpointsThroughAttributeReader(nlTestSuite * apSuite, EndpointId endpoint) +std::vector ReadEndpointsThroughAttributeReader(EndpointId endpoint) { Clusters::PowerSourceAttrAccess & attrAccess = Clusters::TestOnlyGetPowerSourceAttrAccess(); CHIP_ERROR err = CHIP_NO_ERROR; @@ -85,7 +74,7 @@ std::vector ReadEndpointsThroughAttributeReader(nlTestSuite * apSuit err = attrAccess.Read(readPath, aEncoder); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Read out from the buffer. This comes back as a nested struct // AttributeReportIBs is a list of @@ -114,13 +103,13 @@ std::vector ReadEndpointsThroughAttributeReader(nlTestSuite * apSuit { attrDataReader.Next(); } - NL_TEST_ASSERT(apSuite, IsContextTag(attrDataReader.GetTag())); - NL_TEST_ASSERT(apSuite, TagNumFromTag(attrDataReader.GetTag()) == 2); + EXPECT_TRUE(IsContextTag(attrDataReader.GetTag())); + EXPECT_EQ(TagNumFromTag(attrDataReader.GetTag()), 2u); // OK, we should be in the right spot now, let's decode the list. Clusters::PowerSource::Attributes::EndpointList::TypeInfo::DecodableType list; err = list.Decode(attrDataReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); std::vector ret; auto iter = list.begin(); while (iter.Next()) @@ -130,7 +119,7 @@ std::vector ReadEndpointsThroughAttributeReader(nlTestSuite * apSuit return ret; } -void TestPowerSourceCluster::TestEndpointList(nlTestSuite * apSuite, void * apContext) +TEST_F(TestPowerSourceCluster, TestEndpointList) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -139,8 +128,8 @@ void TestPowerSourceCluster::TestEndpointList(nlTestSuite * apSuite, void * apCo // test that when we read everything we get an empty list as nothing has been set up yet for (EndpointId i = 0; i < 11; ++i) { - std::vector vec = ReadEndpointsThroughAttributeReader(apSuite, i); - NL_TEST_ASSERT(apSuite, vec.size() == 0); + std::vector vec = ReadEndpointsThroughAttributeReader(i); + EXPECT_EQ(vec.size(), 0u); } if (powerSourceServer.GetNumSupportedEndpointLists() < 2 || @@ -159,42 +148,42 @@ void TestPowerSourceCluster::TestEndpointList(nlTestSuite * apSuite, void * apCo // we checked earlier that this fit // This test just uses endpoints in order, so we want to set endpoints from - // 0 to numEndpoints - 1, and use this for overflow checking - numEndpoints = static_cast(powerSourceServer.GetNumSupportedEndpointLists()); + // 0 to chip::Test::numEndpoints - 1, and use this for overflow checking + chip::Test::numEndpoints = static_cast(powerSourceServer.GetNumSupportedEndpointLists()); // Endpoint 0 - list of 5 err = powerSourceServer.SetEndpointList(0, Span(list0)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); const Span * readBack = powerSourceServer.GetEndpointList(0); - NL_TEST_EXIT_ON_FAILED_ASSERT(apSuite, readBack != nullptr); - NL_TEST_ASSERT(apSuite, readBack->size() == 5); + ASSERT_NE(readBack, nullptr); + EXPECT_EQ(readBack->size(), 5u); for (size_t i = 0; i < readBack->size(); ++i) { - NL_TEST_ASSERT(apSuite, readBack->data()[i] == list0[i]); + EXPECT_EQ(readBack->data()[i], list0[i]); } // Endpoint 1 - list of 10 err = powerSourceServer.SetEndpointList(1, Span(list1)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); readBack = powerSourceServer.GetEndpointList(1); - NL_TEST_EXIT_ON_FAILED_ASSERT(apSuite, readBack != nullptr); - NL_TEST_ASSERT(apSuite, readBack->size() == 10); + ASSERT_NE(readBack, nullptr); + EXPECT_EQ(readBack->size(), 10u); for (size_t i = 0; i < readBack->size(); ++i) { - NL_TEST_ASSERT(apSuite, readBack->data()[i] == list1[i]); + EXPECT_EQ(readBack->data()[i], list1[i]); } // Remaining endpoints - list of 1 - for (EndpointId ep = 2; ep < numEndpoints; ++ep) + for (EndpointId ep = 2; ep < chip::Test::numEndpoints; ++ep) { err = powerSourceServer.SetEndpointList(ep, Span(listRest)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); readBack = powerSourceServer.GetEndpointList(ep); - NL_TEST_EXIT_ON_FAILED_ASSERT(apSuite, readBack != nullptr); - NL_TEST_ASSERT(apSuite, readBack->size() == 1); + ASSERT_NE(readBack, nullptr); + EXPECT_EQ(readBack->size(), 1u); if (readBack->size() == 1) { - NL_TEST_ASSERT(apSuite, readBack->data()[0] == listRest[0]); + EXPECT_EQ(readBack->data()[0], listRest[0]); } } @@ -203,38 +192,38 @@ void TestPowerSourceCluster::TestEndpointList(nlTestSuite * apSuite, void * apCo // ***************** // pick a random endpoint number for the power cluster - it doesn't matter, we don't have space anyway. err = powerSourceServer.SetEndpointList(55, Span(listRest)); - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_NO_MEMORY); + EXPECT_EQ(err, CHIP_ERROR_NO_MEMORY); // ***************** // Recheck getting and reading after OOM // ***************** // EP0 readBack = powerSourceServer.GetEndpointList(0); - NL_TEST_EXIT_ON_FAILED_ASSERT(apSuite, readBack != nullptr); - NL_TEST_ASSERT(apSuite, readBack->size() == 5); + ASSERT_NE(readBack, nullptr); + EXPECT_EQ(readBack->size(), 5u); for (size_t i = 0; i < readBack->size(); ++i) { - NL_TEST_ASSERT(apSuite, readBack->data()[i] == list0[i]); + EXPECT_EQ(readBack->data()[i], list0[i]); } // EP1 readBack = powerSourceServer.GetEndpointList(1); - NL_TEST_EXIT_ON_FAILED_ASSERT(apSuite, readBack != nullptr); - NL_TEST_ASSERT(apSuite, readBack->size() == 10); + ASSERT_NE(readBack, nullptr); + EXPECT_EQ(readBack->size(), 10u); for (size_t i = 0; i < readBack->size(); ++i) { - NL_TEST_ASSERT(apSuite, readBack->data()[i] == list1[i]); + EXPECT_EQ(readBack->data()[i], list1[i]); } // Remaining endpoints - for (EndpointId ep = 2; ep < numEndpoints; ++ep) + for (EndpointId ep = 2; ep < chip::Test::numEndpoints; ++ep) { readBack = powerSourceServer.GetEndpointList(ep); - NL_TEST_EXIT_ON_FAILED_ASSERT(apSuite, readBack != nullptr); - NL_TEST_ASSERT(apSuite, readBack->size() == 1); + ASSERT_NE(readBack, nullptr); + EXPECT_EQ(readBack->size(), 1u); if (readBack->size() == 1) { - NL_TEST_ASSERT(apSuite, readBack->data()[0] == listRest[0]); + EXPECT_EQ(readBack->data()[0], listRest[0]); } } @@ -243,36 +232,36 @@ void TestPowerSourceCluster::TestEndpointList(nlTestSuite * apSuite, void * apCo // ***************** // Overwrite a list err = powerSourceServer.SetEndpointList(1, Span(listRest)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); readBack = powerSourceServer.GetEndpointList(1); - NL_TEST_ASSERT(apSuite, readBack->size() == 1); + EXPECT_EQ(readBack->size(), 1u); if (readBack->size() == 1) { - NL_TEST_ASSERT(apSuite, readBack->data()[0] == listRest[0]); + EXPECT_EQ(readBack->data()[0], listRest[0]); } // Ensure only the overwritten list was changed, using read interface - for (EndpointId ep = 0; ep < numEndpoints + 1; ++ep) + for (EndpointId ep = 0; ep < chip::Test::numEndpoints + 1; ++ep) { - std::vector vec = ReadEndpointsThroughAttributeReader(apSuite, ep); + std::vector vec = ReadEndpointsThroughAttributeReader(ep); if (ep == 0) { - NL_TEST_ASSERT(apSuite, vec.size() == 5); + EXPECT_EQ(vec.size(), 5u); for (size_t j = 0; j < vec.size(); ++j) { - NL_TEST_ASSERT(apSuite, vec[j] == list0[j]); + EXPECT_EQ(vec[j], list0[j]); } } - else if (ep == numEndpoints) + else if (ep == chip::Test::numEndpoints) { - NL_TEST_ASSERT(apSuite, vec.size() == 0); + EXPECT_EQ(vec.size(), 0u); } else { - NL_TEST_ASSERT(apSuite, vec.size() == 1); + EXPECT_EQ(vec.size(), 1u); if (vec.size() == 1) { - NL_TEST_ASSERT(apSuite, vec[0] == listRest[0]); + EXPECT_EQ(vec[0], listRest[0]); } } } @@ -280,76 +269,21 @@ void TestPowerSourceCluster::TestEndpointList(nlTestSuite * apSuite, void * apCo // ***************** // Test removal // ***************** - for (EndpointId ep = 0; ep < numEndpoints; ++ep) + for (EndpointId ep = 0; ep < chip::Test::numEndpoints; ++ep) { err = powerSourceServer.SetEndpointList(ep, Span()); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); readBack = powerSourceServer.GetEndpointList(ep); - NL_TEST_ASSERT(apSuite, readBack == nullptr); + EXPECT_EQ(readBack, nullptr); } // Check through the read interface - for (EndpointId ep = 0; ep < numEndpoints + 1; ++ep) + for (EndpointId ep = 0; ep < chip::Test::numEndpoints + 1; ++ep) { - std::vector vec = ReadEndpointsThroughAttributeReader(apSuite, ep); - NL_TEST_ASSERT(apSuite, vec.size() == 0); + std::vector vec = ReadEndpointsThroughAttributeReader(ep); + EXPECT_EQ(vec.size(), 0u); } } } // namespace app } // namespace chip - -namespace { - -/** - * Test Suite. It lists all the test functions. - */ - -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestEndpointList", chip::app::TestPowerSourceCluster::TestEndpointList), - NL_TEST_SENTINEL() -}; -// clang-format on - -/** - * Set up the test suite. - */ -int TestPowerSourceClusterContext_Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestPowerSourceClusterContext_Teardown(void * inContext) -{ - chip::app::Clusters::PowerSourceServer::Instance().Shutdown(); - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -// clang-format off -nlTestSuite sSuite = -{ - "TestPowerSourceCluster", - &sTests[0], - TestPowerSourceClusterContext_Setup, - TestPowerSourceClusterContext_Teardown -}; -// clang-format on - -} // namespace - -int TestPowerSource() -{ - nlTestRunner(&sSuite, nullptr); - return nlTestRunnerStats(&sSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestPowerSource) diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index e06721806732f6..8d1d2e686896fa 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -22,6 +22,8 @@ * */ +#include "app/tests/test-interaction-model-api.h" + #include "lib/support/CHIPMem.h" #include #include @@ -61,7 +63,6 @@ chip::EndpointId kTestEndpointId = 1; chip::EndpointId kTestEventEndpointId = chip::Test::kMockEndpoint1; chip::EventId kTestEventIdDebug = chip::Test::MockEventId(1); chip::EventId kTestEventIdCritical = chip::Test::MockEventId(2); -uint8_t kTestFieldValue1 = 1; chip::TLV::Tag kTestEventTag = chip::TLV::ContextTag(1); chip::EndpointId kInvalidTestEndpointId = 3; chip::DataVersion kTestDataVersion1 = 3; @@ -301,54 +302,6 @@ using ReadHandlerNode = chip::app::reporting::ReportScheduler::ReadHandlerNo namespace chip { namespace app { -CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, - const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, - AttributeEncodeState * apEncoderState) -{ - if (aPath.mClusterId >= Test::kMockEndpointMin) - { - return Test::ReadSingleMockClusterData(aSubjectDescriptor.fabricIndex, aPath, aAttributeReports, apEncoderState); - } - - if (!(aPath.mClusterId == kTestClusterId && aPath.mEndpointId == kTestEndpointId)) - { - AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); - ReturnErrorOnFailure(aAttributeReports.GetError()); - ChipLogDetail(DataManagement, "TEST Cluster %" PRIx32 ", Field %" PRIx32 " is dirty", aPath.mClusterId, aPath.mAttributeId); - - AttributeStatusIB::Builder & attributeStatus = attributeReport.CreateAttributeStatus(); - ReturnErrorOnFailure(attributeReport.GetError()); - AttributePathIB::Builder & attributePath = attributeStatus.CreatePath(); - ReturnErrorOnFailure(attributeStatus.GetError()); - - attributePath.Endpoint(aPath.mEndpointId).Cluster(aPath.mClusterId).Attribute(aPath.mAttributeId).EndOfAttributePathIB(); - ReturnErrorOnFailure(attributePath.GetError()); - StatusIB::Builder & errorStatus = attributeStatus.CreateErrorStatus(); - ReturnErrorOnFailure(attributeStatus.GetError()); - errorStatus.EncodeStatusIB(StatusIB(Protocols::InteractionModel::Status::UnsupportedAttribute)); - ReturnErrorOnFailure(errorStatus.GetError()); - ReturnErrorOnFailure(attributeStatus.EndOfAttributeStatusIB()); - return attributeReport.EndOfAttributeReportIB(); - } - - return AttributeValueEncoder(aAttributeReports, aSubjectDescriptor, aPath, 0 /* dataVersion */).Encode(kTestFieldValue1); -} - -bool IsClusterDataVersionEqual(const ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) -{ - if (kTestDataVersion1 == aRequiredVersion) - { - return true; - } - - return false; -} - -bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) -{ - return false; -} - class TestReadInteraction { using Seconds16 = System::Clock::Seconds16; diff --git a/src/app/tests/TestSimpleSubscriptionResumptionStorage.cpp b/src/app/tests/TestSimpleSubscriptionResumptionStorage.cpp index 8725acd755afd9..9f9b164e87cc07 100644 --- a/src/app/tests/TestSimpleSubscriptionResumptionStorage.cpp +++ b/src/app/tests/TestSimpleSubscriptionResumptionStorage.cpp @@ -15,13 +15,18 @@ * limitations under the License. */ -#include -#include - #include +#include +#include #include +#include -#include +class TestSimpleSubscriptionResumptionStorage : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; class SimpleSubscriptionResumptionStorageTest : public chip::app::SimpleSubscriptionResumptionStorage { @@ -71,7 +76,7 @@ struct TestSubscriptionInfo : public chip::app::SubscriptionResumptionStorage::S } }; -void TestSubscriptionCount(nlTestSuite * inSuite, void * inContext) +TEST_F(TestSimpleSubscriptionResumptionStorage, TestSubscriptionCount) { chip::TestPersistentStorageDelegate storage; SimpleSubscriptionResumptionStorageTest subscriptionStorage; @@ -88,7 +93,7 @@ void TestSubscriptionCount(nlTestSuite * inSuite, void * inContext) // Make sure iterator counts correctly auto * iterator = subscriptionStorage.IterateSubscriptions(); - NL_TEST_ASSERT(inSuite, iterator->Count() == (CHIP_IM_MAX_NUM_SUBSCRIPTIONS / 2)); + EXPECT_EQ(iterator->Count(), std::make_unsigned_t(CHIP_IM_MAX_NUM_SUBSCRIPTIONS / 2)); // Verify subscriptions manually count correctly size_t count = 0; @@ -97,13 +102,13 @@ void TestSubscriptionCount(nlTestSuite * inSuite, void * inContext) count++; } iterator->Release(); - NL_TEST_ASSERT(inSuite, count == (CHIP_IM_MAX_NUM_SUBSCRIPTIONS / 2)); + EXPECT_EQ(count, std::make_unsigned_t(CHIP_IM_MAX_NUM_SUBSCRIPTIONS / 2)); // Delete all and verify iterator counts 0 CHIP_ERROR err = subscriptionStorage.DeleteAll(46); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); iterator = subscriptionStorage.IterateSubscriptions(); - NL_TEST_ASSERT(inSuite, iterator->Count() == 0); + EXPECT_EQ(iterator->Count(), 0u); // Verify subscriptions manually count correctly count = 0; @@ -112,10 +117,10 @@ void TestSubscriptionCount(nlTestSuite * inSuite, void * inContext) count++; } iterator->Release(); - NL_TEST_ASSERT(inSuite, count == 0); + EXPECT_EQ(count, 0u); } -void TestSubscriptionMaxCount(nlTestSuite * inSuite, void * inContext) +TEST_F(TestSimpleSubscriptionResumptionStorage, TestSubscriptionMaxCount) { // Force large MacCount value and check that Init resets it properly, and deletes extra subs: @@ -126,16 +131,16 @@ void TestSubscriptionMaxCount(nlTestSuite * inSuite, void * inContext) uint16_t countMaxToSave = 2 * CHIP_IM_MAX_NUM_SUBSCRIPTIONS; CHIP_ERROR err = storage.SyncSetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumptionMaxCount().KeyName(), &countMaxToSave, sizeof(uint16_t)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Then write something beyond CHIP_IM_MAX_NUM_SUBSCRIPTIONS chip::Platform::ScopedMemoryBuffer junkBytes; junkBytes.Calloc(subscriptionStorage.TestMaxSubscriptionSize() / 2); - NL_TEST_ASSERT(inSuite, junkBytes.Get() != nullptr); - NL_TEST_ASSERT(inSuite, - storage.SyncSetKeyValue( - chip::DefaultStorageKeyAllocator::SubscriptionResumption(CHIP_IM_MAX_NUM_SUBSCRIPTIONS + 1).KeyName(), - junkBytes.Get(), static_cast(subscriptionStorage.TestMaxSubscriptionSize() / 2)) == CHIP_NO_ERROR); + ASSERT_NE(junkBytes.Get(), nullptr); + EXPECT_EQ(storage.SyncSetKeyValue( + chip::DefaultStorageKeyAllocator::SubscriptionResumption(CHIP_IM_MAX_NUM_SUBSCRIPTIONS + 1).KeyName(), + junkBytes.Get(), static_cast(subscriptionStorage.TestMaxSubscriptionSize() / 2)), + CHIP_NO_ERROR); subscriptionStorage.Init(&storage); @@ -143,16 +148,15 @@ void TestSubscriptionMaxCount(nlTestSuite * inSuite, void * inContext) uint16_t countMax = 0; uint16_t len = sizeof(countMax); err = storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumptionMaxCount().KeyName(), &countMax, len); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, countMax == CHIP_IM_MAX_NUM_SUBSCRIPTIONS); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(countMax, CHIP_IM_MAX_NUM_SUBSCRIPTIONS); // Then check the fake sub is no more - NL_TEST_ASSERT(inSuite, - !storage.SyncDoesKeyExist( - chip::DefaultStorageKeyAllocator::SubscriptionResumption(CHIP_IM_MAX_NUM_SUBSCRIPTIONS + 1).KeyName())); + EXPECT_FALSE(storage.SyncDoesKeyExist( + chip::DefaultStorageKeyAllocator::SubscriptionResumption(CHIP_IM_MAX_NUM_SUBSCRIPTIONS + 1).KeyName())); } -void TestSubscriptionState(nlTestSuite * inSuite, void * inContext) +TEST_F(TestSimpleSubscriptionResumptionStorage, TestSubscriptionState) { chip::TestPersistentStorageDelegate storage; SimpleSubscriptionResumptionStorageTest subscriptionStorage; @@ -219,25 +223,25 @@ void TestSubscriptionState(nlTestSuite * inSuite, void * inContext) CHIP_ERROR err; err = subscriptionStorage.Save(subscriptionInfo1); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = subscriptionStorage.Save(subscriptionInfo2); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = subscriptionStorage.Save(subscriptionInfo3); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); auto * iterator = subscriptionStorage.IterateSubscriptions(); - NL_TEST_ASSERT(inSuite, iterator->Count() == 3); + EXPECT_EQ(iterator->Count(), 3u); // Verify subscriptions manually count correctly TestSubscriptionInfo subscriptionInfo; - NL_TEST_ASSERT(inSuite, iterator->Next(subscriptionInfo)); - NL_TEST_ASSERT(inSuite, subscriptionInfo == subscriptionInfo1); - NL_TEST_ASSERT(inSuite, iterator->Next(subscriptionInfo)); - NL_TEST_ASSERT(inSuite, subscriptionInfo == subscriptionInfo2); - NL_TEST_ASSERT(inSuite, iterator->Next(subscriptionInfo)); - NL_TEST_ASSERT(inSuite, subscriptionInfo == subscriptionInfo3); + EXPECT_TRUE(iterator->Next(subscriptionInfo)); + EXPECT_EQ(subscriptionInfo, subscriptionInfo1); + EXPECT_TRUE(iterator->Next(subscriptionInfo)); + EXPECT_EQ(subscriptionInfo, subscriptionInfo2); + EXPECT_TRUE(iterator->Next(subscriptionInfo)); + EXPECT_EQ(subscriptionInfo, subscriptionInfo3); // Verify at end of list - NL_TEST_ASSERT(inSuite, !iterator->Next(subscriptionInfo)); + EXPECT_FALSE(iterator->Next(subscriptionInfo)); iterator->Release(); // Delete fabric 1 and subscription 2 and check only 3 remains. @@ -245,30 +249,30 @@ void TestSubscriptionState(nlTestSuite * inSuite, void * inContext) subscriptionStorage.DeleteAll(subscriptionInfo2.mFabricIndex); iterator = subscriptionStorage.IterateSubscriptions(); - NL_TEST_ASSERT(inSuite, iterator->Count() == 1); - NL_TEST_ASSERT(inSuite, iterator->Next(subscriptionInfo)); - NL_TEST_ASSERT(inSuite, subscriptionInfo == subscriptionInfo3); + EXPECT_EQ(iterator->Count(), 1u); + EXPECT_TRUE(iterator->Next(subscriptionInfo)); + EXPECT_EQ(subscriptionInfo, subscriptionInfo3); // Verify at end of list - NL_TEST_ASSERT(inSuite, !iterator->Next(subscriptionInfo)); + EXPECT_FALSE(iterator->Next(subscriptionInfo)); iterator->Release(); // Delete 3 also, and see that both count is 0 and MaxCount is removed from storage subscriptionStorage.DeleteAll(subscriptionInfo3.mFabricIndex); iterator = subscriptionStorage.IterateSubscriptions(); - NL_TEST_ASSERT(inSuite, iterator->Count() == 0); - NL_TEST_ASSERT(inSuite, !iterator->Next(subscriptionInfo)); + EXPECT_EQ(iterator->Count(), 0u); + EXPECT_FALSE(iterator->Next(subscriptionInfo)); iterator->Release(); uint16_t countMax = 0; uint16_t len = sizeof(countMax); err = storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumptionMaxCount().KeyName(), &countMax, len); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } static constexpr chip::TLV::Tag kTestValue1Tag = chip::TLV::ContextTag(30); static constexpr chip::TLV::Tag kTestValue2Tag = chip::TLV::ContextTag(31); -void TestSubscriptionStateUnexpectedFields(nlTestSuite * inSuite, void * inContext) +TEST_F(TestSimpleSubscriptionResumptionStorage, TestSubscriptionStateUnexpectedFields) { chip::TestPersistentStorageDelegate storage; SimpleSubscriptionResumptionStorageTest subscriptionStorage; @@ -293,39 +297,38 @@ void TestSubscriptionStateUnexpectedFields(nlTestSuite * inSuite, void * inConte chip::Platform::ScopedMemoryBuffer backingBuffer; backingBuffer.Calloc(subscriptionStorage.TestMaxSubscriptionSize()); - NL_TEST_ASSERT(inSuite, backingBuffer.Get() != nullptr); + ASSERT_NE(backingBuffer.Get(), nullptr); chip::TLV::ScopedBufferTLVWriter writer(std::move(backingBuffer), subscriptionStorage.TestMaxSubscriptionSize()); - NL_TEST_ASSERT(inSuite, subscriptionStorage.TestSave(writer, subscriptionInfo1) == CHIP_NO_ERROR); + EXPECT_EQ(subscriptionStorage.TestSave(writer, subscriptionInfo1), CHIP_NO_ERROR); // Additional stuff chip::TLV::TLVType containerType; - NL_TEST_ASSERT(inSuite, - writer.StartContainer(chip::TLV::AnonymousTag(), chip::TLV::kTLVType_Structure, containerType) == CHIP_NO_ERROR); + EXPECT_EQ(writer.StartContainer(chip::TLV::AnonymousTag(), chip::TLV::kTLVType_Structure, containerType), CHIP_NO_ERROR); uint32_t value1 = 1; uint32_t value2 = 2; - NL_TEST_ASSERT(inSuite, writer.Put(kTestValue1Tag, value1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.Put(kTestValue2Tag, value2) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.EndContainer(containerType) == CHIP_NO_ERROR); + EXPECT_EQ(writer.Put(kTestValue1Tag, value1), CHIP_NO_ERROR); + EXPECT_EQ(writer.Put(kTestValue2Tag, value2), CHIP_NO_ERROR); + EXPECT_EQ(writer.EndContainer(containerType), CHIP_NO_ERROR); const auto len = writer.GetLengthWritten(); writer.Finalize(backingBuffer); - NL_TEST_ASSERT(inSuite, - storage.SyncSetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumption(0).KeyName(), - backingBuffer.Get(), static_cast(len)) == CHIP_NO_ERROR); + EXPECT_EQ(storage.SyncSetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumption(0).KeyName(), backingBuffer.Get(), + static_cast(len)), + CHIP_NO_ERROR); // Now read back and verify auto * iterator = subscriptionStorage.IterateSubscriptions(); - NL_TEST_ASSERT(inSuite, iterator->Count() == 1); + EXPECT_EQ(iterator->Count(), 1u); TestSubscriptionInfo subscriptionInfo; - NL_TEST_ASSERT(inSuite, iterator->Next(subscriptionInfo)); - NL_TEST_ASSERT(inSuite, subscriptionInfo == subscriptionInfo1); + EXPECT_TRUE(iterator->Next(subscriptionInfo)); + EXPECT_EQ(subscriptionInfo, subscriptionInfo1); iterator->Release(); } -void TestSubscriptionStateTooBigToLoad(nlTestSuite * inSuite, void * inContext) +TEST_F(TestSimpleSubscriptionResumptionStorage, TestSubscriptionStateTooBigToLoad) { chip::TestPersistentStorageDelegate storage; SimpleSubscriptionResumptionStorageTest subscriptionStorage; @@ -350,42 +353,41 @@ void TestSubscriptionStateTooBigToLoad(nlTestSuite * inSuite, void * inContext) chip::Platform::ScopedMemoryBuffer backingBuffer; backingBuffer.Calloc(subscriptionStorage.TestMaxSubscriptionSize() * 2); - NL_TEST_ASSERT(inSuite, backingBuffer.Get() != nullptr); + ASSERT_NE(backingBuffer.Get(), nullptr); chip::TLV::ScopedBufferTLVWriter writer(std::move(backingBuffer), subscriptionStorage.TestMaxSubscriptionSize() * 2); - NL_TEST_ASSERT(inSuite, subscriptionStorage.TestSave(writer, subscriptionInfo1) == CHIP_NO_ERROR); + EXPECT_EQ(subscriptionStorage.TestSave(writer, subscriptionInfo1), CHIP_NO_ERROR); // Additional too-many bytes chip::TLV::TLVType containerType; - NL_TEST_ASSERT(inSuite, - writer.StartContainer(chip::TLV::AnonymousTag(), chip::TLV::kTLVType_Structure, containerType) == CHIP_NO_ERROR); + EXPECT_EQ(writer.StartContainer(chip::TLV::AnonymousTag(), chip::TLV::kTLVType_Structure, containerType), CHIP_NO_ERROR); // Write MaxSubscriptionSize() to guarantee Load failure chip::Platform::ScopedMemoryBuffer additionalBytes; additionalBytes.Calloc(subscriptionStorage.TestMaxSubscriptionSize()); - NL_TEST_ASSERT(inSuite, additionalBytes.Get() != nullptr); - NL_TEST_ASSERT(inSuite, - writer.PutBytes(kTestValue1Tag, additionalBytes.Get(), - static_cast(subscriptionStorage.TestMaxSubscriptionSize())) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.EndContainer(containerType) == CHIP_NO_ERROR); + ASSERT_NE(additionalBytes.Get(), nullptr); + EXPECT_EQ(writer.PutBytes(kTestValue1Tag, additionalBytes.Get(), + static_cast(subscriptionStorage.TestMaxSubscriptionSize())), + CHIP_NO_ERROR); + EXPECT_EQ(writer.EndContainer(containerType), CHIP_NO_ERROR); const auto len = writer.GetLengthWritten(); writer.Finalize(backingBuffer); - NL_TEST_ASSERT(inSuite, - storage.SyncSetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumption(0).KeyName(), - backingBuffer.Get(), static_cast(len)) == CHIP_NO_ERROR); + EXPECT_EQ(storage.SyncSetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumption(0).KeyName(), backingBuffer.Get(), + static_cast(len)), + CHIP_NO_ERROR); // Now read back and verify auto * iterator = subscriptionStorage.IterateSubscriptions(); - NL_TEST_ASSERT(inSuite, iterator->Count() == 1); + EXPECT_EQ(iterator->Count(), 1u); TestSubscriptionInfo subscriptionInfo; - NL_TEST_ASSERT(inSuite, !iterator->Next(subscriptionInfo)); - NL_TEST_ASSERT(inSuite, iterator->Count() == 0); + EXPECT_FALSE(iterator->Next(subscriptionInfo)); + EXPECT_EQ(iterator->Count(), 0u); iterator->Release(); } -void TestSubscriptionStateJunkData(nlTestSuite * inSuite, void * inContext) +TEST_F(TestSimpleSubscriptionResumptionStorage, TestSubscriptionStateJunkData) { chip::TestPersistentStorageDelegate storage; SimpleSubscriptionResumptionStorageTest subscriptionStorage; @@ -393,76 +395,16 @@ void TestSubscriptionStateJunkData(nlTestSuite * inSuite, void * inContext) chip::Platform::ScopedMemoryBuffer junkBytes; junkBytes.Calloc(subscriptionStorage.TestMaxSubscriptionSize() / 2); - NL_TEST_ASSERT(inSuite, junkBytes.Get() != nullptr); - NL_TEST_ASSERT(inSuite, - storage.SyncSetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumption(0).KeyName(), junkBytes.Get(), - static_cast(subscriptionStorage.TestMaxSubscriptionSize() / 2)) == - CHIP_NO_ERROR); + ASSERT_NE(junkBytes.Get(), nullptr); + EXPECT_EQ(storage.SyncSetKeyValue(chip::DefaultStorageKeyAllocator::SubscriptionResumption(0).KeyName(), junkBytes.Get(), + static_cast(subscriptionStorage.TestMaxSubscriptionSize() / 2)), + CHIP_NO_ERROR); // Now read back and verify auto * iterator = subscriptionStorage.IterateSubscriptions(); - NL_TEST_ASSERT(inSuite, iterator->Count() == 1); + EXPECT_EQ(iterator->Count(), 1u); TestSubscriptionInfo subscriptionInfo; - NL_TEST_ASSERT(inSuite, !iterator->Next(subscriptionInfo)); - NL_TEST_ASSERT(inSuite, iterator->Count() == 0); + EXPECT_FALSE(iterator->Next(subscriptionInfo)); + EXPECT_EQ(iterator->Count(), 0u); iterator->Release(); } -/** - * Set up the test suite. - */ -int TestSubscription_Setup(void * inContext) -{ - VerifyOrReturnError(CHIP_NO_ERROR == chip::Platform::MemoryInit(), FAILURE); - - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestSubscription_Teardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestSubscriptionCount", TestSubscriptionCount), - NL_TEST_DEF("TestSubscriptionMaxCount", TestSubscriptionMaxCount), - NL_TEST_DEF("TestSubscriptionState", TestSubscriptionState), - NL_TEST_DEF("TestSubscriptionStateUnexpectedFields", TestSubscriptionStateUnexpectedFields), - NL_TEST_DEF("TestSubscriptionStateTooBigToLoad", TestSubscriptionStateTooBigToLoad), - NL_TEST_DEF("TestSubscriptionStateJunkData", TestSubscriptionStateJunkData), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-SimpleSubscriptionResumptionStorage", - &sTests[0], - &TestSubscription_Setup, &TestSubscription_Teardown -}; -// clang-format on - -/** - * Main - */ -int TestSimpleSubscriptionResumptionStorage() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestSimpleSubscriptionResumptionStorage) diff --git a/src/app/tests/TestStatusIB.cpp b/src/app/tests/TestStatusIB.cpp index 2e5f78f7da64f7..8da643d2b71a31 100644 --- a/src/app/tests/TestStatusIB.cpp +++ b/src/app/tests/TestStatusIB.cpp @@ -20,11 +20,10 @@ #include #include #include +#include #include -#include #include - -#include +#include namespace { @@ -32,67 +31,78 @@ using namespace chip; using namespace chip::app; using namespace chip::Protocols::InteractionModel; +class TestStatusIB : public ::testing::Test +{ +public: + static void SetUpTestSuite() + { + ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); + StatusIB::RegisterErrorFormatter(); + } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + // Macro so failures will blame the right line. #define VERIFY_ROUNDTRIP(err, status) \ do \ { \ StatusIB newStatus; \ newStatus.InitFromChipError(err); \ - NL_TEST_ASSERT(aSuite, newStatus.mStatus == status.mStatus); \ - NL_TEST_ASSERT(aSuite, newStatus.mClusterStatus == status.mClusterStatus); \ + EXPECT_EQ(newStatus.mStatus, status.mStatus); \ + EXPECT_EQ(newStatus.mClusterStatus, status.mClusterStatus); \ } while (0); -void TestStatusIBToFromChipError(nlTestSuite * aSuite, void * aContext) +TEST_F(TestStatusIB, TestStatusIBToFromChipError) { StatusIB status; status.mStatus = Status::Success; CHIP_ERROR err = status.ToChipError(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); VERIFY_ROUNDTRIP(err, status); status.mStatus = Status::Failure; err = status.ToChipError(); - NL_TEST_ASSERT(aSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); VERIFY_ROUNDTRIP(err, status); status.mStatus = Status::InvalidAction; err = status.ToChipError(); - NL_TEST_ASSERT(aSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); VERIFY_ROUNDTRIP(err, status); status.mClusterStatus = MakeOptional(static_cast(5)); status.mStatus = Status::Success; err = status.ToChipError(); - NL_TEST_ASSERT(aSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); status.mStatus = Status::Failure; err = status.ToChipError(); - NL_TEST_ASSERT(aSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); VERIFY_ROUNDTRIP(err, status); status.mStatus = Status::InvalidAction; err = status.ToChipError(); - NL_TEST_ASSERT(aSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); { StatusIB newStatus; newStatus.InitFromChipError(err); - NL_TEST_ASSERT(aSuite, newStatus.mStatus == Status::Failure); - NL_TEST_ASSERT(aSuite, newStatus.mClusterStatus == status.mClusterStatus); + EXPECT_EQ(newStatus.mStatus, Status::Failure); + EXPECT_EQ(newStatus.mClusterStatus, status.mClusterStatus); } err = CHIP_ERROR_NO_MEMORY; { StatusIB newStatus; newStatus.InitFromChipError(err); - NL_TEST_ASSERT(aSuite, newStatus.mStatus == Status::Failure); - NL_TEST_ASSERT(aSuite, !newStatus.mClusterStatus.HasValue()); + EXPECT_EQ(newStatus.mStatus, Status::Failure); + EXPECT_FALSE(newStatus.mClusterStatus.HasValue()); } } #if !CHIP_CONFIG_SHORT_ERROR_STR -void TestStatusIBErrorToString(nlTestSuite * aSuite, void * aContext) +TEST_F(TestStatusIB, TestStatusIBErrorToString) { StatusIB status; status.mStatus = Status::InvalidAction; @@ -100,108 +110,55 @@ void TestStatusIBErrorToString(nlTestSuite * aSuite, void * aContext) const char * str = ErrorStr(err); #if CHIP_CONFIG_IM_STATUS_CODE_VERBOSE_FORMAT - NL_TEST_ASSERT(aSuite, strcmp(str, "IM Error 0x00000580: General error: 0x80 (INVALID_ACTION)") == 0); + EXPECT_STREQ(str, "IM Error 0x00000580: General error: 0x80 (INVALID_ACTION)"); #else // CHIP_CONFIG_IM_STATUS_CODE_VERBOSE_FORMAT - NL_TEST_ASSERT(aSuite, strcmp(str, "IM Error 0x00000580: General error: 0x80") == 0); + EXPECT_STREQ(str, "IM Error 0x00000580: General error: 0x80"); #endif // CHIP_CONFIG_IM_STATUS_CODE_VERBOSE_FORMAT status.mStatus = Status::Failure; status.mClusterStatus = MakeOptional(static_cast(5)); err = status.ToChipError(); str = ErrorStr(err); - NL_TEST_ASSERT(aSuite, strcmp(str, "IM Error 0x00000605: Cluster-specific error: 0x05") == 0); + EXPECT_STREQ(str, "IM Error 0x00000605: Cluster-specific error: 0x05"); } #endif // !CHIP_CONFIG_SHORT_ERROR_STR -void TestStatusIBEqualityOperator(nlTestSuite * aSuite, void * /*aContext*/) +TEST_F(TestStatusIB, TestStatusIBEqualityOperator) { // Equality against self is true. StatusIB one; - NL_TEST_ASSERT(aSuite, one == one); + EXPECT_EQ(one, one); // Default constructors are equal. - NL_TEST_ASSERT(aSuite, one == StatusIB()); + EXPECT_EQ(one, StatusIB()); // Different imStatus is not equal. StatusIB with_imstatus(Status::Failure); - NL_TEST_ASSERT(aSuite, one != with_imstatus); + EXPECT_NE(one, with_imstatus); // Same imStatus are equal. - NL_TEST_ASSERT(aSuite, with_imstatus == StatusIB(Status::Failure)); + EXPECT_EQ(with_imstatus, StatusIB(Status::Failure)); // Same imStatus but different clusterStatus are not equal. StatusIB with_cluster_status(Status::Failure, /*clusterStatus=*/2); - NL_TEST_ASSERT(aSuite, with_imstatus != with_cluster_status); + EXPECT_NE(with_imstatus, with_cluster_status); // Different imStatus but same clusterStatus are not equal. - NL_TEST_ASSERT(aSuite, with_cluster_status != StatusIB(Status::Success, /*clusterStatus=*/2)); + EXPECT_NE(with_cluster_status, StatusIB(Status::Success, /*clusterStatus=*/2)); // Same imStatus and clusterStatus are equal. - NL_TEST_ASSERT(aSuite, with_cluster_status == StatusIB(Status::Failure, /*clusterStatus=*/2)); + EXPECT_EQ(with_cluster_status, StatusIB(Status::Failure, /*clusterStatus=*/2)); // From same CHIP_ERROR are equal. StatusIB invalid_argument(CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(aSuite, invalid_argument == StatusIB(CHIP_ERROR_INVALID_ARGUMENT)); + EXPECT_EQ(invalid_argument, StatusIB(CHIP_ERROR_INVALID_ARGUMENT)); // Different CHIP_ERROR are equal if they are not from kIMClusterStatus or // kIMGlobalStatus. - NL_TEST_ASSERT(aSuite, invalid_argument == StatusIB(CHIP_ERROR_INCORRECT_STATE)); + EXPECT_EQ(invalid_argument, StatusIB(CHIP_ERROR_INCORRECT_STATE)); // Error never equals NO_ERROR - NL_TEST_ASSERT(aSuite, invalid_argument != StatusIB(CHIP_NO_ERROR)); + EXPECT_NE(invalid_argument, StatusIB(CHIP_NO_ERROR)); } -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("StatusIBToFromChipError", TestStatusIBToFromChipError), -#if !CHIP_CONFIG_SHORT_ERROR_STR - NL_TEST_DEF("StatusIBErrorToString", TestStatusIBErrorToString), -#endif // !CHIP_CONFIG_SHORT_ERROR_STR - NL_TEST_DEF("StatusIBEqualityOperator", TestStatusIBEqualityOperator), - NL_TEST_SENTINEL() -}; -// clang-format on } // namespace - -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - // Hand-register the error formatter. Normally it's registered by - // InteractionModelEngine::Init, but we don't want to mess with that here. - StatusIB::RegisterErrorFormatter(); - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -int TestStatusIB() -{ - // clang-format off - nlTestSuite theSuite = - { - "StatusIB", - &sTests[0], - TestSetup, - TestTeardown, - }; - // clang-format on - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestStatusIB) diff --git a/src/app/tests/TestStatusResponseMessage.cpp b/src/app/tests/TestStatusResponseMessage.cpp index 565ed85dfe8af0..72cf8685d9bfff 100644 --- a/src/app/tests/TestStatusResponseMessage.cpp +++ b/src/app/tests/TestStatusResponseMessage.cpp @@ -16,40 +16,41 @@ * limitations under the License. */ -/** - * @file - * This file implements a test for CHIP Interaction Model Message Def - * - */ +#include +#include #include #include #include #include -#include #include -#include - namespace { using namespace chip::app; constexpr chip::Protocols::InteractionModel::Status statusValue = chip::Protocols::InteractionModel::Status::Success; constexpr chip::Protocols::InteractionModel::Status invalidStatusValue = chip::Protocols::InteractionModel::Status::Failure; -void BuildStatusResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVWriter & aWriter) +class TestStatusResponseMessage : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +void BuildStatusResponseMessage(chip::TLV::TLVWriter & aWriter) { CHIP_ERROR err = CHIP_NO_ERROR; StatusResponseMessage::Builder statusResponse; err = statusResponse.Init(&aWriter); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); statusResponse.Status(statusValue); - NL_TEST_ASSERT(apSuite, statusResponse.GetError() == CHIP_NO_ERROR); + EXPECT_EQ(statusResponse.GetError(), CHIP_NO_ERROR); } -void ParseStatusResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader, bool aTestPositiveCase) +void ParseStatusResponseMessage(chip::TLV::TLVReader & aReader, bool aTestPositiveCase) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -57,7 +58,7 @@ void ParseStatusResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aR chip::Protocols::InteractionModel::Status status; err = statusResponse.Init(aReader); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); #if CHIP_CONFIG_IM_PRETTY_PRINT statusResponse.PrettyPrint(); #endif @@ -65,87 +66,42 @@ void ParseStatusResponseMessage(nlTestSuite * apSuite, chip::TLV::TLVReader & aR err = statusResponse.GetStatus(status); if (aTestPositiveCase) { - NL_TEST_ASSERT(apSuite, status == statusValue && err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(status, statusValue); } else { - NL_TEST_ASSERT(apSuite, status != invalidStatusValue && err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_NE(status, invalidStatusValue); } } -void StatusResponseMessagePositiveTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestStatusResponseMessage, TestStatusResponseMessagePositive) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildStatusResponseMessage(apSuite, writer); + BuildStatusResponseMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); reader.Init(std::move(buf)); - ParseStatusResponseMessage(apSuite, reader, true /*aTestPositiveCase*/); + ParseStatusResponseMessage(reader, true /*aTestPositiveCase*/); } -void StatusResponseMessageNegativeTest(nlTestSuite * apSuite, void * apContext) +TEST_F(TestStatusResponseMessage, TestStatusResponseMessageNegative) { CHIP_ERROR err = CHIP_NO_ERROR; chip::System::PacketBufferTLVWriter writer; chip::System::PacketBufferTLVReader reader; writer.Init(chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize)); - BuildStatusResponseMessage(apSuite, writer); + BuildStatusResponseMessage(writer); chip::System::PacketBufferHandle buf; err = writer.Finalize(&buf); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); reader.Init(std::move(buf)); - ParseStatusResponseMessage(apSuite, reader, false /*aTestPositiveCase*/); + ParseStatusResponseMessage(reader, false /*aTestPositiveCase*/); } -// clang-format off -const nlTest sTests[] = - { - NL_TEST_DEF("StatusResponseMessagePositiveTest", StatusResponseMessagePositiveTest), - NL_TEST_DEF("StatusResponseMessageNegativeTest", StatusResponseMessageNegativeTest), - NL_TEST_SENTINEL() - }; -// clang-format on } // namespace - -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -int TestStatusResponseMessage() -{ - // clang-format off - nlTestSuite theSuite = - { - "StatusResponseMessage", - &sTests[0], - TestSetup, - TestTeardown, - }; - // clang-format on - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestStatusResponseMessage) diff --git a/src/app/tests/TestTestEventTriggerDelegate.cpp b/src/app/tests/TestTestEventTriggerDelegate.cpp index cd7f3ae9cd7be3..09e513a3d87afb 100644 --- a/src/app/tests/TestTestEventTriggerDelegate.cpp +++ b/src/app/tests/TestTestEventTriggerDelegate.cpp @@ -19,9 +19,9 @@ #include #include +#include #include -#include -#include +#include using namespace chip; @@ -66,20 +66,20 @@ class TestEventDelegate : public TestEventTriggerDelegate ByteSpan mEnableKey; }; -void TestKeyChecking(nlTestSuite * aSuite, void * aContext) +TEST(TestTestEventTriggerDelegate, TestKeyChecking) { const uint8_t kTestKey[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; const uint8_t kBadKey[16] = { 255, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; const uint8_t kDiffLenBadKey[17] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; TestEventDelegate delegate{ ByteSpan{ kTestKey } }; - NL_TEST_ASSERT(aSuite, delegate.DoesEnableKeyMatch(ByteSpan{ kTestKey }) == true); - NL_TEST_ASSERT(aSuite, delegate.DoesEnableKeyMatch(ByteSpan{ kBadKey }) == false); - NL_TEST_ASSERT(aSuite, delegate.DoesEnableKeyMatch(ByteSpan{ kDiffLenBadKey }) == false); - NL_TEST_ASSERT(aSuite, delegate.DoesEnableKeyMatch(ByteSpan{}) == false); + EXPECT_TRUE(delegate.DoesEnableKeyMatch(ByteSpan{ kTestKey })); + EXPECT_FALSE(delegate.DoesEnableKeyMatch(ByteSpan{ kBadKey })); + EXPECT_FALSE(delegate.DoesEnableKeyMatch(ByteSpan{ kDiffLenBadKey })); + EXPECT_FALSE(delegate.DoesEnableKeyMatch(ByteSpan{})); } -void TestHandlerManagement(nlTestSuite * aSuite, void * aContext) +TEST(TestTestEventTriggerDelegate, TestHandlerManagement) { const uint8_t kTestKey[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; @@ -89,31 +89,31 @@ void TestHandlerManagement(nlTestSuite * aSuite, void * aContext) TestEventHandler event2Handler{ 2 }; // Add 2, check 2 works 1 doesn't. - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(1) != CHIP_NO_ERROR); + EXPECT_NE(delegate.HandleEventTriggers(1), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.AddHandler(&event2Handler) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.AddHandler(&event2Handler) != CHIP_NO_ERROR); + EXPECT_EQ(delegate.AddHandler(&event2Handler), CHIP_NO_ERROR); + EXPECT_NE(delegate.AddHandler(&event2Handler), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(2) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(1) != CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(2) == CHIP_NO_ERROR); + EXPECT_EQ(delegate.HandleEventTriggers(2), CHIP_NO_ERROR); + EXPECT_NE(delegate.HandleEventTriggers(1), CHIP_NO_ERROR); + EXPECT_EQ(delegate.HandleEventTriggers(2), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, event1Handler.GetCount() == 0); - NL_TEST_ASSERT(aSuite, event2Handler.GetCount() == 2); + EXPECT_EQ(event1Handler.GetCount(), 0); + EXPECT_EQ(event2Handler.GetCount(), 2); event1Handler.ClearCount(); event2Handler.ClearCount(); // Add 1, check 1 and 2 work. - NL_TEST_ASSERT(aSuite, delegate.AddHandler(&event1Handler) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.AddHandler(&event1Handler) != CHIP_NO_ERROR); + EXPECT_EQ(delegate.AddHandler(&event1Handler), CHIP_NO_ERROR); + EXPECT_NE(delegate.AddHandler(&event1Handler), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(2) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(1) == CHIP_NO_ERROR); + EXPECT_EQ(delegate.HandleEventTriggers(1), CHIP_NO_ERROR); + EXPECT_EQ(delegate.HandleEventTriggers(2), CHIP_NO_ERROR); + EXPECT_EQ(delegate.HandleEventTriggers(1), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, event1Handler.GetCount() == 2); - NL_TEST_ASSERT(aSuite, event2Handler.GetCount() == 1); + EXPECT_EQ(event1Handler.GetCount(), 2); + EXPECT_EQ(event2Handler.GetCount(), 1); event1Handler.ClearCount(); event2Handler.ClearCount(); @@ -121,29 +121,29 @@ void TestHandlerManagement(nlTestSuite * aSuite, void * aContext) // Remove 2, check 1 works. delegate.RemoveHandler(&event2Handler); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(2) != CHIP_NO_ERROR); + EXPECT_EQ(delegate.HandleEventTriggers(1), CHIP_NO_ERROR); + EXPECT_NE(delegate.HandleEventTriggers(2), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, event1Handler.GetCount() == 1); - NL_TEST_ASSERT(aSuite, event2Handler.GetCount() == 0); + EXPECT_EQ(event1Handler.GetCount(), 1); + EXPECT_EQ(event2Handler.GetCount(), 0); // Remove again, should be NO-OP. delegate.RemoveHandler(&event2Handler); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(2) != CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, event2Handler.GetCount() == 0); + EXPECT_NE(delegate.HandleEventTriggers(2), CHIP_NO_ERROR); + EXPECT_EQ(event2Handler.GetCount(), 0); event1Handler.ClearCount(); event2Handler.ClearCount(); // Add 2 again, check 1 and 2 work. - NL_TEST_ASSERT(aSuite, delegate.AddHandler(&event2Handler) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.AddHandler(&event2Handler) != CHIP_NO_ERROR); + EXPECT_EQ(delegate.AddHandler(&event2Handler), CHIP_NO_ERROR); + EXPECT_NE(delegate.AddHandler(&event2Handler), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(2) == CHIP_NO_ERROR); + EXPECT_EQ(delegate.HandleEventTriggers(1), CHIP_NO_ERROR); + EXPECT_EQ(delegate.HandleEventTriggers(2), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, event1Handler.GetCount() == 1); - NL_TEST_ASSERT(aSuite, event2Handler.GetCount() == 1); + EXPECT_EQ(event1Handler.GetCount(), 1); + EXPECT_EQ(event2Handler.GetCount(), 1); event1Handler.ClearCount(); event2Handler.ClearCount(); @@ -151,42 +151,14 @@ void TestHandlerManagement(nlTestSuite * aSuite, void * aContext) // Remove all handlers, check neither works. delegate.ClearAllHandlers(); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(1) != CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, delegate.HandleEventTriggers(2) != CHIP_NO_ERROR); + EXPECT_NE(delegate.HandleEventTriggers(1), CHIP_NO_ERROR); + EXPECT_NE(delegate.HandleEventTriggers(2), CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, event1Handler.GetCount() == 0); - NL_TEST_ASSERT(aSuite, event2Handler.GetCount() == 0); + EXPECT_EQ(event1Handler.GetCount(), 0); + EXPECT_EQ(event2Handler.GetCount(), 0); // Add a handler at the end: having it remaining should not cause crashes/leaks. - NL_TEST_ASSERT(aSuite, delegate.AddHandler(&event2Handler) == CHIP_NO_ERROR); -} - -int TestSetup(void * inContext) -{ - return SUCCESS; -} - -int TestTeardown(void * inContext) -{ - return SUCCESS; + EXPECT_EQ(delegate.AddHandler(&event2Handler), CHIP_NO_ERROR); } } // namespace - -int TestTestEventTriggerDelegate() -{ - static nlTest sTests[] = { NL_TEST_DEF("TestKeyChecking", TestKeyChecking), - NL_TEST_DEF("TestHandlerManagement", TestHandlerManagement), NL_TEST_SENTINEL() }; - - nlTestSuite theSuite = { - "TestTestEventTriggerDelegate", - &sTests[0], - TestSetup, - TestTeardown, - }; - - nlTestRunner(&theSuite, nullptr); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestTestEventTriggerDelegate) diff --git a/src/app/tests/TestTimeSyncDataProvider.cpp b/src/app/tests/TestTimeSyncDataProvider.cpp index 3ea30d5582a642..bc73f03e55a386 100644 --- a/src/app/tests/TestTimeSyncDataProvider.cpp +++ b/src/app/tests/TestTimeSyncDataProvider.cpp @@ -17,11 +17,10 @@ #include #include +#include #include #include -#include - -#include +#include using namespace chip; using namespace chip::DeviceLayer; @@ -36,7 +35,14 @@ using DSTOffset = app::Clusters::TimeSynchronization::Structs::DSTOffset namespace { -void TestTrustedTimeSourceStoreLoad(nlTestSuite * inSuite, void * inContext) +class TestTimeSyncDataProvider : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestTimeSyncDataProvider, TestTrustedTimeSourceStoreLoad) { TestPersistentStorageDelegate persistentStorage; TimeSyncDataProvider timeSyncDataProv; @@ -44,16 +50,16 @@ void TestTrustedTimeSourceStoreLoad(nlTestSuite * inSuite, void * inContext) TrustedTimeSource tts = { chip::FabricIndex(1), chip::NodeId(20), chip::EndpointId(0) }; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == timeSyncDataProv.StoreTrustedTimeSource(tts)); + EXPECT_EQ(CHIP_NO_ERROR, timeSyncDataProv.StoreTrustedTimeSource(tts)); TrustedTimeSource retrievedTrustedTimeSource; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == timeSyncDataProv.LoadTrustedTimeSource(retrievedTrustedTimeSource)); - NL_TEST_ASSERT(inSuite, retrievedTrustedTimeSource.fabricIndex == chip::FabricIndex(1)); - NL_TEST_ASSERT(inSuite, retrievedTrustedTimeSource.nodeID == chip::NodeId(20)); - NL_TEST_ASSERT(inSuite, retrievedTrustedTimeSource.endpoint == chip::EndpointId(0)); + EXPECT_EQ(CHIP_NO_ERROR, timeSyncDataProv.LoadTrustedTimeSource(retrievedTrustedTimeSource)); + EXPECT_EQ(retrievedTrustedTimeSource.fabricIndex, chip::FabricIndex(1)); + EXPECT_EQ(retrievedTrustedTimeSource.nodeID, chip::NodeId(20)); + EXPECT_EQ(retrievedTrustedTimeSource.endpoint, chip::EndpointId(0)); } -void TestTrustedTimeSourceEmpty(nlTestSuite * inSuite, void * inContext) +TEST_F(TestTimeSyncDataProvider, TestTrustedTimeSourceEmpty) { TestPersistentStorageDelegate persistentStorage; TimeSyncDataProvider timeSyncDataProv; @@ -61,10 +67,10 @@ void TestTrustedTimeSourceEmpty(nlTestSuite * inSuite, void * inContext) TrustedTimeSource tts; - NL_TEST_ASSERT(inSuite, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == timeSyncDataProv.LoadTrustedTimeSource(tts)); + EXPECT_EQ(CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND, timeSyncDataProv.LoadTrustedTimeSource(tts)); } -void TestDefaultNTPStoreLoad(nlTestSuite * inSuite, void * inContext) +TEST_F(TestTimeSyncDataProvider, TestDefaultNTPStoreLoad) { TestPersistentStorageDelegate persistentStorage; TimeSyncDataProvider timeSyncDataProv; @@ -73,22 +79,22 @@ void TestDefaultNTPStoreLoad(nlTestSuite * inSuite, void * inContext) char ntp[10] = "localhost"; chip::CharSpan defaultNTP(ntp); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == timeSyncDataProv.StoreDefaultNtp(defaultNTP)); + EXPECT_EQ(CHIP_NO_ERROR, timeSyncDataProv.StoreDefaultNtp(defaultNTP)); char buf[5]; chip::MutableCharSpan getDefaultNtp(buf); - NL_TEST_ASSERT(inSuite, CHIP_ERROR_BUFFER_TOO_SMALL == timeSyncDataProv.LoadDefaultNtp(getDefaultNtp)); - NL_TEST_ASSERT(inSuite, getDefaultNtp.size() == 5); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, timeSyncDataProv.LoadDefaultNtp(getDefaultNtp)); + EXPECT_EQ(getDefaultNtp.size(), 5u); char buf1[20]; chip::MutableCharSpan getDefaultNtp1(buf1); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == timeSyncDataProv.LoadDefaultNtp(getDefaultNtp1)); - NL_TEST_ASSERT(inSuite, getDefaultNtp1.size() == 10); + EXPECT_EQ(CHIP_NO_ERROR, timeSyncDataProv.LoadDefaultNtp(getDefaultNtp1)); + EXPECT_EQ(getDefaultNtp1.size(), 10u); } -void TestDefaultNTPEmpty(nlTestSuite * inSuite, void * inContext) +TEST_F(TestTimeSyncDataProvider, TestDefaultNTPEmpty) { TestPersistentStorageDelegate persistentStorage; TimeSyncDataProvider timeSyncDataProv; @@ -96,10 +102,10 @@ void TestDefaultNTPEmpty(nlTestSuite * inSuite, void * inContext) chip::MutableCharSpan defaultNTP; - NL_TEST_ASSERT(inSuite, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == timeSyncDataProv.LoadDefaultNtp(defaultNTP)); + EXPECT_EQ(CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND, timeSyncDataProv.LoadDefaultNtp(defaultNTP)); } -void TestTimeZoneStoreLoad(nlTestSuite * inSuite, void * inContext) +TEST_F(TestTimeSyncDataProvider, TestTimeZoneStoreLoad) { TestPersistentStorageDelegate persistentStorage; TimeSyncDataProvider timeSyncDataProv; @@ -122,26 +128,26 @@ void TestTimeZoneStoreLoad(nlTestSuite * inSuite, void * inContext) TimeSyncDataProvider::TimeZoneStore tzS[3] = { makeTimeZone(1, 1, tzShort), makeTimeZone(2, 2, tzLong), makeTimeZone(3, 3, tzBerlin) }; TimeZoneList tzL(tzS); - NL_TEST_ASSERT(inSuite, tzL.size() == 3); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == timeSyncDataProv.StoreTimeZone(tzL)); + EXPECT_EQ(tzL.size(), 3u); + EXPECT_EQ(CHIP_NO_ERROR, timeSyncDataProv.StoreTimeZone(tzL)); TimeSyncDataProvider::TimeZoneStore emptyTzS[3] = { makeTimeZone(), makeTimeZone(), makeTimeZone() }; tzL = TimeZoneList(emptyTzS); TimeSyncDataProvider::TimeZoneObj tzObj{ tzL, 3 }; - NL_TEST_ASSERT(inSuite, tzL.size() == 3); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == timeSyncDataProv.LoadTimeZone(tzObj)); - NL_TEST_ASSERT(inSuite, tzObj.validSize == 3); + EXPECT_EQ(tzL.size(), 3u); + EXPECT_EQ(CHIP_NO_ERROR, timeSyncDataProv.LoadTimeZone(tzObj)); + EXPECT_EQ(tzObj.validSize, 3u); - NL_TEST_ASSERT(inSuite, !tzL.empty()); + EXPECT_FALSE(tzL.empty()); if (!tzL.empty()) { auto & tz = tzL[0].timeZone; - NL_TEST_ASSERT(inSuite, tz.offset == 1); - NL_TEST_ASSERT(inSuite, tz.validAt == 1); - NL_TEST_ASSERT(inSuite, tz.name.HasValue()); - NL_TEST_ASSERT(inSuite, tz.name.Value().size() == 2); + EXPECT_EQ(tz.offset, 1); + EXPECT_EQ(tz.validAt, 1u); + EXPECT_TRUE(tz.name.HasValue()); + EXPECT_EQ(tz.name.Value().size(), 2u); tzL = tzL.SubSpan(1); } @@ -149,10 +155,10 @@ void TestTimeZoneStoreLoad(nlTestSuite * inSuite, void * inContext) if (!tzL.empty()) { auto & tz = tzL[0].timeZone; - NL_TEST_ASSERT(inSuite, tz.offset == 2); - NL_TEST_ASSERT(inSuite, tz.validAt == 2); - NL_TEST_ASSERT(inSuite, tz.name.HasValue()); - NL_TEST_ASSERT(inSuite, tz.name.Value().size() == 63); + EXPECT_EQ(tz.offset, 2); + EXPECT_EQ(tz.validAt, 2u); + EXPECT_TRUE(tz.name.HasValue()); + EXPECT_EQ(tz.name.Value().size(), 63u); tzL = tzL.SubSpan(1); } @@ -160,18 +166,18 @@ void TestTimeZoneStoreLoad(nlTestSuite * inSuite, void * inContext) if (!tzL.empty()) { auto & tz = tzL[0].timeZone; - NL_TEST_ASSERT(inSuite, tz.offset == 3); - NL_TEST_ASSERT(inSuite, tz.validAt == 3); - NL_TEST_ASSERT(inSuite, tz.name.HasValue()); - NL_TEST_ASSERT(inSuite, tz.name.Value().size() == 6); + EXPECT_EQ(tz.offset, 3); + EXPECT_EQ(tz.validAt, 3u); + EXPECT_TRUE(tz.name.HasValue()); + EXPECT_EQ(tz.name.Value().size(), 6u); tzL = tzL.SubSpan(1); } - NL_TEST_ASSERT(inSuite, tzL.empty()); + EXPECT_TRUE(tzL.empty()); } -void TestTimeZoneEmpty(nlTestSuite * inSuite, void * inContext) +TEST_F(TestTimeSyncDataProvider, TestTimeZoneEmpty) { TestPersistentStorageDelegate persistentStorage; TimeSyncDataProvider timeSyncDataProv; @@ -179,12 +185,12 @@ void TestTimeZoneEmpty(nlTestSuite * inSuite, void * inContext) TimeSyncDataProvider::TimeZoneObj timeZoneObj; - NL_TEST_ASSERT(inSuite, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == timeSyncDataProv.LoadTimeZone(timeZoneObj)); - NL_TEST_ASSERT(inSuite, !timeZoneObj.timeZoneList.begin()); - NL_TEST_ASSERT(inSuite, timeZoneObj.validSize == 0); + EXPECT_EQ(CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND, timeSyncDataProv.LoadTimeZone(timeZoneObj)); + EXPECT_FALSE(timeZoneObj.timeZoneList.begin()); + EXPECT_EQ(timeZoneObj.validSize, 0u); } -void TestDSTOffset(nlTestSuite * inSuite, void * inContext) +TEST_F(TestTimeSyncDataProvider, TestDSTOffset) { TestPersistentStorageDelegate persistentStorage; TimeSyncDataProvider timeSyncDataProv; @@ -201,26 +207,26 @@ void TestDSTOffset(nlTestSuite * inSuite, void * inContext) DSTOffset dstS[3] = { makeDSTOffset(1, 1, 2), makeDSTOffset(2, 2, 3), makeDSTOffset(3, 3) }; DSTOffsetList dstL(dstS); TimeSyncDataProvider::DSTOffsetObj dstObj{ dstL, 3 }; - NL_TEST_ASSERT(inSuite, dstObj.validSize == 3); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == timeSyncDataProv.StoreDSTOffset(dstL)); + EXPECT_EQ(dstObj.validSize, 3u); + EXPECT_EQ(CHIP_NO_ERROR, timeSyncDataProv.StoreDSTOffset(dstL)); DSTOffset emtpyDstS[3] = { makeDSTOffset(), makeDSTOffset(), makeDSTOffset() }; dstObj.dstOffsetList = DSTOffsetList(emtpyDstS); dstObj.validSize = 0; - NL_TEST_ASSERT(inSuite, dstObj.dstOffsetList.size() == 3); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == timeSyncDataProv.LoadDSTOffset(dstObj)); - NL_TEST_ASSERT(inSuite, dstObj.validSize == 3); + EXPECT_EQ(dstObj.dstOffsetList.size(), 3u); + EXPECT_EQ(CHIP_NO_ERROR, timeSyncDataProv.LoadDSTOffset(dstObj)); + EXPECT_EQ(dstObj.validSize, 3u); - NL_TEST_ASSERT(inSuite, !dstObj.dstOffsetList.empty()); + EXPECT_FALSE(dstObj.dstOffsetList.empty()); if (!dstObj.dstOffsetList.empty()) { auto & dst = dstObj.dstOffsetList.data()[0]; - NL_TEST_ASSERT(inSuite, dst.offset == 1); - NL_TEST_ASSERT(inSuite, dst.validStarting == 1); - NL_TEST_ASSERT(inSuite, !dst.validUntil.IsNull()); - NL_TEST_ASSERT(inSuite, dst.validUntil.Value() == 2); + EXPECT_EQ(dst.offset, 1); + EXPECT_EQ(dst.validStarting, 1u); + EXPECT_FALSE(dst.validUntil.IsNull()); + EXPECT_EQ(dst.validUntil.Value(), 2u); dstObj.dstOffsetList = dstObj.dstOffsetList.SubSpan(1); } @@ -228,10 +234,10 @@ void TestDSTOffset(nlTestSuite * inSuite, void * inContext) if (!dstObj.dstOffsetList.empty()) { auto & dst = dstObj.dstOffsetList.data()[0]; - NL_TEST_ASSERT(inSuite, dst.offset == 2); - NL_TEST_ASSERT(inSuite, dst.validStarting == 2); - NL_TEST_ASSERT(inSuite, !dst.validUntil.IsNull()); - NL_TEST_ASSERT(inSuite, dst.validUntil.Value() == 3); + EXPECT_EQ(dst.offset, 2); + EXPECT_EQ(dst.validStarting, 2u); + EXPECT_FALSE(dst.validUntil.IsNull()); + EXPECT_EQ(dst.validUntil.Value(), 3u); dstObj.dstOffsetList = dstObj.dstOffsetList.SubSpan(1); } @@ -239,17 +245,17 @@ void TestDSTOffset(nlTestSuite * inSuite, void * inContext) if (!dstObj.dstOffsetList.empty()) { auto & dst = dstObj.dstOffsetList.data()[0]; - NL_TEST_ASSERT(inSuite, dst.offset == 3); - NL_TEST_ASSERT(inSuite, dst.validStarting == 3); - NL_TEST_ASSERT(inSuite, dst.validUntil.IsNull()); + EXPECT_EQ(dst.offset, 3); + EXPECT_EQ(dst.validStarting, 3u); + EXPECT_TRUE(dst.validUntil.IsNull()); dstObj.dstOffsetList = dstObj.dstOffsetList.SubSpan(1); } - NL_TEST_ASSERT(inSuite, dstObj.dstOffsetList.empty()); + EXPECT_TRUE(dstObj.dstOffsetList.empty()); } -void TestDSTOffsetEmpty(nlTestSuite * inSuite, void * inContext) +TEST_F(TestTimeSyncDataProvider, TestDSTOffsetEmpty) { TestPersistentStorageDelegate persistentStorage; TimeSyncDataProvider timeSyncDataProv; @@ -257,42 +263,9 @@ void TestDSTOffsetEmpty(nlTestSuite * inSuite, void * inContext) TimeSyncDataProvider::DSTOffsetObj dstObj; - NL_TEST_ASSERT(inSuite, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == timeSyncDataProv.LoadDSTOffset(dstObj)); - NL_TEST_ASSERT(inSuite, !dstObj.dstOffsetList.begin()); - NL_TEST_ASSERT(inSuite, dstObj.validSize == 0); -} - -const nlTest sTests[] = { NL_TEST_DEF("Test TrustedTimeSource store load", TestTrustedTimeSourceStoreLoad), - NL_TEST_DEF("Test TrustedTimeSource empty", TestTrustedTimeSourceEmpty), - NL_TEST_DEF("Test default NTP store load", TestDefaultNTPStoreLoad), - NL_TEST_DEF("Test default NTP empty", TestDefaultNTPEmpty), - NL_TEST_DEF("Test time zone store load", TestTimeZoneStoreLoad), - NL_TEST_DEF("Test time zone (empty list)", TestTimeZoneEmpty), - NL_TEST_DEF("Test DSTOffset", TestDSTOffset), - NL_TEST_DEF("Test DSTOffset (empty list)", TestDSTOffsetEmpty), - NL_TEST_SENTINEL() }; - -int TestSetup(void * inContext) -{ - VerifyOrReturnError(CHIP_NO_ERROR == chip::Platform::MemoryInit(), FAILURE); - return SUCCESS; -} - -int TestTearDown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; + EXPECT_EQ(CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND, timeSyncDataProv.LoadDSTOffset(dstObj)); + EXPECT_TRUE(dstObj.dstOffsetList.empty()); + EXPECT_EQ(dstObj.validSize, 0u); } } // namespace - -int TestTimeSyncDataProvider() -{ - nlTestSuite theSuite = { "Time Sync data provider tests", &sTests[0], TestSetup, TestTearDown }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestTimeSyncDataProvider) diff --git a/src/app/tests/TestWriteInteraction.cpp b/src/app/tests/TestWriteInteraction.cpp index 795c52a9030f99..7aa2dba303bf0f 100644 --- a/src/app/tests/TestWriteInteraction.cpp +++ b/src/app/tests/TestWriteInteraction.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -40,9 +41,6 @@ namespace { -uint8_t attributeDataTLV[CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE]; -size_t attributeDataTLVLen = 0; -constexpr chip::DataVersion kRejectedDataVersion = 1; constexpr chip::DataVersion kAcceptedDataVersion = 5; constexpr uint16_t kMaxGroupsPerFabric = 5; constexpr uint16_t kMaxGroupKeysPerFabric = 8; @@ -363,28 +361,6 @@ void TestWriteInteraction::TestWriteHandler(nlTestSuite * apSuite, void * apCont } } -const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) -{ - // Note: This test does not make use of the real attribute metadata. - static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; - return &stub; -} - -CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, - TLV::TLVReader & aReader, WriteHandler * aWriteHandler) -{ - if (aPath.mDataVersion.HasValue() && aPath.mDataVersion.Value() == kRejectedDataVersion) - { - return aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::DataVersionMismatch); - } - - TLV::TLVWriter writer; - writer.Init(attributeDataTLV); - writer.CopyElement(TLV::AnonymousTag(), aReader); - attributeDataTLVLen = writer.GetLengthWritten(); - return aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); -} - void TestWriteInteraction::TestWriteRoundtripWithClusterObjects(nlTestSuite * apSuite, void * apContext) { TestContext & ctx = *static_cast(apContext); @@ -434,7 +410,7 @@ void TestWriteInteraction::TestWriteRoundtripWithClusterObjects(nlTestSuite * ap { app::Clusters::UnitTesting::Structs::SimpleStruct::Type dataRx; TLV::TLVReader reader; - reader.Init(attributeDataTLV, attributeDataTLVLen); + reader.Init(chip::Test::attributeDataTLV, chip::Test::attributeDataTLVLen); reader.Next(); NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == DataModel::Decode(reader, dataRx)); NL_TEST_ASSERT(apSuite, dataRx.a == dataTx.a); @@ -531,7 +507,7 @@ void TestWriteInteraction::TestWriteRoundtripWithClusterObjectsVersionMismatch(n dataTxValue.b = true; DataModel::Nullable dataTx; dataTx.SetNonNull(dataTxValue); - Optional version(kRejectedDataVersion); + Optional version(chip::Test::kRejectedDataVersion); writeClient.EncodeAttribute(attributePathParams, dataTx, version); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); diff --git a/src/app/tests/test-ember-api.cpp b/src/app/tests/test-ember-api.cpp new file mode 100644 index 00000000000000..2b630327a21897 --- /dev/null +++ b/src/app/tests/test-ember-api.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 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 +#include +#include +#include +#include + +chip::EndpointId chip::Test::numEndpoints = 0; + +// Used by the code in TestPowerSourceCluster.cpp (and generally things using mock ember functions may need this). +uint16_t emberAfGetClusterServerEndpointIndex(chip::EndpointId endpoint, chip::ClusterId cluster, + uint16_t fixedClusterServerEndpointCount) +{ + // Very simple mapping here, we're just going to return the endpoint that matches the given endpoint index because the test + // uses the endpoints in order. + if (endpoint >= chip::Test::numEndpoints) + { + return kEmberInvalidEndpointIndex; + } + return endpoint; +} diff --git a/src/app/tests/test-ember-api.h b/src/app/tests/test-ember-api.h new file mode 100644 index 00000000000000..66b1afc2ebe2f6 --- /dev/null +++ b/src/app/tests/test-ember-api.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 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 + +/// test-ember-api was created to consolidate and centralize stub functions that are related to ember and are used by the unit-tests + +namespace chip { +namespace Test { +extern chip::EndpointId numEndpoints; +} +} // namespace chip + +// Used by the code in TestPowerSourceCluster.cpp (and generally things using mock ember functions may need this). +uint16_t emberAfGetClusterServerEndpointIndex(chip::EndpointId endpoint, chip::ClusterId cluster, + uint16_t fixedClusterServerEndpointCount); diff --git a/src/app/tests/test-interaction-model-api.cpp b/src/app/tests/test-interaction-model-api.cpp new file mode 100644 index 00000000000000..ae3f559424f97c --- /dev/null +++ b/src/app/tests/test-interaction-model-api.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2024 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 "lib/support/CHIPMem.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +uint8_t Test::attributeDataTLV[CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE]; +size_t Test::attributeDataTLVLen = 0; + +namespace app { + +// Used by the code in TestWriteInteraction.cpp (and generally tests that interact with the WriteHandler may need this). +const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) +{ + // Note: This test does not make use of the real attribute metadata. + static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; + return &stub; +} + +// Used by the code in TestWriteInteraction.cpp (and generally tests that interact with the WriteHandler may need this). +CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, + TLV::TLVReader & aReader, WriteHandler * aWriteHandler) +{ + if (aPath.mDataVersion.HasValue() && aPath.mDataVersion.Value() == Test::kRejectedDataVersion) + { + return aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::DataVersionMismatch); + } + + TLV::TLVWriter writer; + writer.Init(chip::Test::attributeDataTLV); + writer.CopyElement(TLV::AnonymousTag(), aReader); + chip::Test::attributeDataTLVLen = writer.GetLengthWritten(); + return aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); +} + +// Used by the code in TestAclAttribute.cpp (and generally tests that interact with the InteractionModelEngine may need this). +bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath) +{ + return aPath.mClusterId != Test::kTestDeniedClusterId1; +} + +// Used by the code in TestAclAttribute.cpp (and generally tests that interact with the InteractionModelEngine may need this). +Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) +{ + if (aPath.mClusterId == Test::kTestDeniedClusterId1) + { + return Protocols::InteractionModel::Status::UnsupportedCluster; + } + + return Protocols::InteractionModel::Status::Success; +} + +// strong defintion in TestCommandInteraction.cpp +__attribute__((weak)) Protocols::InteractionModel::Status +ServerClusterCommandExists(const ConcreteCommandPath & aRequestCommandPath) +{ + // Mock cluster catalog, only support commands on one cluster on one endpoint. + using Protocols::InteractionModel::Status; + + return Status::Success; +} + +// strong defintion in TestCommandInteraction.cpp +__attribute__((weak)) void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPath, + chip::TLV::TLVReader & aReader, CommandHandler * apCommandObj) +{} + +// Used by the code in TestReadInteraction.cpp (and generally tests that interact with the Reporting Engine may need this). +bool IsClusterDataVersionEqual(const ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) +{ + return (Test::kTestDataVersion1 == aRequiredVersion); +} + +// Used by the code in TestReadInteraction.cpp. +bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) +{ + return false; +} + +// Used by the code in TestReadInteraction.cpp (and generally tests that interact with the Reporting Engine may need this). +CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, + const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, + AttributeEncodeState * apEncoderState) +{ + if (aPath.mClusterId >= Test::kMockEndpointMin) + { + return Test::ReadSingleMockClusterData(aSubjectDescriptor.fabricIndex, aPath, aAttributeReports, apEncoderState); + } + + if (!(aPath.mClusterId == Test::kTestClusterId && aPath.mEndpointId == Test::kTestEndpointId)) + { + AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); + ReturnErrorOnFailure(aAttributeReports.GetError()); + ChipLogDetail(DataManagement, "TEST Cluster %" PRIx32 ", Field %" PRIx32 " is dirty", aPath.mClusterId, aPath.mAttributeId); + + AttributeStatusIB::Builder & attributeStatus = attributeReport.CreateAttributeStatus(); + ReturnErrorOnFailure(attributeReport.GetError()); + AttributePathIB::Builder & attributePath = attributeStatus.CreatePath(); + ReturnErrorOnFailure(attributeStatus.GetError()); + + attributePath.Endpoint(aPath.mEndpointId).Cluster(aPath.mClusterId).Attribute(aPath.mAttributeId).EndOfAttributePathIB(); + ReturnErrorOnFailure(attributePath.GetError()); + StatusIB::Builder & errorStatus = attributeStatus.CreateErrorStatus(); + ReturnErrorOnFailure(attributeStatus.GetError()); + errorStatus.EncodeStatusIB(StatusIB(Protocols::InteractionModel::Status::UnsupportedAttribute)); + ReturnErrorOnFailure(errorStatus.GetError()); + ReturnErrorOnFailure(attributeStatus.EndOfAttributeStatusIB()); + return attributeReport.EndOfAttributeReportIB(); + } + + return AttributeValueEncoder(aAttributeReports, aSubjectDescriptor, aPath, 0 /* dataVersion */).Encode(Test::kTestFieldValue1); +} + +} // namespace app + +} // namespace chip diff --git a/src/app/tests/test-interaction-model-api.h b/src/app/tests/test-interaction-model-api.h new file mode 100644 index 00000000000000..88e861b267b63b --- /dev/null +++ b/src/app/tests/test-interaction-model-api.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 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. + */ + +#pragma once + +/// test-interaction-model-api was created to consolidate and centralize stub functions that are used by the Interaction Model +/// during unit-testing. + +#include +#include +#include +#include +#include +#include + +namespace chip { + +namespace Test { + +constexpr chip::ClusterId kTestDeniedClusterId1 = 1000; +constexpr chip::ClusterId kTestDeniedClusterId2 = 3; + +constexpr chip::ClusterId kTestClusterId = 6; +constexpr uint8_t kTestFieldValue1 = 1; +constexpr chip::EndpointId kTestEndpointId = 1; +constexpr chip::DataVersion kTestDataVersion1 = 3; + +constexpr chip::DataVersion kRejectedDataVersion = 1; +extern uint8_t attributeDataTLV[CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE]; +extern size_t attributeDataTLVLen; + +} // namespace Test +namespace app { + +CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, + const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, + AttributeEncodeState * apEncoderState); + +bool IsClusterDataVersionEqual(const ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion); + +CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, + TLV::TLVReader & aReader, WriteHandler * aWriteHandler); +const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath); + +bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath); +Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath); + +Protocols::InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aRequestCommandPath); + +void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPath, chip::TLV::TLVReader & aReader, + CommandHandler * apCommandObj); + +bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint); + +} // namespace app +} // namespace chip diff --git a/src/test_driver/openiotsdk/unit-tests/test_components.txt b/src/test_driver/openiotsdk/unit-tests/test_components.txt index 35ba62bc492d6d..54f47dfa47c557 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components.txt @@ -20,4 +20,5 @@ SecureChannelTests ICDServerTests DataModelTests InetLayerTests +AppTests MessagingLayerTests diff --git a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt index d57fda14efe12f..925be3fdd2b499 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt @@ -1,2 +1,2 @@ -AppTests +AppTestsNL SecureChannelTestsNL From 9217d22c95f385e2cf9fce16a17fba18d5cf550b Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Mon, 3 Jun 2024 18:22:50 -0400 Subject: [PATCH 037/162] Add ability to add pending fabric at a chosen fabric index (#33646) Currently it's only possible to allocate fabric indexes sequentially starting from 1. Sparse fabric tables could be produced by adding & removing fabrics, but not directly. This allow the application to control the assignment of fabric ids directly by providing a function that overrides the next index to use. eg If an application has 3 fabrics, it can recreate the fabric table from scratch while keeping consistent indexes. --- src/credentials/FabricTable.cpp | 12 +++ src/credentials/FabricTable.h | 7 ++ src/credentials/tests/CHIPCert_test_vectors.h | 20 ++++ src/credentials/tests/TestFabricTable.cpp | 97 ++++++++++++++++--- 4 files changed, 120 insertions(+), 16 deletions(-) diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index ade5189a738f27..b847addbe10773 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -2124,4 +2124,16 @@ CHIP_ERROR FabricTable::PeekFabricIndexForNextAddition(FabricIndex & outIndex) return CHIP_NO_ERROR; } +CHIP_ERROR FabricTable::SetFabricIndexForNextAddition(FabricIndex fabricIndex) +{ + VerifyOrReturnError(!mStateFlags.Has(StateFlags::kIsPendingFabricDataPresent), CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(IsValidFabricIndex(fabricIndex), CHIP_ERROR_INVALID_FABRIC_INDEX); + + const FabricInfo * fabricInfo = FindFabricWithIndex(fabricIndex); + VerifyOrReturnError(fabricInfo == nullptr, CHIP_ERROR_FABRIC_EXISTS); + + mNextAvailableFabricIndex.SetValue(fabricIndex); + return CHIP_NO_ERROR; +} + } // namespace chip diff --git a/src/credentials/FabricTable.h b/src/credentials/FabricTable.h index 55c1f6965e8c32..aef60f6a17fbbe 100644 --- a/src/credentials/FabricTable.h +++ b/src/credentials/FabricTable.h @@ -1003,6 +1003,13 @@ class DLL_EXPORT FabricTable */ CHIP_ERROR PeekFabricIndexForNextAddition(FabricIndex & outIndex); + /** + * Set the fabric index that will be used fo the next fabric added. + * + * Returns an error if the |fabricIndex| is already in use. + */ + CHIP_ERROR SetFabricIndexForNextAddition(FabricIndex fabricIndex); + private: enum class StateFlags : uint16_t { diff --git a/src/credentials/tests/CHIPCert_test_vectors.h b/src/credentials/tests/CHIPCert_test_vectors.h index 104436e5acc107..ef6ce7bb46c049 100644 --- a/src/credentials/tests/CHIPCert_test_vectors.h +++ b/src/credentials/tests/CHIPCert_test_vectors.h @@ -140,6 +140,8 @@ extern const ByteSpan sTestCert_Node01_01_PublicKey; extern const ByteSpan sTestCert_Node01_01_PrivateKey; extern const ByteSpan sTestCert_Node01_01_SubjectKeyId; extern const ByteSpan sTestCert_Node01_01_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node01_01_NodeId = 0xDEDEDEDE00010001; +inline constexpr FabricId kTestCert_Node01_01_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node01_01_Err01_Chip; @@ -149,6 +151,8 @@ extern const ByteSpan sTestCert_Node01_02_PublicKey; extern const ByteSpan sTestCert_Node01_02_PrivateKey; extern const ByteSpan sTestCert_Node01_02_SubjectKeyId; extern const ByteSpan sTestCert_Node01_02_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node01_02_NodeId = 0xDEDEDEDE00010002; +inline constexpr FabricId kTestCert_Node01_02_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node02_01_Chip; extern const ByteSpan sTestCert_Node02_01_DER; @@ -156,6 +160,8 @@ extern const ByteSpan sTestCert_Node02_01_PublicKey; extern const ByteSpan sTestCert_Node02_01_PrivateKey; extern const ByteSpan sTestCert_Node02_01_SubjectKeyId; extern const ByteSpan sTestCert_Node02_01_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node02_01_NodeId = 0xDEDEDEDE00020001; +inline constexpr FabricId kTestCert_Node02_01_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node02_02_Chip; extern const ByteSpan sTestCert_Node02_02_DER; @@ -163,6 +169,8 @@ extern const ByteSpan sTestCert_Node02_02_PublicKey; extern const ByteSpan sTestCert_Node02_02_PrivateKey; extern const ByteSpan sTestCert_Node02_02_SubjectKeyId; extern const ByteSpan sTestCert_Node02_02_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node02_02_NodeId = 0xDEDEDEDE00020002; +inline constexpr FabricId kTestCert_Node02_02_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node02_03_Chip; extern const ByteSpan sTestCert_Node02_03_DER; @@ -170,6 +178,8 @@ extern const ByteSpan sTestCert_Node02_03_PublicKey; extern const ByteSpan sTestCert_Node02_03_PrivateKey; extern const ByteSpan sTestCert_Node02_03_SubjectKeyId; extern const ByteSpan sTestCert_Node02_03_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node02_03_NodeId = 0xDEDEDEDE00020003; +inline constexpr FabricId kTestCert_Node02_03_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node02_04_Chip; extern const ByteSpan sTestCert_Node02_04_DER; @@ -177,6 +187,8 @@ extern const ByteSpan sTestCert_Node02_04_PublicKey; extern const ByteSpan sTestCert_Node02_04_PrivateKey; extern const ByteSpan sTestCert_Node02_04_SubjectKeyId; extern const ByteSpan sTestCert_Node02_04_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node02_04_NodeId = 0xDEDEDEDE00020004; +inline constexpr FabricId kTestCert_Node02_04_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node02_05_Chip; extern const ByteSpan sTestCert_Node02_05_DER; @@ -184,6 +196,8 @@ extern const ByteSpan sTestCert_Node02_05_PublicKey; extern const ByteSpan sTestCert_Node02_05_PrivateKey; extern const ByteSpan sTestCert_Node02_05_SubjectKeyId; extern const ByteSpan sTestCert_Node02_05_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node02_05_NodeId = 0xDEDEDEDE00020005; +inline constexpr FabricId kTestCert_Node02_05_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node02_06_Chip; extern const ByteSpan sTestCert_Node02_06_DER; @@ -191,6 +205,8 @@ extern const ByteSpan sTestCert_Node02_06_PublicKey; extern const ByteSpan sTestCert_Node02_06_PrivateKey; extern const ByteSpan sTestCert_Node02_06_SubjectKeyId; extern const ByteSpan sTestCert_Node02_06_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node02_06_NodeId = 0xDEDEDEDE00020006; +inline constexpr FabricId kTestCert_Node02_06_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node02_07_Chip; extern const ByteSpan sTestCert_Node02_07_DER; @@ -198,6 +214,8 @@ extern const ByteSpan sTestCert_Node02_07_PublicKey; extern const ByteSpan sTestCert_Node02_07_PrivateKey; extern const ByteSpan sTestCert_Node02_07_SubjectKeyId; extern const ByteSpan sTestCert_Node02_07_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node02_07_NodeId = 0xDEDEDEDE00020007; +inline constexpr FabricId kTestCert_Node02_07_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_Node02_08_Chip; extern const ByteSpan sTestCert_Node02_08_DER; @@ -205,6 +223,8 @@ extern const ByteSpan sTestCert_Node02_08_PublicKey; extern const ByteSpan sTestCert_Node02_08_PrivateKey; extern const ByteSpan sTestCert_Node02_08_SubjectKeyId; extern const ByteSpan sTestCert_Node02_08_AuthorityKeyId; +inline constexpr NodeId kTestCert_Node02_08_NodeId = 0xDEDEDEDE00020008; +inline constexpr FabricId kTestCert_Node02_08_FabricId = 0xFAB000000000001D; extern const ByteSpan sTestCert_PDCID01_Chip; extern const ByteSpan sTestCert_PDCID01_ChipCompact; diff --git a/src/credentials/tests/TestFabricTable.cpp b/src/credentials/tests/TestFabricTable.cpp index a6b9f2ee6bc467..75f51c1c2cb402 100644 --- a/src/credentials/tests/TestFabricTable.cpp +++ b/src/credentials/tests/TestFabricTable.cpp @@ -183,6 +183,18 @@ static CHIP_ERROR LoadTestFabric_Node02_01(FabricTable & fabricTable, bool doCom return err; } +const FabricInfo * FindFabric(FabricTable & fabricTable, ByteSpan rootPublicKey, FabricId fabricId) +{ + Crypto::P256PublicKey key; + EXPECT_GE(key.Length(), rootPublicKey.size()); + if (key.Length() < rootPublicKey.size()) + { + return nullptr; + } + memcpy(key.Bytes(), rootPublicKey.data(), rootPublicKey.size()); + return fabricTable.FindFabric(key, fabricId); +} + struct TestFabricTable : public ::testing::Test { @@ -2279,16 +2291,13 @@ TEST_F(TestFabricTable, TestFabricLookup) EXPECT_EQ(LoadTestFabric_Node01_01(fabricTable, /* doCommit = */ true), CHIP_NO_ERROR); EXPECT_EQ(LoadTestFabric_Node02_01(fabricTable, /* doCommit = */ true, FabricTable::AdvertiseIdentity::No), CHIP_NO_ERROR); + // These two NOCs have the same fabric id on purpose; only the trust root is + // different. + constexpr FabricId kNode01_01_and_02_01_FabricId = 0xFAB000000000001D; + // Attempt lookup of the Root01 fabric. { - Crypto::P256PublicKey key; - EXPECT_GE(key.Length(), TestCerts::sTestCert_Root01_PublicKey.size()); - if (key.Length() < TestCerts::sTestCert_Root01_PublicKey.size()) - { - return; - } - memcpy(key.Bytes(), TestCerts::sTestCert_Root01_PublicKey.data(), TestCerts::sTestCert_Root01_PublicKey.size()); - auto fabricInfo = fabricTable.FindFabric(key, 0xFAB000000000001D); + auto fabricInfo = FindFabric(fabricTable, TestCerts::sTestCert_Root01_PublicKey, kNode01_01_and_02_01_FabricId); ASSERT_NE(fabricInfo, nullptr); EXPECT_EQ(fabricInfo->GetFabricIndex(), 1); @@ -2297,14 +2306,7 @@ TEST_F(TestFabricTable, TestFabricLookup) // Attempt lookup of the Root02 fabric. { - Crypto::P256PublicKey key; - EXPECT_GE(key.Length(), TestCerts::sTestCert_Root02_PublicKey.size()); - if (key.Length() < TestCerts::sTestCert_Root02_PublicKey.size()) - { - return; - } - memcpy(key.Bytes(), TestCerts::sTestCert_Root02_PublicKey.data(), TestCerts::sTestCert_Root02_PublicKey.size()); - auto fabricInfo = fabricTable.FindFabric(key, 0xFAB000000000001D); + auto fabricInfo = FindFabric(fabricTable, TestCerts::sTestCert_Root02_PublicKey, kNode01_01_and_02_01_FabricId); ASSERT_NE(fabricInfo, nullptr); EXPECT_EQ(fabricInfo->GetFabricIndex(), 2); @@ -2317,6 +2319,69 @@ TEST_F(TestFabricTable, TestFabricLookup) } } +TEST_F(TestFabricTable, ShouldFailSetFabricIndexWithInvalidIndex) +{ + chip::TestPersistentStorageDelegate testStorage; + ScopedFabricTable fabricTableHolder; + EXPECT_EQ(fabricTableHolder.Init(&testStorage), CHIP_NO_ERROR); + FabricTable & fabricTable = fabricTableHolder.GetFabricTable(); + + EXPECT_EQ(fabricTable.SetFabricIndexForNextAddition(kUndefinedFabricIndex), CHIP_ERROR_INVALID_FABRIC_INDEX); +} + +TEST_F(TestFabricTable, ShouldFailSetFabricIndexWithPendingFabric) +{ + chip::TestPersistentStorageDelegate testStorage; + ScopedFabricTable fabricTableHolder; + EXPECT_EQ(fabricTableHolder.Init(&testStorage), CHIP_NO_ERROR); + FabricTable & fabricTable = fabricTableHolder.GetFabricTable(); + + EXPECT_EQ(fabricTable.AddNewPendingTrustedRootCert(ByteSpan(TestCerts::sTestCert_Root01_Chip)), CHIP_NO_ERROR); + + EXPECT_EQ(fabricTable.SetFabricIndexForNextAddition(1), CHIP_ERROR_INCORRECT_STATE); +} + +TEST_F(TestFabricTable, ShouldFailSetFabricIndexWhenInUse) +{ + chip::TestPersistentStorageDelegate testStorage; + ScopedFabricTable fabricTableHolder; + EXPECT_EQ(fabricTableHolder.Init(&testStorage), CHIP_NO_ERROR); + FabricTable & fabricTable = fabricTableHolder.GetFabricTable(); + + EXPECT_EQ(LoadTestFabric_Node01_01(fabricTable, /* doCommit = */ true), CHIP_NO_ERROR); + EXPECT_EQ(fabricTable.SetFabricIndexForNextAddition(1), CHIP_ERROR_FABRIC_EXISTS); +} + +TEST_F(TestFabricTable, ShouldAddFabricAtRequestedIndex) +{ + chip::TestPersistentStorageDelegate testStorage; + ScopedFabricTable fabricTableHolder; + EXPECT_EQ(fabricTableHolder.Init(&testStorage), CHIP_NO_ERROR); + FabricTable & fabricTable = fabricTableHolder.GetFabricTable(); + + EXPECT_EQ(fabricTable.SetFabricIndexForNextAddition(2), CHIP_NO_ERROR); + EXPECT_EQ(LoadTestFabric_Node02_01(fabricTable, /* doCommit = */ true), CHIP_NO_ERROR); + + EXPECT_EQ(fabricTable.SetFabricIndexForNextAddition(1), CHIP_NO_ERROR); + EXPECT_EQ(LoadTestFabric_Node01_01(fabricTable, /* doCommit = */ true), CHIP_NO_ERROR); + + { + auto fabricInfo = FindFabric(fabricTable, TestCerts::sTestCert_Root01_PublicKey, TestCerts::kTestCert_Node01_01_FabricId); + ASSERT_NE(fabricInfo, nullptr); + EXPECT_EQ(fabricInfo->GetFabricIndex(), 1); + EXPECT_EQ(fabricInfo->GetNodeId(), TestCerts::kTestCert_Node01_01_NodeId); + EXPECT_EQ(fabricInfo->GetFabricId(), TestCerts::kTestCert_Node01_01_FabricId); + } + + { + auto fabricInfo = FindFabric(fabricTable, TestCerts::sTestCert_Root02_PublicKey, TestCerts::kTestCert_Node02_01_FabricId); + ASSERT_NE(fabricInfo, nullptr); + EXPECT_EQ(fabricInfo->GetFabricIndex(), 2); + EXPECT_EQ(fabricInfo->GetNodeId(), TestCerts::kTestCert_Node02_01_NodeId); + EXPECT_EQ(fabricInfo->GetFabricId(), TestCerts::kTestCert_Node02_01_FabricId); + } +} + TEST_F(TestFabricTable, TestFetchCATs) { // Initialize a fabric table. From 44526d2eb7c86c25d17e6a1a8af412d58f2e180a Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 4 Jun 2024 07:14:58 +0200 Subject: [PATCH 038/162] [Python] Remove obsolete logging callbacks (#33718) Since #5024 there is a new logging callback working. The old code has partially been removed in #4690, but never completely. Drop the old logging code for good. --- .../ChipDeviceController-ScriptBinding.cpp | 12 -- src/controller/python/chip/ChipStack.py | 148 +----------------- 2 files changed, 2 insertions(+), 158 deletions(-) diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index a55d3865bdccae..728fd5801f1cb1 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -212,7 +212,6 @@ PyChipError pychip_DeviceCommissioner_CloseBleConnection(chip::Controller::Devic const char * pychip_Stack_ErrorToString(ChipError::StorageType err); const char * pychip_Stack_StatusReportToString(uint32_t profileId, uint16_t statusCode); -void pychip_Stack_SetLogFunct(LogMessageFunct logFunct); PyChipError pychip_GetConnectedDeviceByNodeId(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId, chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback); @@ -863,17 +862,6 @@ uint64_t pychip_GetCommandSenderHandle(chip::DeviceProxy * device) return 0; } -void pychip_Stack_SetLogFunct(LogMessageFunct logFunct) -{ - // TODO: determine if log redirection is supposed to be functioning in CHIP - // - // Background: original log baseline supported 'redirect logs to this - // function' however CHIP does not currently provide this. - // - // Ideally log redirection should work so that python code can do things - // like using the log module. -} - PyChipError pychip_DeviceController_PostTaskOnChipThread(ChipThreadTaskRunnerFunct callback, void * pythonContext) { if (callback == nullptr || pythonContext == nullptr) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index beeaedd6ae3327..06afff3ef3c380 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -28,15 +28,11 @@ import asyncio import builtins -import logging import os -import sys -import time -from ctypes import CFUNCTYPE, Structure, c_bool, c_char_p, c_int64, c_uint8, c_uint16, c_uint32, c_void_p, py_object, pythonapi +from ctypes import CFUNCTYPE, Structure, c_bool, c_char_p, c_uint16, c_uint32, c_void_p, py_object, pythonapi from threading import Condition, Event, Lock import chip.native -from chip.logging import LOG_CATEGORY_AUTOMATION, LOG_CATEGORY_DETAIL, LOG_CATEGORY_ERROR, LOG_CATEGORY_PROGRESS from chip.native import PyChipError from .ChipUtility import ChipUtility @@ -76,51 +72,6 @@ class DeviceStatusStruct(Structure): ] -class LogCategory(object): - """Debug logging categories used by chip.""" - - @staticmethod - def categoryToLogLevel(cat): - if cat == LOG_CATEGORY_ERROR: - return logging.ERROR - elif cat == LOG_CATEGORY_PROGRESS: - return logging.INFO - elif cat in (LOG_CATEGORY_DETAIL, LOG_CATEGORY_AUTOMATION): - return logging.DEBUG - else: - return logging.NOTSET - - -class ChipLogFormatter(logging.Formatter): - """A custom logging.Formatter for logging chip library messages.""" - - def __init__( - self, - datefmt=None, - logModulePrefix=False, - logLevel=False, - logTimestamp=False, - logMSecs=True, - ): - fmt = "%(message)s" - if logModulePrefix: - fmt = "CHIP:%(chip-module)s: " + fmt - if logLevel: - fmt = "%(levelname)s:" + fmt - if datefmt is not None or logTimestamp: - fmt = "%(asctime)s " + fmt - super(ChipLogFormatter, self).__init__(fmt=fmt, datefmt=datefmt) - self.logMSecs = logMSecs - - def formatTime(self, record, datefmt=None): - if datefmt is None: - timestampStr = time.strftime("%Y-%m-%d %H:%M:%S%z") - if self.logMSecs: - timestampUS = record.__dict__.get("timestamp-usec", 0) - timestampStr = "%s.%03ld" % (timestampStr, timestampUS / 1000) - return timestampStr - - class AsyncCallableHandle: def __init__(self, callback): self._callback = callback @@ -185,15 +136,12 @@ def __call__(self): pythonapi.Py_DecRef(py_object(self)) -_LogMessageFunct = CFUNCTYPE( - None, c_int64, c_int64, c_char_p, c_uint8, c_char_p) _ChipThreadTaskRunnerFunct = CFUNCTYPE(None, py_object) @_singleton class ChipStack(object): - def __init__(self, persistentStoragePath: str, installDefaultLogHandler=True, - bluetoothAdapter=None, enableServerInteractions=True): + def __init__(self, persistentStoragePath: str, enableServerInteractions=True): builtins.enableDebugMode = False # TODO: Probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. @@ -206,8 +154,6 @@ def __init__(self, persistentStoragePath: str, installDefaultLogHandler=True, self.callbackRes = None self.commissioningEventRes = None self.openCommissioningWindowPincode = {} - self._activeLogFunct = None - self.addModulePrefixToLogMessage = True self._enableServerInteractions = enableServerInteractions # @@ -216,50 +162,6 @@ def __init__(self, persistentStoragePath: str, installDefaultLogHandler=True, # self._loadLib() - # Arrange to log output from the chip library to a python logger object with the - # name 'chip.ChipStack'. If desired, applications can override this behavior by - # setting self.logger to a different python logger object, or by calling setLogFunct() - # with their own logging function. - self.logger = logging.getLogger(__name__) - self.setLogFunct(self.defaultLogFunct) - - # Determine if there are already handlers installed for the logger. Python 3.5+ - # has a method for this; on older versions the check has to be done manually. - if hasattr(self.logger, "hasHandlers"): - hasHandlers = self.logger.hasHandlers() - else: - hasHandlers = False - logger = self.logger - while logger is not None: - if len(logger.handlers) > 0: - hasHandlers = True - break - if not logger.propagate: - break - logger = logger.parent - - # If a logging handler has not already been initialized for 'chip.ChipStack', - # or any one of its parent loggers, automatically configure a handler to log to - # stdout. This maintains compatibility with a number of applications which expect - # chip log output to go to stdout by default. - # - # This behavior can be overridden in a variety of ways: - # - Initialize a different log handler before ChipStack is initialized. - # - Pass installDefaultLogHandler=False when initializing ChipStack. - # - Replace the StreamHandler on self.logger with a different handler object. - # - Set a different Formatter object on the existing StreamHandler object. - # - Reconfigure the existing ChipLogFormatter object. - # - Configure chip to call an application-specific logging function by - # calling self.setLogFunct(). - # - Call self.setLogFunct(None), which will configure the chip library - # to log directly to stdout, bypassing python altogether. - # - if installDefaultLogHandler and not hasHandlers: - logHandler = logging.StreamHandler(stream=sys.stdout) - logHandler.setFormatter(ChipLogFormatter()) - self.logger.addHandler(logHandler) - self.logger.setLevel(logging.DEBUG) - @_ChipThreadTaskRunnerFunct def HandleChipThreadRun(callback): callback() @@ -292,49 +194,6 @@ def GetStorageManager(self): def enableServerInteractions(self): return self._enableServerInteractions - @property - def defaultLogFunct(self): - """Returns a python callable which, when called, logs a message to the python logger object - currently associated with the ChipStack object. - The returned function is suitable for passing to the setLogFunct() method.""" - - def logFunct(timestamp, timestampUSec, moduleName, logCat, message): - moduleName = ChipUtility.CStringToString(moduleName) - message = ChipUtility.CStringToString(message) - if self.addModulePrefixToLogMessage: - message = "CHIP:%s: %s" % (moduleName, message) - logLevel = LogCategory.categoryToLogLevel(logCat) - msgAttrs = { - "chip-module": moduleName, - "timestamp": timestamp, - "timestamp-usec": timestampUSec, - } - self.logger.log(logLevel, message, extra=msgAttrs) - - return logFunct - - def setLogFunct(self, logFunct): - """Set the function used by the chip library to log messages. - The supplied object must be a python callable that accepts the following - arguments: - timestamp (integer) - timestampUS (integer) - module name (encoded UTF-8 string) - log category (integer) - message (encoded UTF-8 string) - Specifying None configures the chip library to log directly to stdout.""" - if logFunct is None: - logFunct = 0 - if not isinstance(logFunct, _LogMessageFunct): - logFunct = _LogMessageFunct(logFunct) - # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. - with self.networkLock: - # NOTE: ChipStack must hold a reference to the CFUNCTYPE object while it is - # set. Otherwise it may get garbage collected, and logging calls from the - # chip library will fail. - self._activeLogFunct = logFunct - self._ChipStackLib.pychip_Stack_SetLogFunct(logFunct) - def Shutdown(self): # # Terminate Matter thread and shutdown the stack. @@ -484,9 +343,6 @@ def _loadLib(self): self._ChipStackLib.pychip_Stack_StatusReportToString.restype = c_char_p self._ChipStackLib.pychip_Stack_ErrorToString.argtypes = [c_uint32] self._ChipStackLib.pychip_Stack_ErrorToString.restype = c_char_p - self._ChipStackLib.pychip_Stack_SetLogFunct.argtypes = [ - _LogMessageFunct] - self._ChipStackLib.pychip_Stack_SetLogFunct.restype = PyChipError self._ChipStackLib.pychip_DeviceController_PostTaskOnChipThread.argtypes = [ _ChipThreadTaskRunnerFunct, py_object] From 923854bc102f2bd92bad186e9003eeff1cf0a5db Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Tue, 4 Jun 2024 20:28:33 +1200 Subject: [PATCH 039/162] Add Thread Network Directory Cluster definition (#33683) * Add Thread Network Directory Cluster definition * zap_regen_all * Use ExtendedPanID as per spec * zap_regen_all * Add mustUseTimedInvoke="true" to commands * zap_regen_all --- docs/zap_clusters.md | 1 + src/app/zap-templates/zcl/data-model/all.xml | 1 + .../chip/thread-network-directory-cluster.xml | 77 ++ .../zcl/zcl-with-test-extensions.json | 1 + src/app/zap-templates/zcl/zcl.json | 1 + src/app/zap_cluster_list.json | 1 + .../data_model/controller-clusters.matter | 48 + .../chip/devicecontroller/ChipClusters.java | 356 ++++++ .../devicecontroller/ChipEventStructs.java | 46 + .../chip/devicecontroller/ChipStructs.java | 76 ++ .../devicecontroller/ClusterIDMapping.java | 161 +++ .../devicecontroller/ClusterInfoMapping.java | 209 ++++ .../devicecontroller/ClusterReadMapping.java | 104 ++ .../devicecontroller/ClusterWriteMapping.java | 24 + ...workDirectoryClusterNetworkChangedEvent.kt | 55 + .../chip/devicecontroller/cluster/files.gni | 2 + ...workDirectoryClusterThreadNetworkStruct.kt | 67 + .../clusters/ThreadNetworkDirectoryCluster.kt | 1074 +++++++++++++++++ ...workDirectoryClusterNetworkChangedEvent.kt | 55 + .../java/matter/controller/cluster/files.gni | 3 + ...workDirectoryClusterThreadNetworkStruct.kt | 67 + .../CHIPAttributeTLVValueDecoder.cpp | 241 ++++ .../CHIPEventTLVValueDecoder.cpp | 48 + .../python/chip/clusters/CHIPClusters.py | 86 ++ .../python/chip/clusters/Objects.py | 288 +++++ .../CHIP/templates/availability.yaml | 1 + .../MTRAttributeSpecifiedCheck.mm | 39 + .../MTRAttributeTLVValueDecoder.mm | 75 ++ .../CHIP/zap-generated/MTRBaseClusters.h | 100 ++ .../CHIP/zap-generated/MTRBaseClusters.mm | 443 +++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 21 + .../CHIP/zap-generated/MTRClusterNames.mm | 49 + .../CHIP/zap-generated/MTRClusters.h | 48 + .../CHIP/zap-generated/MTRClusters.mm | 150 +++ .../zap-generated/MTRCommandPayloadsObjc.h | 109 ++ .../zap-generated/MTRCommandPayloadsObjc.mm | 316 +++++ .../MTRCommandPayloads_Internal.h | 24 + .../zap-generated/MTRCommandTimedCheck.mm | 21 + .../zap-generated/MTREventTLVValueDecoder.mm | 32 + .../CHIP/zap-generated/MTRStructsObjc.h | 12 + .../CHIP/zap-generated/MTRStructsObjc.mm | 60 + .../zap-generated/attributes/Accessors.cpp | 236 ++++ .../zap-generated/attributes/Accessors.h | 35 + .../app-common/zap-generated/callback.h | 61 + .../app-common/zap-generated/cluster-enums.h | 2 + .../zap-generated/cluster-objects.cpp | 275 +++++ .../zap-generated/cluster-objects.h | 318 +++++ .../app-common/zap-generated/ids/Attributes.h | 42 + .../app-common/zap-generated/ids/Clusters.h | 3 + .../app-common/zap-generated/ids/Commands.h | 22 + .../app-common/zap-generated/ids/Events.h | 10 + .../zap-generated/cluster/Commands.h | 211 ++++ .../cluster/ComplexArgumentParser.cpp | 39 + .../cluster/ComplexArgumentParser.h | 6 + .../cluster/logging/DataModelLogger.cpp | 133 ++ .../cluster/logging/DataModelLogger.h | 8 + .../zap-generated/cluster/Commands.h | 1067 ++++++++++++++++ 57 files changed, 7060 insertions(+) create mode 100644 src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt diff --git a/docs/zap_clusters.md b/docs/zap_clusters.md index a11a552bf023a6..e23b2508a5ee54 100644 --- a/docs/zap_clusters.md +++ b/docs/zap_clusters.md @@ -113,6 +113,7 @@ Generally regenerate using one of: | 1070 | 0x42E | TotalVolatileOrganicCompoundsConcentrationMeasurement | | 1071 | 0x42F | RadonConcentrationMeasurement | | 1105 | 0x451 | WiFiNetworkManagement | +| 1107 | 0x453 | ThreadNetworkDirectory | | 1283 | 0x503 | WakeOnLan | | 1284 | 0x504 | Channel | | 1285 | 0x505 | TargetNavigator | diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml index 9686aa74eed0d0..f6db1481074e3b 100644 --- a/src/app/zap-templates/zcl/data-model/all.xml +++ b/src/app/zap-templates/zcl/data-model/all.xml @@ -94,6 +94,7 @@ + diff --git a/src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml new file mode 100644 index 00000000000000..f802b7ab4452c0 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + Network Infrastructure + Thread Network Directory + 0x0453 + THREAD_NETWORK_DIRECTORY_CLUSTER + Manages the names and credentials of Thread networks visible to the user. + + true + true + + + + + + PreferredExtendedPanID + + + + + ThreadNetworks + + + ThreadNetworkTableSize + + + Adds an entry to the ThreadNetworks list. + + + + + Removes an entry from the ThreadNetworks list. + + + + + Retrieves a Thread Operational Dataset from the ThreadNetworks list. + + + + + This is the response to a GetOperationalDataset request. + + + + + This event SHALL be generated when an entry in ThreadNetworks is added, removed, or had its Operational Dataset changed. + + + + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index f3aa6ef0b47f48..30c14436667202 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -116,6 +116,7 @@ "thermostat-cluster.xml", "thermostat-user-interface-configuration-cluster.xml", "thread-network-diagnostics-cluster.xml", + "thread-network-directory-cluster.xml", "time-format-localization-cluster.xml", "time-synchronization-cluster.xml", "timer-cluster.xml", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index d85f850b2c9483..33955572d795ec 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -114,6 +114,7 @@ "thermostat-cluster.xml", "thermostat-user-interface-configuration-cluster.xml", "thread-network-diagnostics-cluster.xml", + "thread-network-directory-cluster.xml", "time-format-localization-cluster.xml", "time-synchronization-cluster.xml", "timer-cluster.xml", diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index d86979f40adc9e..67083c04d3177d 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -289,6 +289,7 @@ "THREAD_NETWORK_DIAGNOSTICS_CLUSTER": [ "thread-network-diagnostics-server" ], + "THREAD_NETWORK_DIRECTORY_CLUSTER": [], "TIME_CLUSTER": [], "TIME_FORMAT_LOCALIZATION_CLUSTER": ["time-format-localization-server"], "TIME_SYNCHRONIZATION_CLUSTER": ["time-synchronization-server"], diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index e18d1cbe4a0193..ab2e0db009c888 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -7674,6 +7674,54 @@ cluster WiFiNetworkManagement = 1105 { command access(invoke: administer) NetworkPassphraseRequest(): NetworkPassphraseResponse = 0; } +/** Manages the names and credentials of Thread networks visible to the user. */ +cluster ThreadNetworkDirectory = 1107 { + revision 1; + + struct ThreadNetworkStruct { + int64u extendedPanID = 0; + char_string<16> networkName = 1; + int16u channel = 2; + } + + info event access(read: operate) NetworkChanged = 0 { + int64u extendedPanID = 0; + } + + attribute access(read: manage, write: manage) nullable int64u preferredExtendedPanID = 0; + readonly attribute access(read: operate) ThreadNetworkStruct threadNetworks[] = 1; + readonly attribute int8u threadNetworkTableSize = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AddNetworkRequest { + octet_string<254> operationalDataset = 0; + } + + request struct RemoveNetworkRequest { + int64u extendedPanID = 0; + } + + request struct GetOperationalDatasetRequest { + int64u extendedPanID = 0; + } + + response struct OperationalDatasetResponse = 3 { + octet_string<254> operationalDataset = 0; + } + + /** Adds an entry to the ThreadNetworks list. */ + timed command access(invoke: manage) AddNetwork(AddNetworkRequest): DefaultSuccess = 0; + /** Removes an entry from the ThreadNetworks list. */ + timed command access(invoke: manage) RemoveNetwork(RemoveNetworkRequest): DefaultSuccess = 1; + /** Retrieves a Thread Operational Dataset from the ThreadNetworks list. */ + timed command GetOperationalDataset(GetOperationalDatasetRequest): OperationalDatasetResponse = 2; +} + /** This cluster provides an interface for managing low power mode on a device that supports the Wake On LAN protocol. */ cluster WakeOnLan = 1283 { revision 1; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 7a6caeb9532993..7a16c3355daf4f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -53083,6 +53083,362 @@ public void onSuccess(byte[] tlv) { } } + public static class ThreadNetworkDirectoryCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1107L; + + private static final long PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID = 0L; + private static final long THREAD_NETWORKS_ATTRIBUTE_ID = 1L; + private static final long THREAD_NETWORK_TABLE_SIZE_ATTRIBUTE_ID = 2L; + private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; + private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; + private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public ThreadNetworkDirectoryCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + + public void addNetwork(DefaultClusterCallback callback, byte[] operationalDataset, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + final long operationalDatasetFieldID = 0L; + BaseTLVType operationalDatasettlvValue = new ByteArrayType(operationalDataset); + elements.add(new StructElement(operationalDatasetFieldID, operationalDatasettlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + + public void removeNetwork(DefaultClusterCallback callback, Long extendedPanID, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + final long extendedPanIDFieldID = 0L; + BaseTLVType extendedPanIDtlvValue = new UIntType(extendedPanID); + elements.add(new StructElement(extendedPanIDFieldID, extendedPanIDtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + + public void getOperationalDataset(OperationalDatasetResponseCallback callback, Long extendedPanID, int timedInvokeTimeoutMs) { + final long commandId = 2L; + + ArrayList elements = new ArrayList<>(); + final long extendedPanIDFieldID = 0L; + BaseTLVType extendedPanIDtlvValue = new UIntType(extendedPanID); + elements.add(new StructElement(extendedPanIDFieldID, extendedPanIDtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long operationalDatasetFieldID = 0L; + byte[] operationalDataset = null; + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == operationalDatasetFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + operationalDataset = castingValue.value(byte[].class); + } + } + } + callback.onSuccess(operationalDataset); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface OperationalDatasetResponseCallback extends BaseClusterCallback { + void onSuccess(byte[] operationalDataset); + } + + public interface PreferredExtendedPanIDAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface ThreadNetworksAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readPreferredExtendedPanIDAttribute( + PreferredExtendedPanIDAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, true); + } + + public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback, Long value) { + writePreferredExtendedPanIDAttribute(callback, value, 0); + } + + public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType(); + writeAttribute(new WriteAttributesCallbackImpl(callback), PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribePreferredExtendedPanIDAttribute( + PreferredExtendedPanIDAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readThreadNetworksAttribute( + ThreadNetworksAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, THREAD_NETWORKS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, THREAD_NETWORKS_ATTRIBUTE_ID, true); + } + + public void subscribeThreadNetworksAttribute( + ThreadNetworksAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, THREAD_NETWORKS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, THREAD_NETWORKS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readThreadNetworkTableSizeAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, THREAD_NETWORK_TABLE_SIZE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, THREAD_NETWORK_TABLE_SIZE_ATTRIBUTE_ID, true); + } + + public void subscribeThreadNetworkTableSizeAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, THREAD_NETWORK_TABLE_SIZE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, THREAD_NETWORK_TABLE_SIZE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + public static class WakeOnLanCluster extends BaseChipCluster { public static final long CLUSTER_ID = 1283L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index ce1a79c5a4a710..d25d80c3f791fc 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -5584,6 +5584,52 @@ public String toString() { return output.toString(); } } +public static class ThreadNetworkDirectoryClusterNetworkChangedEvent { + public Long extendedPanID; + private static final long EXTENDED_PAN_I_D_ID = 0L; + + public ThreadNetworkDirectoryClusterNetworkChangedEvent( + Long extendedPanID + ) { + this.extendedPanID = extendedPanID; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(EXTENDED_PAN_I_D_ID, new UIntType(extendedPanID))); + + return new StructType(values); + } + + public static ThreadNetworkDirectoryClusterNetworkChangedEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long extendedPanID = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == EXTENDED_PAN_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + extendedPanID = castingValue.value(Long.class); + } + } + } + return new ThreadNetworkDirectoryClusterNetworkChangedEvent( + extendedPanID + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ThreadNetworkDirectoryClusterNetworkChangedEvent {\n"); + output.append("\textendedPanID: "); + output.append(extendedPanID); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class TargetNavigatorClusterTargetUpdatedEvent { public ArrayList targetList; public Integer currentTarget; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 7730f05efe734a..c8d48cce340e23 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -9277,6 +9277,82 @@ public String toString() { return output.toString(); } } +public static class ThreadNetworkDirectoryClusterThreadNetworkStruct { + public Long extendedPanID; + public String networkName; + public Integer channel; + private static final long EXTENDED_PAN_I_D_ID = 0L; + private static final long NETWORK_NAME_ID = 1L; + private static final long CHANNEL_ID = 2L; + + public ThreadNetworkDirectoryClusterThreadNetworkStruct( + Long extendedPanID, + String networkName, + Integer channel + ) { + this.extendedPanID = extendedPanID; + this.networkName = networkName; + this.channel = channel; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(EXTENDED_PAN_I_D_ID, new UIntType(extendedPanID))); + values.add(new StructElement(NETWORK_NAME_ID, new StringType(networkName))); + values.add(new StructElement(CHANNEL_ID, new UIntType(channel))); + + return new StructType(values); + } + + public static ThreadNetworkDirectoryClusterThreadNetworkStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long extendedPanID = null; + String networkName = null; + Integer channel = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == EXTENDED_PAN_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + extendedPanID = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == NETWORK_NAME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + networkName = castingValue.value(String.class); + } + } else if (element.contextTagNum() == CHANNEL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + channel = castingValue.value(Integer.class); + } + } + } + return new ThreadNetworkDirectoryClusterThreadNetworkStruct( + extendedPanID, + networkName, + channel + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ThreadNetworkDirectoryClusterThreadNetworkStruct {\n"); + output.append("\textendedPanID: "); + output.append(extendedPanID); + output.append("\n"); + output.append("\tnetworkName: "); + output.append(networkName); + output.append("\n"); + output.append("\tchannel: "); + output.append(channel); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ChannelClusterProgramCastStruct { public String name; public String role; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 506d7386935c47..cd89fd9df6d472 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -331,6 +331,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == WiFiNetworkManagement.ID) { return new WiFiNetworkManagement(); } + if (clusterId == ThreadNetworkDirectory.ID) { + return new ThreadNetworkDirectory(); + } if (clusterId == WakeOnLan.ID) { return new WakeOnLan(); } @@ -14418,6 +14421,164 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class ThreadNetworkDirectory implements BaseCluster { + public static final long ID = 1107L; + public long getID() { + return ID; + } + + public enum Attribute { + PreferredExtendedPanID(0L), + ThreadNetworks(1L), + ThreadNetworkTableSize(2L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event { + NetworkChanged(0L),; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command { + AddNetwork(0L), + RemoveNetwork(1L), + GetOperationalDataset(2L),; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }public enum AddNetworkCommandField {OperationalDataset(0),; + private final int id; + AddNetworkCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static AddNetworkCommandField value(int id) throws NoSuchFieldError { + for (AddNetworkCommandField field : AddNetworkCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum RemoveNetworkCommandField {ExtendedPanID(0),; + private final int id; + RemoveNetworkCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static RemoveNetworkCommandField value(int id) throws NoSuchFieldError { + for (RemoveNetworkCommandField field : RemoveNetworkCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum GetOperationalDatasetCommandField {ExtendedPanID(0),; + private final int id; + GetOperationalDatasetCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static GetOperationalDatasetCommandField value(int id) throws NoSuchFieldError { + for (GetOperationalDatasetCommandField field : GetOperationalDatasetCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class WakeOnLan implements BaseCluster { public static final long ID = 1283L; public long getID() { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index d7c4134c812d9d..47ee02f5ede86c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -17426,6 +17426,154 @@ public void onError(Exception ex) { } } + + public static class DelegatedThreadNetworkDirectoryClusterOperationalDatasetResponseCallback implements ChipClusters.ThreadNetworkDirectoryCluster.OperationalDatasetResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(byte[] operationalDataset) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo operationalDatasetResponseValue = new CommandResponseInfo("operationalDataset", "byte[]"); + responseValues.put(operationalDatasetResponseValue, operationalDataset); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedThreadNetworkDirectoryClusterPreferredExtendedPanIDAttributeCallback implements ChipClusters.ThreadNetworkDirectoryCluster.PreferredExtendedPanIDAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedThreadNetworkDirectoryClusterThreadNetworksAttributeCallback implements ChipClusters.ThreadNetworkDirectoryCluster.ThreadNetworksAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedThreadNetworkDirectoryClusterGeneratedCommandListAttributeCallback implements ChipClusters.ThreadNetworkDirectoryCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedThreadNetworkDirectoryClusterAcceptedCommandListAttributeCallback implements ChipClusters.ThreadNetworkDirectoryCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedThreadNetworkDirectoryClusterEventListAttributeCallback implements ChipClusters.ThreadNetworkDirectoryCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedThreadNetworkDirectoryClusterAttributeListAttributeCallback implements ChipClusters.ThreadNetworkDirectoryCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedWakeOnLanClusterGeneratedCommandListAttributeCallback implements ChipClusters.WakeOnLanCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -21308,6 +21456,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.WiFiNetworkManagementCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("wiFiNetworkManagement", wiFiNetworkManagementClusterInfo); + ClusterInfo threadNetworkDirectoryClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.ThreadNetworkDirectoryCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("threadNetworkDirectory", threadNetworkDirectoryClusterInfo); + ClusterInfo wakeOnLanClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.WakeOnLanCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("wakeOnLan", wakeOnLanClusterInfo); @@ -21485,6 +21637,7 @@ public void combineCommand(Map destination, Map> getCommandMap() { commandMap.put("wiFiNetworkManagement", wiFiNetworkManagementClusterInteractionInfoMap); + Map threadNetworkDirectoryClusterInteractionInfoMap = new LinkedHashMap<>(); + + Map threadNetworkDirectoryaddNetworkCommandParams = new LinkedHashMap(); + + CommandParameterInfo threadNetworkDirectoryaddNetworkoperationalDatasetCommandParameterInfo = new CommandParameterInfo("operationalDataset", byte[].class, byte[].class); + threadNetworkDirectoryaddNetworkCommandParams.put("operationalDataset",threadNetworkDirectoryaddNetworkoperationalDatasetCommandParameterInfo); + InteractionInfo threadNetworkDirectoryaddNetworkInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster) + .addNetwork((DefaultClusterCallback) callback + , (byte[]) + commandArguments.get("operationalDataset"), 10000 + ); + }, + () -> new DelegatedDefaultClusterCallback(), + threadNetworkDirectoryaddNetworkCommandParams + ); + threadNetworkDirectoryClusterInteractionInfoMap.put("addNetwork", threadNetworkDirectoryaddNetworkInteractionInfo); + + Map threadNetworkDirectoryremoveNetworkCommandParams = new LinkedHashMap(); + + CommandParameterInfo threadNetworkDirectoryremoveNetworkextendedPanIDCommandParameterInfo = new CommandParameterInfo("extendedPanID", Long.class, Long.class); + threadNetworkDirectoryremoveNetworkCommandParams.put("extendedPanID",threadNetworkDirectoryremoveNetworkextendedPanIDCommandParameterInfo); + InteractionInfo threadNetworkDirectoryremoveNetworkInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster) + .removeNetwork((DefaultClusterCallback) callback + , (Long) + commandArguments.get("extendedPanID"), 10000 + ); + }, + () -> new DelegatedDefaultClusterCallback(), + threadNetworkDirectoryremoveNetworkCommandParams + ); + threadNetworkDirectoryClusterInteractionInfoMap.put("removeNetwork", threadNetworkDirectoryremoveNetworkInteractionInfo); + + Map threadNetworkDirectorygetOperationalDatasetCommandParams = new LinkedHashMap(); + + CommandParameterInfo threadNetworkDirectorygetOperationalDatasetextendedPanIDCommandParameterInfo = new CommandParameterInfo("extendedPanID", Long.class, Long.class); + threadNetworkDirectorygetOperationalDatasetCommandParams.put("extendedPanID",threadNetworkDirectorygetOperationalDatasetextendedPanIDCommandParameterInfo); + InteractionInfo threadNetworkDirectorygetOperationalDatasetInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster) + .getOperationalDataset((ChipClusters.ThreadNetworkDirectoryCluster.OperationalDatasetResponseCallback) callback + , (Long) + commandArguments.get("extendedPanID") + + , 10000); + }, + () -> new DelegatedThreadNetworkDirectoryClusterOperationalDatasetResponseCallback(), + threadNetworkDirectorygetOperationalDatasetCommandParams + ); + threadNetworkDirectoryClusterInteractionInfoMap.put("getOperationalDataset", threadNetworkDirectorygetOperationalDatasetInteractionInfo); + + commandMap.put("threadNetworkDirectory", threadNetworkDirectoryClusterInteractionInfoMap); + Map wakeOnLanClusterInteractionInfoMap = new LinkedHashMap<>(); commandMap.put("wakeOnLan", wakeOnLanClusterInteractionInfoMap); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index e75473bc0869b8..c607d8deca891a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -16610,6 +16610,109 @@ private static Map readWiFiNetworkManagementInteraction return result; } + private static Map readThreadNetworkDirectoryInteractionInfo() { + Map result = new LinkedHashMap<>();Map readThreadNetworkDirectoryPreferredExtendedPanIDCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryPreferredExtendedPanIDAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readPreferredExtendedPanIDAttribute( + (ChipClusters.ThreadNetworkDirectoryCluster.PreferredExtendedPanIDAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedThreadNetworkDirectoryClusterPreferredExtendedPanIDAttributeCallback(), + readThreadNetworkDirectoryPreferredExtendedPanIDCommandParams + ); + result.put("readPreferredExtendedPanIDAttribute", readThreadNetworkDirectoryPreferredExtendedPanIDAttributeInteractionInfo); + Map readThreadNetworkDirectoryThreadNetworksCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryThreadNetworksAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readThreadNetworksAttribute( + (ChipClusters.ThreadNetworkDirectoryCluster.ThreadNetworksAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedThreadNetworkDirectoryClusterThreadNetworksAttributeCallback(), + readThreadNetworkDirectoryThreadNetworksCommandParams + ); + result.put("readThreadNetworksAttribute", readThreadNetworkDirectoryThreadNetworksAttributeInteractionInfo); + Map readThreadNetworkDirectoryThreadNetworkTableSizeCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryThreadNetworkTableSizeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readThreadNetworkTableSizeAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readThreadNetworkDirectoryThreadNetworkTableSizeCommandParams + ); + result.put("readThreadNetworkTableSizeAttribute", readThreadNetworkDirectoryThreadNetworkTableSizeAttributeInteractionInfo); + Map readThreadNetworkDirectoryGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.ThreadNetworkDirectoryCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedThreadNetworkDirectoryClusterGeneratedCommandListAttributeCallback(), + readThreadNetworkDirectoryGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readThreadNetworkDirectoryGeneratedCommandListAttributeInteractionInfo); + Map readThreadNetworkDirectoryAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.ThreadNetworkDirectoryCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedThreadNetworkDirectoryClusterAcceptedCommandListAttributeCallback(), + readThreadNetworkDirectoryAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readThreadNetworkDirectoryAcceptedCommandListAttributeInteractionInfo); + Map readThreadNetworkDirectoryEventListCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readEventListAttribute( + (ChipClusters.ThreadNetworkDirectoryCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedThreadNetworkDirectoryClusterEventListAttributeCallback(), + readThreadNetworkDirectoryEventListCommandParams + ); + result.put("readEventListAttribute", readThreadNetworkDirectoryEventListAttributeInteractionInfo); + Map readThreadNetworkDirectoryAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readAttributeListAttribute( + (ChipClusters.ThreadNetworkDirectoryCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedThreadNetworkDirectoryClusterAttributeListAttributeCallback(), + readThreadNetworkDirectoryAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readThreadNetworkDirectoryAttributeListAttributeInteractionInfo); + Map readThreadNetworkDirectoryFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readThreadNetworkDirectoryFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readThreadNetworkDirectoryFeatureMapAttributeInteractionInfo); + Map readThreadNetworkDirectoryClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readThreadNetworkDirectoryClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readThreadNetworkDirectoryClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readThreadNetworkDirectoryClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readWakeOnLanInteractionInfo() { Map result = new LinkedHashMap<>();Map readWakeOnLanMACAddressCommandParams = new LinkedHashMap(); InteractionInfo readWakeOnLanMACAddressAttributeInteractionInfo = new InteractionInfo( @@ -20670,6 +20773,7 @@ public Map> getReadAttributeMap() { put("totalVolatileOrganicCompoundsConcentrationMeasurement", readTotalVolatileOrganicCompoundsConcentrationMeasurementInteractionInfo()); put("radonConcentrationMeasurement", readRadonConcentrationMeasurementInteractionInfo()); put("wiFiNetworkManagement", readWiFiNetworkManagementInteractionInfo()); + put("threadNetworkDirectory", readThreadNetworkDirectoryInteractionInfo()); put("wakeOnLan", readWakeOnLanInteractionInfo()); put("channel", readChannelInteractionInfo()); put("targetNavigator", readTargetNavigatorInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 93f3a7790eb8fa..61b492fde61abd 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -3638,6 +3638,30 @@ public Map> getWriteAttributeMap() { writeAttributeMap.put("radonConcentrationMeasurement", writeRadonConcentrationMeasurementInteractionInfo); Map writeWiFiNetworkManagementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("wiFiNetworkManagement", writeWiFiNetworkManagementInteractionInfo); + Map writeThreadNetworkDirectoryInteractionInfo = new LinkedHashMap<>(); + Map writeThreadNetworkDirectoryPreferredExtendedPanIDCommandParams = new LinkedHashMap(); + CommandParameterInfo threadNetworkDirectorypreferredExtendedPanIDCommandParameterInfo = + new CommandParameterInfo( + "value", + Long.class, + Long.class + ); + writeThreadNetworkDirectoryPreferredExtendedPanIDCommandParams.put( + "value", + threadNetworkDirectorypreferredExtendedPanIDCommandParameterInfo + ); + InteractionInfo writeThreadNetworkDirectoryPreferredExtendedPanIDAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).writePreferredExtendedPanIDAttribute( + (DefaultClusterCallback) callback, + (Long) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeThreadNetworkDirectoryPreferredExtendedPanIDCommandParams + ); + writeThreadNetworkDirectoryInteractionInfo.put("writePreferredExtendedPanIDAttribute", writeThreadNetworkDirectoryPreferredExtendedPanIDAttributeInteractionInfo); + writeAttributeMap.put("threadNetworkDirectory", writeThreadNetworkDirectoryInteractionInfo); Map writeWakeOnLanInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("wakeOnLan", writeWakeOnLanInteractionInfo); Map writeChannelInteractionInfo = new LinkedHashMap<>(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt new file mode 100644 index 00000000000000..df86cf8e4f6f47 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt @@ -0,0 +1,55 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.eventstructs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ThreadNetworkDirectoryClusterNetworkChangedEvent(val extendedPanID: ULong) { + override fun toString(): String = buildString { + append("ThreadNetworkDirectoryClusterNetworkChangedEvent {\n") + append("\textendedPanID : $extendedPanID\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) + endStructure() + } + } + + companion object { + private const val TAG_EXTENDED_PAN_I_D = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ThreadNetworkDirectoryClusterNetworkChangedEvent { + tlvReader.enterStructure(tlvTag) + val extendedPanID = tlvReader.getULong(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + + tlvReader.exitContainer() + + return ThreadNetworkDirectoryClusterNetworkChangedEvent(extendedPanID) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 34fd21bb27d770..4f8bcd19a75f60 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -127,6 +127,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterOperationalDatasetComponents.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterSecurityPolicy.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterDSTOffsetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTimeZoneStruct.kt", @@ -211,6 +212,7 @@ eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TargetNavigatorClusterTargetUpdatedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterConnectionStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterTimeZoneStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestDifferentVendorMeiEventEvent.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt new file mode 100644 index 00000000000000..ffc00a108110d7 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt @@ -0,0 +1,67 @@ +/* + * + * Copyright (c) 2023 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ThreadNetworkDirectoryClusterThreadNetworkStruct( + val extendedPanID: ULong, + val networkName: String, + val channel: UInt +) { + override fun toString(): String = buildString { + append("ThreadNetworkDirectoryClusterThreadNetworkStruct {\n") + append("\textendedPanID : $extendedPanID\n") + append("\tnetworkName : $networkName\n") + append("\tchannel : $channel\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) + put(ContextSpecificTag(TAG_NETWORK_NAME), networkName) + put(ContextSpecificTag(TAG_CHANNEL), channel) + endStructure() + } + } + + companion object { + private const val TAG_EXTENDED_PAN_I_D = 0 + private const val TAG_NETWORK_NAME = 1 + private const val TAG_CHANNEL = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ThreadNetworkDirectoryClusterThreadNetworkStruct { + tlvReader.enterStructure(tlvTag) + val extendedPanID = tlvReader.getULong(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + val networkName = tlvReader.getString(ContextSpecificTag(TAG_NETWORK_NAME)) + val channel = tlvReader.getUInt(ContextSpecificTag(TAG_CHANNEL)) + + tlvReader.exitContainer() + + return ThreadNetworkDirectoryClusterThreadNetworkStruct(extendedPanID, networkName, channel) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt new file mode 100644 index 00000000000000..8695d588b06d9b --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt @@ -0,0 +1,1074 @@ +/* + * + * Copyright (c) 2023 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. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UByteSubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.WriteRequest +import matter.controller.WriteRequests +import matter.controller.WriteResponse +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.controller.model.CommandPath +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ThreadNetworkDirectoryCluster( + private val controller: MatterController, + private val endpointId: UShort +) { + class OperationalDatasetResponse(val operationalDataset: ByteArray) + + class PreferredExtendedPanIDAttribute(val value: ULong?) + + sealed class PreferredExtendedPanIDAttributeSubscriptionState { + data class Success(val value: ULong?) : PreferredExtendedPanIDAttributeSubscriptionState() + + data class Error(val exception: Exception) : PreferredExtendedPanIDAttributeSubscriptionState() + + object SubscriptionEstablished : PreferredExtendedPanIDAttributeSubscriptionState() + } + + class ThreadNetworksAttribute(val value: List) + + sealed class ThreadNetworksAttributeSubscriptionState { + data class Success(val value: List) : + ThreadNetworksAttributeSubscriptionState() + + data class Error(val exception: Exception) : ThreadNetworksAttributeSubscriptionState() + + object SubscriptionEstablished : ThreadNetworksAttributeSubscriptionState() + } + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun addNetwork(operationalDataset: ByteArray, timedInvokeTimeout: Duration) { + val commandId: UInt = 0u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_OPERATIONAL_DATASET_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_OPERATIONAL_DATASET_REQ), operationalDataset) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun removeNetwork(extendedPanID: ULong, timedInvokeTimeout: Duration) { + val commandId: UInt = 1u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_EXTENDED_PAN_I_D_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D_REQ), extendedPanID) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun getOperationalDataset( + extendedPanID: ULong, + timedInvokeTimeout: Duration + ): OperationalDatasetResponse { + val commandId: UInt = 2u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_EXTENDED_PAN_I_D_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D_REQ), extendedPanID) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + + val tlvReader = TlvReader(response.payload) + tlvReader.enterStructure(AnonymousTag) + val TAG_OPERATIONAL_DATASET: Int = 0 + var operationalDataset_decoded: ByteArray? = null + + while (!tlvReader.isEndOfContainer()) { + val tag = tlvReader.peekElement().tag + + if (tag == ContextSpecificTag(TAG_OPERATIONAL_DATASET)) { + operationalDataset_decoded = tlvReader.getByteArray(tag) + } else { + tlvReader.skipElement() + } + } + + if (operationalDataset_decoded == null) { + throw IllegalStateException("operationalDataset not found in TLV") + } + + tlvReader.exitContainer() + + return OperationalDatasetResponse(operationalDataset_decoded) + } + + suspend fun readPreferredExtendedPanIDAttribute(): PreferredExtendedPanIDAttribute { + val ATTRIBUTE_ID: UInt = 0u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Preferredextendedpanid attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (!tlvReader.isNull()) { + tlvReader.getULong(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return PreferredExtendedPanIDAttribute(decodedValue) + } + + suspend fun writePreferredExtendedPanIDAttribute( + value: ULong, + timedWriteTimeout: Duration? = null + ) { + val ATTRIBUTE_ID: UInt = 0u + + val tlvWriter = TlvWriter() + tlvWriter.put(AnonymousTag, value) + + val writeRequests: WriteRequests = + WriteRequests( + requests = + listOf( + WriteRequest( + attributePath = + AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), + tlvPayload = tlvWriter.getEncoded() + ) + ), + timedRequest = timedWriteTimeout + ) + + val response: WriteResponse = controller.write(writeRequests) + + when (response) { + is WriteResponse.Success -> { + logger.log(Level.FINE, "Write command succeeded") + } + is WriteResponse.PartialWriteFailure -> { + val aggregatedErrorMessage = + response.failures.joinToString("\n") { failure -> + "Error at ${failure.attributePath}: ${failure.ex.message}" + } + + response.failures.forEach { failure -> + logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") + } + + throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") + } + } + } + + suspend fun subscribePreferredExtendedPanIDAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + PreferredExtendedPanIDAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Preferredextendedpanid attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (!tlvReader.isNull()) { + tlvReader.getULong(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(PreferredExtendedPanIDAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(PreferredExtendedPanIDAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readThreadNetworksAttribute(): ThreadNetworksAttribute { + val ATTRIBUTE_ID: UInt = 1u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Threadnetworks attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(ThreadNetworkDirectoryClusterThreadNetworkStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + return ThreadNetworksAttribute(decodedValue) + } + + suspend fun subscribeThreadNetworksAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ThreadNetworksAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Threadnetworks attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ThreadNetworkDirectoryClusterThreadNetworkStruct.fromTlv(AnonymousTag, tlvReader) + ) + } + tlvReader.exitContainer() + } + + emit(ThreadNetworksAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(ThreadNetworksAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readThreadNetworkTableSizeAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 2u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Threadnetworktablesize attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeThreadNetworkTableSizeAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 2u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UByteSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Threadnetworktablesize attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + emit(UByteSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + GeneratedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AcceptedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + EventListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AttributeListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(ThreadNetworkDirectoryCluster::class.java.name) + const val CLUSTER_ID: UInt = 1107u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt new file mode 100644 index 00000000000000..8200ee623c2362 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt @@ -0,0 +1,55 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.eventstructs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ThreadNetworkDirectoryClusterNetworkChangedEvent(val extendedPanID: ULong) { + override fun toString(): String = buildString { + append("ThreadNetworkDirectoryClusterNetworkChangedEvent {\n") + append("\textendedPanID : $extendedPanID\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) + endStructure() + } + } + + companion object { + private const val TAG_EXTENDED_PAN_I_D = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ThreadNetworkDirectoryClusterNetworkChangedEvent { + tlvReader.enterStructure(tlvTag) + val extendedPanID = tlvReader.getULong(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + + tlvReader.exitContainer() + + return ThreadNetworkDirectoryClusterNetworkChangedEvent(extendedPanID) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index e58b346b307ab7..f7670310f95cfd 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -127,6 +127,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDiagnosticsClusterOperationalDatasetComponents.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDiagnosticsClusterSecurityPolicy.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterDSTOffsetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterTimeZoneStruct.kt", @@ -211,6 +212,7 @@ matter_eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TargetNavigatorClusterTargetUpdatedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterConnectionStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TimeSynchronizationClusterTimeZoneStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/UnitTestingClusterTestDifferentVendorMeiEventEvent.kt", @@ -331,6 +333,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatUserInterfaceConfigurationCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDiagnosticsCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/TimeFormatLocalizationCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/TimerCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/TimeSynchronizationCluster.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt new file mode 100644 index 00000000000000..f7fb08d535fef5 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt @@ -0,0 +1,67 @@ +/* + * + * Copyright (c) 2023 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ThreadNetworkDirectoryClusterThreadNetworkStruct( + val extendedPanID: ULong, + val networkName: String, + val channel: UShort +) { + override fun toString(): String = buildString { + append("ThreadNetworkDirectoryClusterThreadNetworkStruct {\n") + append("\textendedPanID : $extendedPanID\n") + append("\tnetworkName : $networkName\n") + append("\tchannel : $channel\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) + put(ContextSpecificTag(TAG_NETWORK_NAME), networkName) + put(ContextSpecificTag(TAG_CHANNEL), channel) + endStructure() + } + } + + companion object { + private const val TAG_EXTENDED_PAN_I_D = 0 + private const val TAG_NETWORK_NAME = 1 + private const val TAG_CHANNEL = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ThreadNetworkDirectoryClusterThreadNetworkStruct { + tlvReader.enterStructure(tlvTag) + val extendedPanID = tlvReader.getULong(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + val networkName = tlvReader.getString(ContextSpecificTag(TAG_NETWORK_NAME)) + val channel = tlvReader.getUShort(ContextSpecificTag(TAG_CHANNEL)) + + tlvReader.exitContainer() + + return ThreadNetworkDirectoryClusterThreadNetworkStruct(extendedPanID, networkName, channel) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index ff10df38c79f9c..3b58043e65ee78 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -37320,6 +37320,247 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::ThreadNetworkDirectory::Id: { + using namespace app::Clusters::ThreadNetworkDirectory; + switch (aPath.mAttributeId) + { + case Attributes::PreferredExtendedPanID::Id: { + using TypeInfo = Attributes::PreferredExtendedPanID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::ThreadNetworks::Id: { + using TypeInfo = Attributes::ThreadNetworks::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_extendedPanID; + std::string newElement_0_extendedPanIDClassName = "java/lang/Long"; + std::string newElement_0_extendedPanIDCtorSignature = "(J)V"; + jlong jninewElement_0_extendedPanID = static_cast(entry_0.extendedPanID); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_extendedPanIDClassName.c_str(), newElement_0_extendedPanIDCtorSignature.c_str(), + jninewElement_0_extendedPanID, newElement_0_extendedPanID); + jobject newElement_0_networkName; + LogErrorOnFailure( + chip::JniReferences::GetInstance().CharToStringUTF(entry_0.networkName, newElement_0_networkName)); + jobject newElement_0_channel; + std::string newElement_0_channelClassName = "java/lang/Integer"; + std::string newElement_0_channelCtorSignature = "(I)V"; + jint jninewElement_0_channel = static_cast(entry_0.channel); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_channelClassName.c_str(), + newElement_0_channelCtorSignature.c_str(), + jninewElement_0_channel, newElement_0_channel); + + jclass threadNetworkStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ThreadNetworkDirectoryClusterThreadNetworkStruct", + threadNetworkStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ThreadNetworkDirectoryClusterThreadNetworkStruct"); + return nullptr; + } + + jmethodID threadNetworkStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod(env, threadNetworkStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/lang/String;Ljava/lang/Integer;)V", + &threadNetworkStructStructCtor_1); + if (err != CHIP_NO_ERROR || threadNetworkStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ThreadNetworkDirectoryClusterThreadNetworkStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(threadNetworkStructStructClass_1, threadNetworkStructStructCtor_1, + newElement_0_extendedPanID, newElement_0_networkName, newElement_0_channel); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::ThreadNetworkTableSize::Id: { + using TypeInfo = Attributes::ThreadNetworkTableSize::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::WakeOnLan::Id: { using namespace app::Clusters::WakeOnLan; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 7f210566b9aa37..ac55ed9125654e 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -7399,6 +7399,54 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::ThreadNetworkDirectory::Id: { + using namespace app::Clusters::ThreadNetworkDirectory; + switch (aPath.mEventId) + { + case Events::NetworkChanged::Id: { + Events::NetworkChanged::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_extendedPanID; + std::string value_extendedPanIDClassName = "java/lang/Long"; + std::string value_extendedPanIDCtorSignature = "(J)V"; + jlong jnivalue_extendedPanID = static_cast(cppValue.extendedPanID); + chip::JniReferences::GetInstance().CreateBoxedObject(value_extendedPanIDClassName.c_str(), + value_extendedPanIDCtorSignature.c_str(), + jnivalue_extendedPanID, value_extendedPanID); + + jclass networkChangedStructClass; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipEventStructs$ThreadNetworkDirectoryClusterNetworkChangedEvent", + networkChangedStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipEventStructs$ThreadNetworkDirectoryClusterNetworkChangedEvent"); + return nullptr; + } + + jmethodID networkChangedStructCtor; + err = chip::JniReferences::GetInstance().FindMethod(env, networkChangedStructClass, "", "(Ljava/lang/Long;)V", + &networkChangedStructCtor); + if (err != CHIP_NO_ERROR || networkChangedStructCtor == nullptr) + { + ChipLogError(Zcl, "Could not find ChipEventStructs$ThreadNetworkDirectoryClusterNetworkChangedEvent constructor"); + return nullptr; + } + + jobject value = env->NewObject(networkChangedStructClass, networkChangedStructCtor, value_extendedPanID); + + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::WakeOnLan::Id: { using namespace app::Clusters::WakeOnLan; switch (aPath.mEventId) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 6acd5596b06d50..24b35747203355 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -11591,6 +11591,90 @@ class ChipClusters: }, }, } + _THREAD_NETWORK_DIRECTORY_CLUSTER_INFO = { + "clusterName": "ThreadNetworkDirectory", + "clusterId": 0x00000453, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "AddNetwork", + "args": { + "operationalDataset": "bytes", + }, + }, + 0x00000001: { + "commandId": 0x00000001, + "commandName": "RemoveNetwork", + "args": { + "extendedPanID": "int", + }, + }, + 0x00000002: { + "commandId": 0x00000002, + "commandName": "GetOperationalDataset", + "args": { + "extendedPanID": "int", + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "PreferredExtendedPanID", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + "writable": True, + }, + 0x00000001: { + "attributeName": "ThreadNetworks", + "attributeId": 0x00000001, + "type": "", + "reportable": True, + }, + 0x00000002: { + "attributeName": "ThreadNetworkTableSize", + "attributeId": 0x00000002, + "type": "int", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFA: { + "attributeName": "EventList", + "attributeId": 0x0000FFFA, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _WAKE_ON_LAN_CLUSTER_INFO = { "clusterName": "WakeOnLan", "clusterId": 0x00000503, @@ -14695,6 +14779,7 @@ class ChipClusters: 0x0000042E: _TOTAL_VOLATILE_ORGANIC_COMPOUNDS_CONCENTRATION_MEASUREMENT_CLUSTER_INFO, 0x0000042F: _RADON_CONCENTRATION_MEASUREMENT_CLUSTER_INFO, 0x00000451: _WI_FI_NETWORK_MANAGEMENT_CLUSTER_INFO, + 0x00000453: _THREAD_NETWORK_DIRECTORY_CLUSTER_INFO, 0x00000503: _WAKE_ON_LAN_CLUSTER_INFO, 0x00000504: _CHANNEL_CLUSTER_INFO, 0x00000505: _TARGET_NAVIGATOR_CLUSTER_INFO, @@ -14817,6 +14902,7 @@ class ChipClusters: "TotalVolatileOrganicCompoundsConcentrationMeasurement": _TOTAL_VOLATILE_ORGANIC_COMPOUNDS_CONCENTRATION_MEASUREMENT_CLUSTER_INFO, "RadonConcentrationMeasurement": _RADON_CONCENTRATION_MEASUREMENT_CLUSTER_INFO, "WiFiNetworkManagement": _WI_FI_NETWORK_MANAGEMENT_CLUSTER_INFO, + "ThreadNetworkDirectory": _THREAD_NETWORK_DIRECTORY_CLUSTER_INFO, "WakeOnLan": _WAKE_ON_LAN_CLUSTER_INFO, "Channel": _CHANNEL_CLUSTER_INFO, "TargetNavigator": _TARGET_NAVIGATOR_CLUSTER_INFO, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index c2db68c0ecfd4c..527bc943019cbb 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -40399,6 +40399,294 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 +@dataclass +class ThreadNetworkDirectory(Cluster): + id: typing.ClassVar[int] = 0x00000453 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="preferredExtendedPanID", Tag=0x00000000, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="threadNetworks", Tag=0x00000001, Type=typing.List[ThreadNetworkDirectory.Structs.ThreadNetworkStruct]), + ClusterObjectFieldDescriptor(Label="threadNetworkTableSize", Tag=0x00000002, Type=uint), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + preferredExtendedPanID: 'typing.Union[Nullable, uint]' = None + threadNetworks: 'typing.List[ThreadNetworkDirectory.Structs.ThreadNetworkStruct]' = None + threadNetworkTableSize: 'uint' = None + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + eventList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Structs: + @dataclass + class ThreadNetworkStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="networkName", Tag=1, Type=str), + ClusterObjectFieldDescriptor(Label="channel", Tag=2, Type=uint), + ]) + + extendedPanID: 'uint' = 0 + networkName: 'str' = "" + channel: 'uint' = 0 + + class Commands: + @dataclass + class AddNetwork(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000453 + command_id: typing.ClassVar[int] = 0x00000000 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="operationalDataset", Tag=0, Type=bytes), + ]) + + @ChipUtility.classproperty + def must_use_timed_invoke(cls) -> bool: + return True + + operationalDataset: 'bytes' = b"" + + @dataclass + class RemoveNetwork(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000453 + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=uint), + ]) + + @ChipUtility.classproperty + def must_use_timed_invoke(cls) -> bool: + return True + + extendedPanID: 'uint' = 0 + + @dataclass + class GetOperationalDataset(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000453 + command_id: typing.ClassVar[int] = 0x00000002 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = 'OperationalDatasetResponse' + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=uint), + ]) + + @ChipUtility.classproperty + def must_use_timed_invoke(cls) -> bool: + return True + + extendedPanID: 'uint' = 0 + + @dataclass + class OperationalDatasetResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000453 + command_id: typing.ClassVar[int] = 0x00000003 + is_client: typing.ClassVar[bool] = False + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="operationalDataset", Tag=0, Type=bytes), + ]) + + operationalDataset: 'bytes' = b"" + + class Attributes: + @dataclass + class PreferredExtendedPanID(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + + value: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class ThreadNetworks(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[ThreadNetworkDirectory.Structs.ThreadNetworkStruct]) + + value: 'typing.List[ThreadNetworkDirectory.Structs.ThreadNetworkStruct]' = field(default_factory=lambda: []) + + @dataclass + class ThreadNetworkTableSize(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class EventList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFA + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + class Events: + @dataclass + class NetworkChanged(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000453 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=uint), + ]) + + extendedPanID: 'uint' = 0 + + @dataclass class WakeOnLan(Cluster): id: typing.ClassVar[int] = 0x00000503 diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 637f92de14f824..8a1e95b8911ebe 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -9690,4 +9690,5 @@ provisional: clusters: # Targeting Fall 2024 + - ThreadNetworkDirectory - WiFiNetworkManagement diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index a6ab1d6beee61c..d581289afd59f2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -5318,6 +5318,42 @@ static BOOL AttributeIsSpecifiedInWiFiNetworkManagementCluster(AttributeId aAttr } } } +static BOOL AttributeIsSpecifiedInThreadNetworkDirectoryCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ThreadNetworkDirectory; + switch (aAttributeId) { + case Attributes::PreferredExtendedPanID::Id: { + return YES; + } + case Attributes::ThreadNetworks::Id: { + return YES; + } + case Attributes::ThreadNetworkTableSize::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::EventList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL AttributeIsSpecifiedInWakeOnLANCluster(AttributeId aAttributeId) { using namespace Clusters::WakeOnLan; @@ -6837,6 +6873,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::WiFiNetworkManagement::Id: { return AttributeIsSpecifiedInWiFiNetworkManagementCluster(aAttributeId); } + case Clusters::ThreadNetworkDirectory::Id: { + return AttributeIsSpecifiedInThreadNetworkDirectoryCluster(aAttributeId); + } case Clusters::WakeOnLan::Id: { return AttributeIsSpecifiedInWakeOnLANCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index f5b2ca3d7dd743..9497069cb7e507 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -15246,6 +15246,78 @@ static id _Nullable DecodeAttributeValueForWiFiNetworkManagementCluster(Attribut *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForThreadNetworkDirectoryCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ThreadNetworkDirectory; + switch (aAttributeId) { + case Attributes::PreferredExtendedPanID::Id: { + using TypeInfo = Attributes::PreferredExtendedPanID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::ThreadNetworks::Id: { + using TypeInfo = Attributes::ThreadNetworks::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRThreadNetworkDirectoryClusterThreadNetworkStruct * newElement_0; + newElement_0 = [MTRThreadNetworkDirectoryClusterThreadNetworkStruct new]; + newElement_0.extendedPanID = [NSNumber numberWithUnsignedLongLong:entry_0.extendedPanID]; + newElement_0.networkName = AsString(entry_0.networkName); + if (newElement_0.networkName == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + newElement_0.channel = [NSNumber numberWithUnsignedShort:entry_0.channel]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ThreadNetworkTableSize::Id: { + using TypeInfo = Attributes::ThreadNetworkTableSize::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForWakeOnLANCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::WakeOnLan; @@ -19623,6 +19695,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::WiFiNetworkManagement::Id: { return DecodeAttributeValueForWiFiNetworkManagementCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::ThreadNetworkDirectory::Id: { + return DecodeAttributeValueForThreadNetworkDirectoryCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::WakeOnLan::Id: { return DecodeAttributeValueForWakeOnLANCluster(aPath.mAttributeId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index d5e7efa37f08bd..c5e73b22368081 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -13065,6 +13065,106 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Thread Network Directory + * + * Manages the names and credentials of Thread networks visible to the user. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterThreadNetworkDirectory : MTRGenericBaseCluster + +/** + * Command AddNetwork + * + * Adds an entry to the ThreadNetworks list. + */ +- (void)addNetworkWithParams:(MTRThreadNetworkDirectoryClusterAddNetworkParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command RemoveNetwork + * + * Removes an entry from the ThreadNetworks list. + */ +- (void)removeNetworkWithParams:(MTRThreadNetworkDirectoryClusterRemoveNetworkParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command GetOperationalDataset + * + * Retrieves a Thread Operational Dataset from the ThreadNetworks list. + */ +- (void)getOperationalDatasetWithParams:(MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams *)params completion:(void (^)(MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributePreferredExtendedPanIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributePreferredExtendedPanIDWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributePreferredExtendedPanIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeThreadNetworksWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeThreadNetworksWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeThreadNetworksWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeThreadNetworkTableSizeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeThreadNetworkTableSizeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeThreadNetworkTableSizeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterThreadNetworkDirectory (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Wake on LAN * diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 8155fed2e794f1..1df39709657551 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -93179,6 +93179,449 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end +@implementation MTRBaseClusterThreadNetworkDirectory + +- (void)addNetworkWithParams:(MTRThreadNetworkDirectoryClusterAddNetworkParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRThreadNetworkDirectoryClusterAddNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = ThreadNetworkDirectory::Commands::AddNetwork::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)removeNetworkWithParams:(MTRThreadNetworkDirectoryClusterRemoveNetworkParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRThreadNetworkDirectoryClusterRemoveNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = ThreadNetworkDirectory::Commands::RemoveNetwork::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)getOperationalDatasetWithParams:(MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams *)params completion:(void (^)(MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = ThreadNetworkDirectory::Commands::GetOperationalDataset::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)readAttributePreferredExtendedPanIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; +} +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedLongLongValue; + } + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributePreferredExtendedPanIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributePreferredExtendedPanIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeThreadNetworksWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ThreadNetworks::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeThreadNetworksWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ThreadNetworks::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeThreadNetworksWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ThreadNetworks::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeThreadNetworkTableSizeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeThreadNetworkTableSizeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeThreadNetworkTableSizeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::EventList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ThreadNetworkDirectory::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + @implementation MTRBaseClusterWakeOnLAN - (void)readAttributeMACAddressWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 0627e1d7937536..d609ce5c84179c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -185,6 +185,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeTotalVolatileOrganicCompoundsConcentrationMeasurementID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x0000042E, MTRClusterIDTypeRadonConcentrationMeasurementID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x0000042F, MTRClusterIDTypeWiFiNetworkManagementID MTR_PROVISIONALLY_AVAILABLE = 0x00000451, + MTRClusterIDTypeThreadNetworkDirectoryID MTR_PROVISIONALLY_AVAILABLE = 0x00000453, MTRClusterIDTypeWakeOnLANID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000503, MTRClusterIDTypeChannelID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000504, MTRClusterIDTypeTargetNavigatorID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000505, @@ -4371,6 +4372,17 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster ThreadNetworkDirectory attributes + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributePreferredExtendedPanIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeThreadNetworksID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeThreadNetworkTableSizeID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster WakeOnLan deprecated attribute names MTRClusterWakeOnLanAttributeMACAddressID MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterWakeOnLANAttributeMACAddressID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -6589,6 +6601,12 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterWiFiNetworkManagementCommandNetworkPassphraseRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRCommandIDTypeClusterWiFiNetworkManagementCommandNetworkPassphraseResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster ThreadNetworkDirectory commands + MTRCommandIDTypeClusterThreadNetworkDirectoryCommandAddNetworkID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRCommandIDTypeClusterThreadNetworkDirectoryCommandRemoveNetworkID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRCommandIDTypeClusterThreadNetworkDirectoryCommandGetOperationalDatasetID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRCommandIDTypeClusterThreadNetworkDirectoryCommandOperationalDatasetResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + // Cluster Channel deprecated command id names MTRClusterChannelCommandChangeChannelID MTR_DEPRECATED("Please use MTRCommandIDTypeClusterChannelCommandChangeChannelID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -7337,6 +7355,9 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { MTREventIDTypeClusterPumpConfigurationAndControlEventAirDetectionID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000000F, MTREventIDTypeClusterPumpConfigurationAndControlEventTurbineOperationID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000010, + // Cluster ThreadNetworkDirectory events + MTREventIDTypeClusterThreadNetworkDirectoryEventNetworkChangedID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + // Cluster TargetNavigator deprecated event names // Cluster TargetNavigator events diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 7b8402cabc2fda..2306fdd1c7d92d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -321,6 +321,9 @@ case MTRClusterIDTypeWiFiNetworkManagementID: result = @"WiFiNetworkManagement"; break; + case MTRClusterIDTypeThreadNetworkDirectoryID: + result = @"ThreadNetworkDirectory"; + break; case MTRClusterIDTypeWakeOnLANID: result = @"WakeOnLAN"; break; @@ -7253,6 +7256,52 @@ break; } + case MTRClusterIDTypeThreadNetworkDirectoryID: + + switch (attributeID) { + + // Cluster ThreadNetworkDirectory attributes + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributePreferredExtendedPanIDID: + result = @"PreferredExtendedPanID"; + break; + + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeThreadNetworksID: + result = @"ThreadNetworks"; + break; + + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeThreadNetworkTableSizeID: + result = @"ThreadNetworkTableSize"; + break; + + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeEventListID: + result = @"EventList"; + break; + + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + case MTRClusterIDTypeWakeOnLANID: switch (attributeID) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 34d469730f1c94..29249e35e5a360 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -6035,6 +6035,54 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Thread Network Directory + * Manages the names and credentials of Thread networks visible to the user. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterThreadNetworkDirectory : MTRGenericCluster + +- (void)addNetworkWithParams:(MTRThreadNetworkDirectoryClusterAddNetworkParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)removeNetworkWithParams:(MTRThreadNetworkDirectoryClusterRemoveNetworkParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getOperationalDatasetWithParams:(MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributePreferredExtendedPanIDWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeThreadNetworksWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeThreadNetworkTableSizeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterThreadNetworkDirectory (Availability) + +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Wake on LAN * This cluster provides an interface for managing low power mode on a device that supports the Wake On LAN protocol. diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 2605a37007449c..c950d5e4f0f1b8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -16838,6 +16838,156 @@ - (void)networkPassphraseRequestWithParams:(MTRWiFiNetworkManagementClusterNetwo @end +@implementation MTRClusterThreadNetworkDirectory + +- (void)addNetworkWithParams:(MTRThreadNetworkDirectoryClusterAddNetworkParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRThreadNetworkDirectoryClusterAddNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = ThreadNetworkDirectory::Commands::AddNetwork::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)removeNetworkWithParams:(MTRThreadNetworkDirectoryClusterRemoveNetworkParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRThreadNetworkDirectoryClusterRemoveNetworkParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = ThreadNetworkDirectory::Commands::RemoveNetwork::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)getOperationalDatasetWithParams:(MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = ThreadNetworkDirectory::Commands::GetOperationalDataset::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + +- (NSDictionary * _Nullable)readAttributePreferredExtendedPanIDWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributePreferredExtendedPanIDID) params:params]; +} + +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributePreferredExtendedPanIDWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributePreferredExtendedPanIDID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + +- (NSDictionary * _Nullable)readAttributeThreadNetworksWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeThreadNetworksID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeThreadNetworkTableSizeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeThreadNetworkTableSizeID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThreadNetworkDirectoryID) attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDirectoryAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterWakeOnLAN - (NSDictionary * _Nullable)readAttributeMACAddressWithParams:(MTRReadParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index cfd06dee343cc0..0017193f50a673 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -8559,6 +8559,115 @@ MTR_PROVISIONALLY_AVAILABLE error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRThreadNetworkDirectoryClusterAddNetworkParams : NSObject + +@property (nonatomic, copy) NSData * _Nonnull operationalDataset MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRThreadNetworkDirectoryClusterRemoveNetworkParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams : NSObject + +@property (nonatomic, copy) NSData * _Nonnull operationalDataset MTR_PROVISIONALLY_AVAILABLE; + +/** + * Initialize an MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams with a response-value dictionary + * of the sort that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * a command data response or is not the right command response. + * + * Will return nil and hand out an error if the data response does not match the known + * schema for this command. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRChannelClusterChangeChannelParams : NSObject diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index af9752c200df41..689b7382ab3fb5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -24120,6 +24120,322 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::WiFiNetw @end +@implementation MTRThreadNetworkDirectoryClusterAddNetworkParams +- (instancetype)init +{ + if (self = [super init]) { + + _operationalDataset = [NSData data]; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRThreadNetworkDirectoryClusterAddNetworkParams alloc] init]; + + other.operationalDataset = self.operationalDataset; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: operationalDataset:%@; >", NSStringFromClass([self class]), [_operationalDataset base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + +@implementation MTRThreadNetworkDirectoryClusterAddNetworkParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.operationalDataset = AsByteSpan(self.operationalDataset); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRThreadNetworkDirectoryClusterRemoveNetworkParams +- (instancetype)init +{ + if (self = [super init]) { + + _extendedPanID = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRThreadNetworkDirectoryClusterRemoveNetworkParams alloc] init]; + + other.extendedPanID = self.extendedPanID; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; >", NSStringFromClass([self class]), _extendedPanID]; + return descriptionString; +} + +@end + +@implementation MTRThreadNetworkDirectoryClusterRemoveNetworkParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.extendedPanID = self.extendedPanID.unsignedLongLongValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams +- (instancetype)init +{ + if (self = [super init]) { + + _extendedPanID = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams alloc] init]; + + other.extendedPanID = self.extendedPanID; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; >", NSStringFromClass([self class]), _extendedPanID]; + return descriptionString; +} + +@end + +@implementation MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.extendedPanID = self.extendedPanID.unsignedLongLongValue; + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams +- (instancetype)init +{ + if (self = [super init]) { + + _operationalDataset = [NSData data]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams alloc] init]; + + other.operationalDataset = self.operationalDataset; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: operationalDataset:%@; >", NSStringFromClass([self class]), [_operationalDataset base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error +{ + if (!(self = [super init])) { + return nil; + } + + using DecodableType = chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::DecodableType; + chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue + clusterID:DecodableType::GetClusterId() + commandID:DecodableType::GetCommandId() + error:error]; + if (buffer.IsNull()) { + return nil; + } + + chip::TLV::TLVReader reader; + reader.Init(buffer->Start(), buffer->DataLength()); + + CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); + if (err == CHIP_NO_ERROR) { + DecodableType decodedStruct; + err = chip::app::DataModel::Decode(reader, decodedStruct); + if (err == CHIP_NO_ERROR) { + err = [self _setFieldsFromDecodableStruct:decodedStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + } + } + + NSString * errorStr = [NSString stringWithFormat:@"Command payload decoding failed: %s", err.AsString()]; + MTR_LOG_ERROR("%s", errorStr.UTF8String); + if (error != nil) { + NSDictionary * userInfo = @{ NSLocalizedFailureReasonErrorKey : NSLocalizedString(errorStr, nil) }; + *error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:userInfo]; + } + return nil; +} + +@end + +@implementation MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::DecodableType &)decodableStruct +{ + { + self.operationalDataset = AsData(decodableStruct.operationalDataset); + } + return CHIP_NO_ERROR; +} + +@end + @implementation MTRChannelClusterChangeChannelParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index 2b629efdc5a24d..5794e71a896729 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -1582,6 +1582,30 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRThreadNetworkDirectoryClusterAddNetworkParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRThreadNetworkDirectoryClusterRemoveNetworkParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::DecodableType &)decodableStruct; + +@end + @interface MTRChannelClusterChangeChannelParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index 0ea5a38336bb2a..ee4d2c1386bff0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm @@ -965,6 +965,24 @@ static BOOL CommandNeedsTimedInvokeInWiFiNetworkManagementCluster(AttributeId aA } } } +static BOOL CommandNeedsTimedInvokeInThreadNetworkDirectoryCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ThreadNetworkDirectory; + switch (aAttributeId) { + case Commands::AddNetwork::Id: { + return YES; + } + case Commands::RemoveNetwork::Id: { + return YES; + } + case Commands::GetOperationalDataset::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInWakeOnLANCluster(AttributeId aAttributeId) { using namespace Clusters::WakeOnLan; @@ -1431,6 +1449,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::WiFiNetworkManagement::Id: { return CommandNeedsTimedInvokeInWiFiNetworkManagementCluster(commandID); } + case Clusters::ThreadNetworkDirectory::Id: { + return CommandNeedsTimedInvokeInThreadNetworkDirectoryCluster(commandID); + } case Clusters::WakeOnLan::Id: { return CommandNeedsTimedInvokeInWakeOnLANCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 9fc3cd16b8235a..69c23e1451e9b7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -4047,6 +4047,35 @@ static id _Nullable DecodeEventPayloadForWiFiNetworkManagementCluster(EventId aE *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForThreadNetworkDirectoryCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ThreadNetworkDirectory; + switch (aEventId) { + case Events::NetworkChanged::Id: { + Events::NetworkChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRThreadNetworkDirectoryClusterNetworkChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.extendedPanID]; + value.extendedPanID = memberValue; + } while (0); + + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForWakeOnLANCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::WakeOnLan; @@ -4851,6 +4880,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::WiFiNetworkManagement::Id: { return DecodeEventPayloadForWiFiNetworkManagementCluster(aPath.mEventId, aReader, aError); } + case Clusters::ThreadNetworkDirectory::Id: { + return DecodeEventPayloadForThreadNetworkDirectoryCluster(aPath.mEventId, aReader, aError); + } case Clusters::WakeOnLan::Id: { return DecodeEventPayloadForWakeOnLANCluster(aPath.mEventId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 92bd095b954393..e4d9eb08566a50 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1637,6 +1637,18 @@ MTR_DEPRECATED("Please use MTRThermostatClusterWeeklyScheduleTransitionStruct", @property (nonatomic, copy) NSNumber * _Nullable coolSetpoint MTR_DEPRECATED("Please use MTRThermostatClusterWeeklyScheduleTransitionStruct", ios(16.1, 17.4), macos(13.0, 14.4), watchos(9.1, 10.4), tvos(16.1, 17.4)); @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRThreadNetworkDirectoryClusterThreadNetworkStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSString * _Nonnull networkName MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull channel MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRThreadNetworkDirectoryClusterNetworkChangedEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRChannelClusterProgramCastStruct : NSObject @property (nonatomic, copy) NSString * _Nonnull name MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index c9c38c72710756..30c3531c6d7668 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6884,6 +6884,66 @@ @implementation MTRThermostatClusterThermostatScheduleTransition : MTRThermostat @dynamic coolSetpoint; @end +@implementation MTRThreadNetworkDirectoryClusterThreadNetworkStruct +- (instancetype)init +{ + if (self = [super init]) { + + _extendedPanID = @(0); + + _networkName = @""; + + _channel = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRThreadNetworkDirectoryClusterThreadNetworkStruct alloc] init]; + + other.extendedPanID = self.extendedPanID; + other.networkName = self.networkName; + other.channel = self.channel; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; networkName:%@; channel:%@; >", NSStringFromClass([self class]), _extendedPanID, _networkName, _channel]; + return descriptionString; +} + +@end + +@implementation MTRThreadNetworkDirectoryClusterNetworkChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _extendedPanID = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRThreadNetworkDirectoryClusterNetworkChangedEvent alloc] init]; + + other.extendedPanID = self.extendedPanID; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; >", NSStringFromClass([self class]), _extendedPanID]; + return descriptionString; +} + +@end + @implementation MTRChannelClusterProgramCastStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 78448839fc5e93..84233e5ad954d4 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -34669,6 +34669,242 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace Attributes } // namespace WiFiNetworkManagement +namespace ThreadNetworkDirectory { +namespace Attributes { + +namespace PreferredExtendedPanID { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE, + markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE, + markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace PreferredExtendedPanID + +namespace ThreadNetworkTableSize { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +} // namespace ThreadNetworkTableSize + +namespace FeatureMap { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, + markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace FeatureMap + +namespace ClusterRevision { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, + markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ThreadNetworkDirectory + namespace WakeOnLan { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index d7c5c77d861bd0..7ebe0abeca5474 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -5334,6 +5334,41 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace Attributes } // namespace WiFiNetworkManagement +namespace ThreadNetworkDirectory { +namespace Attributes { + +namespace PreferredExtendedPanID { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int64u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace PreferredExtendedPanID + +namespace ThreadNetworkTableSize { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // int8u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +} // namespace ThreadNetworkTableSize + +namespace FeatureMap { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace FeatureMap + +namespace ClusterRevision { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ThreadNetworkDirectory + namespace WakeOnLan { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index a3a86e3b222917..e260c824886cd6 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -538,6 +538,11 @@ void emberAfRadonConcentrationMeasurementClusterInitCallback(chip::EndpointId en */ void emberAfWiFiNetworkManagementClusterInitCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfThreadNetworkDirectoryClusterInitCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -4531,6 +4536,44 @@ chip::Protocols::InteractionModel::Status MatterWiFiNetworkManagementClusterServ */ void emberAfWiFiNetworkManagementClusterServerTickCallback(chip::EndpointId endpoint); +// +// Thread Network Directory Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfThreadNetworkDirectoryClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterThreadNetworkDirectoryClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfThreadNetworkDirectoryClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterThreadNetworkDirectoryClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterThreadNetworkDirectoryClusterServerPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfThreadNetworkDirectoryClusterServerTickCallback(chip::EndpointId endpoint); + // // Wake on LAN Cluster // @@ -6158,6 +6201,24 @@ bool emberAfColorControlClusterMoveColorTemperatureCallback( bool emberAfColorControlClusterStepColorTemperatureCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ColorControl::Commands::StepColorTemperature::DecodableType & commandData); +/** + * @brief Thread Network Directory Cluster AddNetwork Command callback (from client) + */ +bool emberAfThreadNetworkDirectoryClusterAddNetworkCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::DecodableType & commandData); +/** + * @brief Thread Network Directory Cluster RemoveNetwork Command callback (from client) + */ +bool emberAfThreadNetworkDirectoryClusterRemoveNetworkCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::DecodableType & commandData); +/** + * @brief Thread Network Directory Cluster GetOperationalDataset Command callback (from client) + */ +bool emberAfThreadNetworkDirectoryClusterGetOperationalDatasetCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::DecodableType & commandData); /** * @brief Channel Cluster ChangeChannel Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index bad7df9b4b8fa8..df8ddd16ba31e3 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -4311,6 +4311,8 @@ enum class Feature : uint32_t namespace WiFiNetworkManagement {} // namespace WiFiNetworkManagement +namespace ThreadNetworkDirectory {} // namespace ThreadNetworkDirectory + namespace WakeOnLan {} // namespace WakeOnLan namespace Channel { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 3e72137d33179a..0e3ec1d0347e1f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -22952,6 +22952,263 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre namespace Events {} // namespace Events } // namespace WiFiNetworkManagement +namespace ThreadNetworkDirectory { +namespace Structs { + +namespace ThreadNetworkStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kExtendedPanID), extendedPanID); + encoder.Encode(to_underlying(Fields::kNetworkName), networkName); + encoder.Encode(to_underlying(Fields::kChannel), channel); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kExtendedPanID)) + { + err = DataModel::Decode(reader, extendedPanID); + } + else if (__context_tag == to_underlying(Fields::kNetworkName)) + { + err = DataModel::Decode(reader, networkName); + } + else if (__context_tag == to_underlying(Fields::kChannel)) + { + err = DataModel::Decode(reader, channel); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace ThreadNetworkStruct +} // namespace Structs + +namespace Commands { +namespace AddNetwork { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kOperationalDataset), operationalDataset); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOperationalDataset)) + { + err = DataModel::Decode(reader, operationalDataset); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace AddNetwork. +namespace RemoveNetwork { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kExtendedPanID), extendedPanID); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kExtendedPanID)) + { + err = DataModel::Decode(reader, extendedPanID); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace RemoveNetwork. +namespace GetOperationalDataset { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kExtendedPanID), extendedPanID); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kExtendedPanID)) + { + err = DataModel::Decode(reader, extendedPanID); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace GetOperationalDataset. +namespace OperationalDatasetResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kOperationalDataset), operationalDataset); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOperationalDataset)) + { + err = DataModel::Decode(reader, operationalDataset); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace OperationalDatasetResponse. +} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::PreferredExtendedPanID::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, preferredExtendedPanID); + case Attributes::ThreadNetworks::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, threadNetworks); + case Attributes::ThreadNetworkTableSize::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, threadNetworkTableSize); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::EventList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes + +namespace Events { +namespace NetworkChanged { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kExtendedPanID), extendedPanID)); + return aWriter.EndContainer(outer); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kExtendedPanID)) + { + err = DataModel::Decode(reader, extendedPanID); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace NetworkChanged. +} // namespace Events + +} // namespace ThreadNetworkDirectory namespace WakeOnLan { namespace Commands {} // namespace Commands @@ -29976,6 +30233,17 @@ bool CommandNeedsTimedInvoke(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::ThreadNetworkDirectory::Id: { + switch (aCommand) + { + case Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Id: + case Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Id: + case Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Id: + return true; + default: + return false; + } + } case Clusters::AccountLogin::Id: { switch (aCommand) { @@ -30439,6 +30707,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::ThreadNetworkDirectory::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::Channel::Id: { switch (aCommand) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 9dbcdfe8dcad68..65450ac4489324 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -34997,6 +34997,324 @@ struct TypeInfo }; } // namespace Attributes } // namespace WiFiNetworkManagement +namespace ThreadNetworkDirectory { +namespace Structs { +namespace ThreadNetworkStruct { +enum class Fields : uint8_t +{ + kExtendedPanID = 0, + kNetworkName = 1, + kChannel = 2, +}; + +struct Type +{ +public: + uint64_t extendedPanID = static_cast(0); + chip::CharSpan networkName; + uint16_t channel = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace ThreadNetworkStruct +} // namespace Structs + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace AddNetwork { +struct Type; +struct DecodableType; +} // namespace AddNetwork + +namespace RemoveNetwork { +struct Type; +struct DecodableType; +} // namespace RemoveNetwork + +namespace GetOperationalDataset { +struct Type; +struct DecodableType; +} // namespace GetOperationalDataset + +namespace OperationalDatasetResponse { +struct Type; +struct DecodableType; +} // namespace OperationalDatasetResponse + +} // namespace Commands + +namespace Commands { +namespace AddNetwork { +enum class Fields : uint8_t +{ + kOperationalDataset = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::AddNetwork::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + chip::ByteSpan operationalDataset; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return true; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::AddNetwork::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + chip::ByteSpan operationalDataset; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace AddNetwork +namespace RemoveNetwork { +enum class Fields : uint8_t +{ + kExtendedPanID = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::RemoveNetwork::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + uint64_t extendedPanID = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return true; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::RemoveNetwork::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + uint64_t extendedPanID = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace RemoveNetwork +namespace GetOperationalDataset { +enum class Fields : uint8_t +{ + kExtendedPanID = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::GetOperationalDataset::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + uint64_t extendedPanID = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return true; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::GetOperationalDataset::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + uint64_t extendedPanID = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace GetOperationalDataset +namespace OperationalDatasetResponse { +enum class Fields : uint8_t +{ + kOperationalDataset = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::OperationalDatasetResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + chip::ByteSpan operationalDataset; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::OperationalDatasetResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + chip::ByteSpan operationalDataset; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace OperationalDatasetResponse +} // namespace Commands + +namespace Attributes { + +namespace PreferredExtendedPanID { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::PreferredExtendedPanID::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace PreferredExtendedPanID +namespace ThreadNetworks { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ThreadNetworks::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ThreadNetworks +namespace ThreadNetworkTableSize { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ThreadNetworkTableSize::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ThreadNetworkTableSize +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::PreferredExtendedPanID::TypeInfo::DecodableType preferredExtendedPanID; + Attributes::ThreadNetworks::TypeInfo::DecodableType threadNetworks; + Attributes::ThreadNetworkTableSize::TypeInfo::DecodableType threadNetworkTableSize = static_cast(0); + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::EventList::TypeInfo::DecodableType eventList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +namespace Events { +namespace NetworkChanged { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kExtendedPanID = 0, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::NetworkChanged::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + static constexpr bool kIsFabricScoped = false; + + uint64_t extendedPanID = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::NetworkChanged::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } + + uint64_t extendedPanID = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace NetworkChanged +} // namespace Events +} // namespace ThreadNetworkDirectory namespace WakeOnLan { namespace Attributes { 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 b67160ef01706d..9f676664b5e5fb 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 @@ -6617,6 +6617,48 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace WiFiNetworkManagement +namespace ThreadNetworkDirectory { +namespace Attributes { + +namespace PreferredExtendedPanID { +static constexpr AttributeId Id = 0x00000000; +} // namespace PreferredExtendedPanID + +namespace ThreadNetworks { +static constexpr AttributeId Id = 0x00000001; +} // namespace ThreadNetworks + +namespace ThreadNetworkTableSize { +static constexpr AttributeId Id = 0x00000002; +} // namespace ThreadNetworkTableSize + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace EventList { +static constexpr AttributeId Id = Globals::Attributes::EventList::Id; +} // namespace EventList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ThreadNetworkDirectory + namespace WakeOnLan { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h index 1f790f889726f2..b85aded17ec764 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h @@ -328,6 +328,9 @@ static constexpr ClusterId Id = 0x0000042F; namespace WiFiNetworkManagement { static constexpr ClusterId Id = 0x00000451; } // namespace WiFiNetworkManagement +namespace ThreadNetworkDirectory { +static constexpr ClusterId Id = 0x00000453; +} // namespace ThreadNetworkDirectory namespace WakeOnLan { static constexpr ClusterId Id = 0x00000503; } // namespace WakeOnLan diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index d7ba0b240864fb..27de98be5e9dee 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -1395,6 +1395,28 @@ static constexpr CommandId Id = 0x00000001; } // namespace Commands } // namespace WiFiNetworkManagement +namespace ThreadNetworkDirectory { +namespace Commands { + +namespace AddNetwork { +static constexpr CommandId Id = 0x00000000; +} // namespace AddNetwork + +namespace RemoveNetwork { +static constexpr CommandId Id = 0x00000001; +} // namespace RemoveNetwork + +namespace GetOperationalDataset { +static constexpr CommandId Id = 0x00000002; +} // namespace GetOperationalDataset + +namespace OperationalDatasetResponse { +static constexpr CommandId Id = 0x00000003; +} // namespace OperationalDatasetResponse + +} // namespace Commands +} // namespace ThreadNetworkDirectory + namespace Channel { namespace Commands { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h index 28e5799188e843..1592020a008379 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h @@ -611,6 +611,16 @@ static constexpr EventId Id = 0x00000010; } // namespace Events } // namespace PumpConfigurationAndControl +namespace ThreadNetworkDirectory { +namespace Events { + +namespace NetworkChanged { +static constexpr EventId Id = 0x00000000; +} // namespace NetworkChanged + +} // namespace Events +} // namespace ThreadNetworkDirectory + namespace TargetNavigator { namespace Events { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 012407529d1369..6552c1be593c49 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -136,6 +136,7 @@ | TotalVolatileOrganicCompoundsConcentrationMeasurement | 0x042E | | RadonConcentrationMeasurement | 0x042F | | WiFiNetworkManagement | 0x0451 | +| ThreadNetworkDirectory | 0x0453 | | WakeOnLan | 0x0503 | | Channel | 0x0504 | | TargetNavigator | 0x0505 | @@ -11073,6 +11074,143 @@ class WiFiNetworkManagementNetworkPassphraseRequest : public ClusterCommand chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseRequest::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster ThreadNetworkDirectory | 0x0453 | +|------------------------------------------------------------------------------| +| Commands: | | +| * AddNetwork | 0x00 | +| * RemoveNetwork | 0x01 | +| * GetOperationalDataset | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * PreferredExtendedPanID | 0x0000 | +| * ThreadNetworks | 0x0001 | +| * ThreadNetworkTableSize | 0x0002 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * NetworkChanged | 0x0000 | +\*----------------------------------------------------------------------------*/ + +/* + * Command AddNetwork + */ +class ThreadNetworkDirectoryAddNetwork : public ClusterCommand +{ +public: + ThreadNetworkDirectoryAddNetwork(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("add-network", credsIssuerConfig) + { + AddArgument("OperationalDataset", &mRequest.operationalDataset); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Type mRequest; +}; + +/* + * Command RemoveNetwork + */ +class ThreadNetworkDirectoryRemoveNetwork : public ClusterCommand +{ +public: + ThreadNetworkDirectoryRemoveNetwork(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("remove-network", credsIssuerConfig) + { + AddArgument("ExtendedPanID", 0, UINT64_MAX, &mRequest.extendedPanID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Type mRequest; +}; + +/* + * Command GetOperationalDataset + */ +class ThreadNetworkDirectoryGetOperationalDataset : public ClusterCommand +{ +public: + ThreadNetworkDirectoryGetOperationalDataset(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("get-operational-dataset", credsIssuerConfig) + { + AddArgument("ExtendedPanID", 0, UINT64_MAX, &mRequest.extendedPanID); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster WakeOnLan | 0x0503 | |------------------------------------------------------------------------------| @@ -24619,6 +24757,78 @@ void registerClusterWiFiNetworkManagement(Commands & commands, CredentialIssuerC commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterThreadNetworkDirectory(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::ThreadNetworkDirectory; + + const char * clusterName = "ThreadNetworkDirectory"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "preferred-extended-pan-id", Attributes::PreferredExtendedPanID::Id, credsIssuerConfig), // + make_unique(Id, "thread-networks", Attributes::ThreadNetworks::Id, credsIssuerConfig), // + make_unique(Id, "thread-network-table-size", Attributes::ThreadNetworkTableSize::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>(Id, "preferred-extended-pan-id", 0, UINT64_MAX, + Attributes::PreferredExtendedPanID::Id, + WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>>( + Id, "thread-networks", Attributes::ThreadNetworks::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "thread-network-table-size", 0, UINT8_MAX, Attributes::ThreadNetworkTableSize::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-list", Attributes::EventList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "preferred-extended-pan-id", Attributes::PreferredExtendedPanID::Id, + credsIssuerConfig), // + make_unique(Id, "thread-networks", Attributes::ThreadNetworks::Id, credsIssuerConfig), // + make_unique(Id, "thread-network-table-size", Attributes::ThreadNetworkTableSize::Id, + credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "network-changed", Events::NetworkChanged::Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "network-changed", Events::NetworkChanged::Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterWakeOnLan(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::WakeOnLan; @@ -26974,6 +27184,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterTotalVolatileOrganicCompoundsConcentrationMeasurement(commands, credsIssuerConfig); registerClusterRadonConcentrationMeasurement(commands, credsIssuerConfig); registerClusterWiFiNetworkManagement(commands, credsIssuerConfig); + registerClusterThreadNetworkDirectory(commands, credsIssuerConfig); registerClusterWakeOnLan(commands, credsIssuerConfig); registerClusterChannel(commands, credsIssuerConfig); registerClusterTargetNavigator(commands, credsIssuerConfig); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 89f34d0cee3714..661735e8d0cffc 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3986,6 +3986,45 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::Thermostat::Structs::W ComplexArgumentParser::Finalize(request.coolSetpoint); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadNetworkStruct.extendedPanID", "extendedPanID", + value.isMember("extendedPanID"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ThreadNetworkStruct.networkName", "networkName", value.isMember("networkName"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ThreadNetworkStruct.channel", "channel", value.isMember("channel"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "extendedPanID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.extendedPanID, value["extendedPanID"])); + valueCopy.removeMember("extendedPanID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "networkName"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.networkName, value["networkName"])); + valueCopy.removeMember("networkName"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "channel"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.channel, value["channel"])); + valueCopy.removeMember("channel"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.extendedPanID); + ComplexArgumentParser::Finalize(request.networkName); + ComplexArgumentParser::Finalize(request.channel); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Channel::Structs::ProgramCastStruct::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index a9ac94c6cecb77..7263b234708be5 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -455,6 +455,12 @@ static CHIP_ERROR Setup(const char * label, static void Finalize(chip::app::Clusters::Thermostat::Structs::WeeklyScheduleTransitionStruct::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Channel::Structs::ProgramCastStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 0d31e0f6074c81..8cd52cb458c885 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3528,6 +3528,40 @@ DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("ExtendedPanID", indent + 1, value.extendedPanID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ExtendedPanID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("NetworkName", indent + 1, value.networkName); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'NetworkName'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Channel", indent + 1, value.channel); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Channel'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Channel::Structs::ProgramCastStruct::DecodableType & value) { @@ -6969,6 +7003,22 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ThreadNetworkDirectory::Events::NetworkChanged::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("ExtendedPanID", indent + 1, value.extendedPanID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'ExtendedPanID'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const TargetNavigator::Events::TargetUpdated::DecodableType & value) { @@ -7727,6 +7777,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ThreadNetworkDirectory::Commands::OperationalDatasetResponse::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("operationalDataset", indent + 1, value.operationalDataset)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const Channel::Commands::ChangeChannelResponse::DecodableType & value) { @@ -16138,6 +16196,59 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case ThreadNetworkDirectory::Id: { + switch (path.mAttributeId) + { + case ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("PreferredExtendedPanID", 1, value); + } + case ThreadNetworkDirectory::Attributes::ThreadNetworks::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ThreadNetworks", 1, value); + } + case ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ThreadNetworkTableSize", 1, value); + } + case ThreadNetworkDirectory::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case ThreadNetworkDirectory::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case ThreadNetworkDirectory::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case ThreadNetworkDirectory::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case ThreadNetworkDirectory::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case ThreadNetworkDirectory::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case WakeOnLan::Id: { switch (path.mAttributeId) { @@ -18498,6 +18609,17 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa } break; } + case ThreadNetworkDirectory::Id: { + switch (path.mCommandId) + { + case ThreadNetworkDirectory::Commands::OperationalDatasetResponse::Id: { + ThreadNetworkDirectory::Commands::OperationalDatasetResponse::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("OperationalDatasetResponse", 1, value); + } + } + break; + } case Channel::Id: { switch (path.mCommandId) { @@ -19429,6 +19551,17 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip } break; } + case ThreadNetworkDirectory::Id: { + switch (header.mPath.mEventId) + { + case ThreadNetworkDirectory::Events::NetworkChanged::Id: { + chip::app::Clusters::ThreadNetworkDirectory::Events::NetworkChanged::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NetworkChanged", 1, value); + } + } + break; + } case TargetNavigator::Id: { switch (header.mPath.mEventId) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index ca39e2ae069060..5a562d72f6fd08 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -284,6 +284,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::WeeklyScheduleTransitionStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Channel::Structs::ProgramCastStruct::DecodableType & value); @@ -602,6 +605,8 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::PumpConfigurationAndControl::Events::AirDetection::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::PumpConfigurationAndControl::Events::TurbineOperation::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ThreadNetworkDirectory::Events::NetworkChanged::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TargetNavigator::Events::TargetUpdated::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, @@ -738,6 +743,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseResponse::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Channel::Commands::ChangeChannelResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 59bdd11dcb1cb3..92f8095b738474 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -138,6 +138,7 @@ | TotalVolatileOrganicCompoundsConcentrationMeasurement | 0x042E | | RadonConcentrationMeasurement | 0x042F | | WiFiNetworkManagement | 0x0451 | +| ThreadNetworkDirectory | 0x0453 | | WakeOnLan | 0x0503 | | Channel | 0x0504 | | TargetNavigator | 0x0505 | @@ -143707,6 +143708,1006 @@ class SubscribeAttributeWiFiNetworkManagementClusterRevision : public SubscribeA } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster ThreadNetworkDirectory | 0x0453 | +|------------------------------------------------------------------------------| +| Commands: | | +| * AddNetwork | 0x00 | +| * RemoveNetwork | 0x01 | +| * GetOperationalDataset | 0x02 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * PreferredExtendedPanID | 0x0000 | +| * ThreadNetworks | 0x0001 | +| * ThreadNetworkTableSize | 0x0002 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * NetworkChanged | 0x0000 | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL +/* + * Command AddNetwork + */ +class ThreadNetworkDirectoryAddNetwork : public ClusterCommand { +public: + ThreadNetworkDirectoryAddNetwork() + : ClusterCommand("add-network") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("OperationalDataset", &mRequest.operationalDataset); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRThreadNetworkDirectoryClusterAddNetworkParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.operationalDataset = [NSData dataWithBytes:mRequest.operationalDataset.data() length:mRequest.operationalDataset.size()]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster addNetworkWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command RemoveNetwork + */ +class ThreadNetworkDirectoryRemoveNetwork : public ClusterCommand { +public: + ThreadNetworkDirectoryRemoveNetwork() + : ClusterCommand("remove-network") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("ExtendedPanID", 0, UINT64_MAX, &mRequest.extendedPanID); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRThreadNetworkDirectoryClusterRemoveNetworkParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.extendedPanID = [NSNumber numberWithUnsignedLongLong:mRequest.extendedPanID]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster removeNetworkWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command GetOperationalDataset + */ +class ThreadNetworkDirectoryGetOperationalDataset : public ClusterCommand { +public: + ThreadNetworkDirectoryGetOperationalDataset() + : ClusterCommand("get-operational-dataset") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("ExtendedPanID", 0, UINT64_MAX, &mRequest.extendedPanID); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.extendedPanID = [NSNumber numberWithUnsignedLongLong:mRequest.extendedPanID]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster getOperationalDatasetWithParams:params completion: + ^(MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams * _Nullable values, NSError * _Nullable error) { + NSLog(@"Values: %@", values); + if (error == nil) { + constexpr chip::CommandId responseId = chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::Id; + RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); + } + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + constexpr chip::CommandId responseId = chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::Id; + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute PreferredExtendedPanID + */ +class ReadThreadNetworkDirectoryPreferredExtendedPanID : public ReadAttribute { +public: + ReadThreadNetworkDirectoryPreferredExtendedPanID() + : ReadAttribute("preferred-extended-pan-id") + { + } + + ~ReadThreadNetworkDirectoryPreferredExtendedPanID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributePreferredExtendedPanIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.PreferredExtendedPanID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory PreferredExtendedPanID read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteThreadNetworkDirectoryPreferredExtendedPanID : public WriteAttribute { +public: + WriteThreadNetworkDirectoryPreferredExtendedPanID() + : WriteAttribute("preferred-extended-pan-id") + { + AddArgument("attr-name", "preferred-extended-pan-id"); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteThreadNetworkDirectoryPreferredExtendedPanID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nullable value = nil; + if (!mValue.IsNull()) { + value = [NSNumber numberWithUnsignedLongLong:mValue.Value()]; + } + + [cluster writeAttributePreferredExtendedPanIDWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("ThreadNetworkDirectory PreferredExtendedPanID write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + chip::app::DataModel::Nullable mValue; +}; + +class SubscribeAttributeThreadNetworkDirectoryPreferredExtendedPanID : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryPreferredExtendedPanID() + : SubscribeAttribute("preferred-extended-pan-id") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryPreferredExtendedPanID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePreferredExtendedPanIDWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.PreferredExtendedPanID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ThreadNetworks + */ +class ReadThreadNetworkDirectoryThreadNetworks : public ReadAttribute { +public: + ReadThreadNetworkDirectoryThreadNetworks() + : ReadAttribute("thread-networks") + { + } + + ~ReadThreadNetworkDirectoryThreadNetworks() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworks::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeThreadNetworksWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.ThreadNetworks response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory ThreadNetworks read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDirectoryThreadNetworks : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryThreadNetworks() + : SubscribeAttribute("thread-networks") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryThreadNetworks() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworks::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeThreadNetworksWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.ThreadNetworks response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ThreadNetworkTableSize + */ +class ReadThreadNetworkDirectoryThreadNetworkTableSize : public ReadAttribute { +public: + ReadThreadNetworkDirectoryThreadNetworkTableSize() + : ReadAttribute("thread-network-table-size") + { + } + + ~ReadThreadNetworkDirectoryThreadNetworkTableSize() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeThreadNetworkTableSizeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.ThreadNetworkTableSize response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory ThreadNetworkTableSize read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDirectoryThreadNetworkTableSize : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryThreadNetworkTableSize() + : SubscribeAttribute("thread-network-table-size") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryThreadNetworkTableSize() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeThreadNetworkTableSizeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.ThreadNetworkTableSize response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute GeneratedCommandList + */ +class ReadThreadNetworkDirectoryGeneratedCommandList : public ReadAttribute { +public: + ReadThreadNetworkDirectoryGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadThreadNetworkDirectoryGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDirectoryGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AcceptedCommandList + */ +class ReadThreadNetworkDirectoryAcceptedCommandList : public ReadAttribute { +public: + ReadThreadNetworkDirectoryAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadThreadNetworkDirectoryAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDirectoryAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute EventList + */ +class ReadThreadNetworkDirectoryEventList : public ReadAttribute { +public: + ReadThreadNetworkDirectoryEventList() + : ReadAttribute("event-list") + { + } + + ~ReadThreadNetworkDirectoryEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::EventList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDirectoryEventList : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::EventList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEventListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AttributeList + */ +class ReadThreadNetworkDirectoryAttributeList : public ReadAttribute { +public: + ReadThreadNetworkDirectoryAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadThreadNetworkDirectoryAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDirectoryAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute FeatureMap + */ +class ReadThreadNetworkDirectoryFeatureMap : public ReadAttribute { +public: + ReadThreadNetworkDirectoryFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadThreadNetworkDirectoryFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDirectoryFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ClusterRevision + */ +class ReadThreadNetworkDirectoryClusterRevision : public ReadAttribute { +public: + ReadThreadNetworkDirectoryClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadThreadNetworkDirectoryClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ThreadNetworkDirectory ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeThreadNetworkDirectoryClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeThreadNetworkDirectoryClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeThreadNetworkDirectoryClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDirectory.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ @@ -188608,6 +189609,71 @@ void registerClusterWiFiNetworkManagement(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterThreadNetworkDirectory(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::ThreadNetworkDirectory; + + const char * clusterName = "ThreadNetworkDirectory"; + + commands_list clusterCommands = { + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterWakeOnLan(Commands & commands) { using namespace chip::app::Clusters::WakeOnLan; @@ -190019,6 +191085,7 @@ void registerClusters(Commands & commands) registerClusterTotalVolatileOrganicCompoundsConcentrationMeasurement(commands); registerClusterRadonConcentrationMeasurement(commands); registerClusterWiFiNetworkManagement(commands); + registerClusterThreadNetworkDirectory(commands); registerClusterWakeOnLan(commands); registerClusterChannel(commands); registerClusterTargetNavigator(commands); From 2feb25f062a1ee303c85eec8739c3e4feabb56d7 Mon Sep 17 00:00:00 2001 From: yeaissa <133245269+yeaissa@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:48:56 +0200 Subject: [PATCH 040/162] Fix Zephyr WiFIManager build (#33707) * Fix Zephyr WiFIManager build * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/platform/Zephyr/wifi/WiFiManager.cpp | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/platform/Zephyr/wifi/WiFiManager.cpp b/src/platform/Zephyr/wifi/WiFiManager.cpp index 69d2943235cdbd..11187a7cef1655 100644 --- a/src/platform/Zephyr/wifi/WiFiManager.cpp +++ b/src/platform/Zephyr/wifi/WiFiManager.cpp @@ -159,33 +159,33 @@ void WiFiManager::WifiMgmtEventHandler(net_mgmt_event_callback * cb, uint32_t mg CHIP_ERROR WiFiManager::Init() { // TODO: consider moving these to ConnectivityManagerImpl to be prepared for handling multiple interfaces on a single device. - Inet::UDPEndPointImplSockets::SetMulticastGroupHandler( - [](Inet::InterfaceId interfaceId, const Inet::IPAddress & address, UDPEndPointImplSockets::MulticastOperation operation) { - const in6_addr addr = InetUtils::ToZephyrAddr(address); - net_if * iface = InetUtils::GetInterface(interfaceId); - VerifyOrReturnError(iface != nullptr, INET_ERROR_UNKNOWN_INTERFACE); + Inet::UDPEndPointImplSockets::SetMulticastGroupHandler([](Inet::InterfaceId interfaceId, const Inet::IPAddress & address, + Inet::UDPEndPointImplSockets::MulticastOperation operation) { + const in6_addr addr = InetUtils::ToZephyrAddr(address); + net_if * iface = InetUtils::GetInterface(interfaceId); + VerifyOrReturnError(iface != nullptr, INET_ERROR_UNKNOWN_INTERFACE); - if (operation == UDPEndPointImplSockets::MulticastOperation::kJoin) - { - net_if_mcast_addr * maddr = net_if_ipv6_maddr_add(iface, &addr); + if (operation == Inet::UDPEndPointImplSockets::MulticastOperation::kJoin) + { + net_if_mcast_addr * maddr = net_if_ipv6_maddr_add(iface, &addr); - if (maddr && !net_if_ipv6_maddr_is_joined(maddr) && !net_ipv6_is_addr_mcast_link_all_nodes(&addr)) - { - net_if_ipv6_maddr_join(iface, maddr); - } - } - else if (operation == UDPEndPointImplSockets::MulticastOperation::kLeave) - { - VerifyOrReturnError(net_ipv6_is_addr_mcast_link_all_nodes(&addr) || net_if_ipv6_maddr_rm(iface, &addr), - CHIP_ERROR_INVALID_ADDRESS); - } - else + if (maddr && !net_if_ipv6_maddr_is_joined(maddr) && !net_ipv6_is_addr_mcast_link_all_nodes(&addr)) { - return CHIP_ERROR_INCORRECT_STATE; + net_if_ipv6_maddr_join(iface, maddr); } + } + else if (operation == Inet::UDPEndPointImplSockets::MulticastOperation::kLeave) + { + VerifyOrReturnError(net_ipv6_is_addr_mcast_link_all_nodes(&addr) || net_if_ipv6_maddr_rm(iface, &addr), + CHIP_ERROR_INVALID_ADDRESS); + } + else + { + return CHIP_ERROR_INCORRECT_STATE; + } - return CHIP_NO_ERROR; - }); + return CHIP_NO_ERROR; + }); net_mgmt_init_event_callback(&mWiFiMgmtClbk, WifiMgmtEventHandler, kWifiManagementEvents); net_mgmt_add_event_callback(&mWiFiMgmtClbk); From a63cf029243d847747355fdc8685d16fb10db107 Mon Sep 17 00:00:00 2001 From: Kevin Schoedel Date: Tue, 4 Jun 2024 08:42:33 -0400 Subject: [PATCH 041/162] Streamline bloat reports, part 2 of 2 (#33716) * Streamline bloat reports, part 2 Remove the early attempt to aggregate FLASH vs RAM based on whether ELF segments are writable or not, which turned out not to be useful because several platforms mark flash segments as writable. Now that explicit section groups are in use (#33642), there is no additional value to segment aggregation even on platforms that mark them accurately. * Streamline bloat reports, part 2 Remove the early attempt to aggregate FLASH vs RAM based on whether ELF segments are writable or not, which turned out not to be useful because several platforms mark flash segments as writable. Now that explicit section groups are in use (#33642), there is no additional value to segment aggregation even on platforms that mark them accurately. * Filter down to region reports only. --- scripts/tools/memory/gh_report.py | 4 ++++ scripts/tools/memory/gh_sizes.py | 35 ++++++++-------------------- scripts/tools/memory/memdf/sizedb.py | 12 +++------- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/scripts/tools/memory/gh_report.py b/scripts/tools/memory/gh_report.py index a9315f7c628cbd..22d35e76375aa1 100755 --- a/scripts/tools/memory/gh_report.py +++ b/scripts/tools/memory/gh_report.py @@ -276,6 +276,10 @@ def report_matching_commits(self) -> Dict[str, pd.DataFrame]: continue df = pd.DataFrame(changes.rows, columns=changes.columns) + + # Filter down to region reports only. + df = df[df['kind'] == 'region'].drop('kind', axis=1) + df.attrs = { 'name': f'{pr},{parent},{commit}', 'title': (f'PR #{pr}: ' if pr else '') + diff --git a/scripts/tools/memory/gh_sizes.py b/scripts/tools/memory/gh_sizes.py index 4a32809de8bb40..012d5904517147 100755 --- a/scripts/tools/memory/gh_sizes.py +++ b/scripts/tools/memory/gh_sizes.py @@ -58,9 +58,9 @@ {"section": ".data", "size": 1648}, {"section": ".text", "size": 740236} ], - "wr": [ - {"wr": 0, "size": 262144}, - {"wr": 1, "size": 74023} + "region": [ + {"region": "FLASH", "size": 262144}, + {"region": "RAM", "size": 74023} ] } } @@ -77,8 +77,7 @@ import memdf.report import memdf.select import memdf.util -import numpy as np # type: ignore -from memdf import Config, ConfigDescription, DFs, SectionDF, SegmentDF +from memdf import Config, ConfigDescription, DFs, SectionDF PLATFORM_CONFIG_DIR = pathlib.Path('scripts/tools/memory/platform') @@ -162,7 +161,8 @@ def main(argv): **CONFIG, } # In case there is no platform configuration file, default to using a popular set of section names. - config_desc['section.select']['default'] = ['.text', '.rodata', '.data', '.bss'] + config_desc['section.select']['default'] = [ + '.text', '.rodata', '.data', '.bss'] config = Config().init(config_desc) config.put('output.file', output) @@ -197,32 +197,17 @@ def main(argv): collected: DFs = memdf.collect.collect_files(config, [binary]) - # Aggregate loaded segments, by writable (RAM) or not (flash). - segments = collected[SegmentDF.name] - segments['segment'] = segments.index - segments['wr'] = ((segments['flags'] & 2) != 0).convert_dtypes( - convert_boolean=False, convert_integer=True) - segment_summary = segments[segments['type'] == 'PT_LOAD'][[ - 'wr', 'size' - ]].groupby('wr').aggregate(np.sum).reset_index().astype( - {'size': np.int64}) - segment_summary.attrs['name'] = "wr" - sections = collected[SectionDF.name] - sections = sections.join(on='segment', - how='left', - other=segments, - rsuffix='-segment') - section_summary = sections[['section', 'size', - 'wr']].sort_values(by='section') + section_summary = sections[['section', + 'size']].sort_values(by='section') section_summary.attrs['name'] = "section" - region_summary = memdf.select.groupby(config, collected['section'], 'region') + region_summary = memdf.select.groupby( + config, collected['section'], 'region') region_summary.attrs['name'] = "region" summaries = { 'section': section_summary, - 'memory': segment_summary, 'region': region_summary, } diff --git a/scripts/tools/memory/memdf/sizedb.py b/scripts/tools/memory/memdf/sizedb.py index c3b221a963babf..12289694e3dc2b 100644 --- a/scripts/tools/memory/memdf/sizedb.py +++ b/scripts/tools/memory/memdf/sizedb.py @@ -109,13 +109,6 @@ def add_sizes_from_json(self, s: Union[bytes, str], origin: Dict): 'size': i['size'], 'kind': frame }) - # Add segment sizes. - for i in r['frames'].get('wr', []): - r['sizes'].append({ - 'name': ('(read only)', '(read/write)')[int(i['wr'])], - 'size': i['size'], - 'kind': 'wr' - }) self.add_sizes(**r) def add_sizes_from_zipfile(self, f: Union[IO, Path], origin: Dict): @@ -182,6 +175,7 @@ def select_changes(self, parent: str, commit: str) -> ChangeInfo: pb.id AS parent_build, cb.id AS commit_build, t.platform, t.config, t.target, + cs.kind AS kind, cs.name AS name, ps.size AS parent_size, cs.size AS commit_size, @@ -196,7 +190,7 @@ def select_changes(self, parent: str, commit: str) -> ChangeInfo: cs.name, cb.time DESC, pb.time DESC ''', (commit, parent)) - keep = ('platform', 'target', 'config', 'name', 'parent_size', + keep = ('platform', 'target', 'config', 'kind', 'name', 'parent_size', 'commit_size') things: set[int] = set() artifacts: set[int] = set() @@ -229,7 +223,7 @@ def select_changes(self, parent: str, commit: str) -> ChangeInfo: artifacts.add(row['artifact']) builds.add(row['commit_build']) - return ChangeInfo(('platform', 'target', 'config', 'section', + return ChangeInfo(('platform', 'target', 'config', 'kind', 'section', parent[:8], commit[:8], 'change', '% change'), rows, things, builds, stale_builds, artifacts, stale_artifacts) From f350172eb6cb73b0cc3867c41ced2a3477f0c28e Mon Sep 17 00:00:00 2001 From: C Freeman Date: Tue, 4 Jun 2024 10:14:25 -0400 Subject: [PATCH 042/162] DM XML: Update to latest 1.3 branch (#33679) * Update DM XMLs - removes clusters and data types that were ifdef'd at the index level - updates to the latest 1.3 branch which marks scenes as provisional and fixes the name on the offonly feature - adds in a couple of provisional clusters from the main spec that were previously not scraped - removes some empty cluster files * DM XMLs: Remove cluster fix --- data_model/clusters/ACL-Cluster.xml | 2 +- data_model/clusters/AccountLogin.xml | 2 +- .../clusters/AdminCommissioningCluster.xml | 2 +- data_model/clusters/AirQuality.xml | 2 +- data_model/clusters/AlarmBase.xml | 2 +- data_model/clusters/ApplicationBasic.xml | 2 +- data_model/clusters/ApplicationLauncher.xml | 2 +- data_model/clusters/AudioOutput.xml | 2 +- data_model/clusters/BallastConfiguration.xml | 2 +- .../clusters/BasicInformationCluster.xml | 2 +- data_model/clusters/Binding-Cluster.xml | 2 +- data_model/clusters/BooleanState.xml | 2 +- .../clusters/BooleanStateConfiguration.xml | 2 +- data_model/clusters/Channel.xml | 2 +- data_model/clusters/ColorControl.xml | 2 +- data_model/clusters/ContentAppObserver.xml | 2 +- data_model/clusters/ContentControl.xml | 2 +- data_model/clusters/ContentLauncher.xml | 2 +- .../clusters/DemandResponseLoadControl.xml | 554 ------------------ data_model/clusters/Descriptor-Cluster.xml | 2 +- .../clusters/DeviceEnergyManagement.xml | 2 +- data_model/clusters/DiagnosticLogsCluster.xml | 2 +- data_model/clusters/DiagnosticsEthernet.xml | 2 +- data_model/clusters/DiagnosticsGeneral.xml | 2 +- data_model/clusters/DiagnosticsSoftware.xml | 2 +- data_model/clusters/DiagnosticsThread.xml | 2 +- data_model/clusters/DiagnosticsWiFi.xml | 2 +- data_model/clusters/DishwasherAlarm.xml | 2 +- data_model/clusters/DoorLock.xml | 2 +- .../clusters/ElectricalEnergyMeasurement.xml | 2 +- .../clusters/ElectricalPowerMeasurement.xml | 2 +- data_model/clusters/EnergyCalendar.xml | 301 ---------- data_model/clusters/EnergyEVSE.xml | 2 +- data_model/clusters/EnergyPreference.xml | 2 +- data_model/clusters/EnergyPrice.xml | 233 -------- data_model/clusters/FanControl.xml | 2 +- data_model/clusters/FlowMeasurement.xml | 2 +- .../clusters/GeneralCommissioningCluster.xml | 2 +- .../clusters/Group-Key-Management-Cluster.xml | 2 +- data_model/clusters/Groups.xml | 2 +- data_model/clusters/ICDManagement.xml | 2 +- data_model/clusters/Identify.xml | 2 +- .../clusters/IlluminanceMeasurement.xml | 2 +- data_model/clusters/KeypadInput.xml | 2 +- .../Label-Cluster-FixedLabelCluster.xml | 2 +- .../clusters/Label-Cluster-LabelCluster.xml | 2 +- .../Label-Cluster-UserLabelCluster.xml | 2 +- data_model/clusters/LaundryDryerControls.xml | 2 +- data_model/clusters/LaundryWasherControls.xml | 2 +- data_model/clusters/LevelControl.xml | 2 +- .../clusters/LocalizationConfiguration.xml | 2 +- .../clusters/LocalizationTimeFormat.xml | 2 +- data_model/clusters/LocalizationUnit.xml | 2 +- data_model/clusters/LowPower.xml | 2 +- data_model/clusters/MediaInput.xml | 2 +- data_model/clusters/MediaPlayback.xml | 2 +- data_model/clusters/Messages.xml | 2 +- data_model/clusters/MicrowaveOvenControl.xml | 2 +- data_model/clusters/ModeBase.xml | 2 +- data_model/clusters/ModeSelect.xml | 2 +- .../clusters/Mode_DeviceEnergyManagement.xml | 2 +- data_model/clusters/Mode_Dishwasher.xml | 2 +- data_model/clusters/Mode_EVSE.xml | 2 +- data_model/clusters/Mode_LaundryWasher.xml | 2 +- data_model/clusters/Mode_MicrowaveOven.xml | 2 +- data_model/clusters/Mode_Oven.xml | 2 +- data_model/clusters/Mode_RVCClean.xml | 2 +- data_model/clusters/Mode_RVCRun.xml | 2 +- data_model/clusters/Mode_Refrigerator.xml | 2 +- .../clusters/NetworkCommissioningCluster.xml | 2 +- .../clusters/NetworkIdentityManagement.xml | 169 ------ data_model/clusters/OTAProvider.xml | 2 +- data_model/clusters/OTARequestor.xml | 2 +- data_model/clusters/OTASoftwareUpdate.xml | 58 -- data_model/clusters/OccupancySensing.xml | 2 +- data_model/clusters/OnOff.xml | 2 +- .../clusters/OperationalCredentialCluster.xml | 2 +- data_model/clusters/OperationalState.xml | 2 +- data_model/clusters/OperationalState_Oven.xml | 2 +- data_model/clusters/OperationalState_RVC.xml | 2 +- data_model/clusters/PowerSourceCluster.xml | 2 +- .../PowerSourceConfigurationCluster.xml | 2 +- data_model/clusters/PowerTopology.xml | 2 +- data_model/clusters/PressureMeasurement.xml | 2 +- ...ent.xml => ProxyConfiguration-Cluster.xml} | 46 +- ...nostics.xml => ProxyDiscovery-Cluster.xml} | 54 +- .../clusters/PumpConfigurationControl.xml | 2 +- data_model/clusters/RefrigeratorAlarm.xml | 2 +- data_model/clusters/Scenes.xml | 2 +- data_model/clusters/SmokeCOAlarm.xml | 2 +- data_model/clusters/Switch.xml | 2 +- data_model/clusters/TargetNavigator.xml | 2 +- data_model/clusters/TemperatureControl.xml | 2 +- .../clusters/TemperatureMeasurement.xml | 2 +- data_model/clusters/Thermostat.xml | 2 +- .../ThermostatUserInterfaceConfiguration.xml | 2 +- data_model/clusters/TimeSync.xml | 2 +- ...terHeater.xml => ValidProxies-Cluster.xml} | 40 +- .../clusters/ValveConfigurationControl.xml | 2 +- data_model/clusters/WakeOnLAN.xml | 2 +- data_model/clusters/WaterHeaterManagement.xml | 164 ------ .../clusters/WiFiPerDeviceCredentials.xml | 58 -- data_model/clusters/WindowCovering.xml | 2 +- .../bridge-clusters-ActionsCluster.xml | 2 +- ...s-BridgedDeviceBasicInformationCluster.xml | 2 +- data_model/clusters/cluster_ids.json | 10 +- data_model/clusters/energy_management.xml | 60 -- .../clusters/network_infrastructure.xml | 64 -- data_model/device_types/BooleanSensor.xml | 72 --- data_model/device_types/ColorDimmerSwitch.xml | 5 +- .../device_types/ColorTemperatureLight.xml | 10 +- data_model/device_types/ControlBridge.xml | 5 +- data_model/device_types/DimmableLight.xml | 10 +- .../device_types/DimmablePlug-InUnit.xml | 10 +- data_model/device_types/DimmerSwitch.xml | 5 +- .../device_types/DoorLockController.xml | 5 +- data_model/device_types/EnergyTariff.xml | 64 -- .../device_types/EnergyTariffCalendar.xml | 64 -- .../device_types/ExtendedColorLight.xml | 10 +- .../device_types/HeatingCoolingUnit.xml | 92 --- .../NetworkInfraIntro-CommonRequirements.xml | 58 -- .../NetworkInfraIntro-Introduction.xml | 58 -- data_model/device_types/NetworkInfraIntro.xml | 58 -- .../device_types/NetworkInfraManager.xml | 72 --- data_model/device_types/OnOffLight.xml | 12 +- data_model/device_types/OnOffLightSwitch.xml | 5 +- data_model/device_types/OnOffPlug-inUnit.xml | 12 +- data_model/device_types/OnOffSensor.xml | 5 +- data_model/device_types/Pump.xml | 5 +- data_model/device_types/PumpController.xml | 5 +- .../device_types/RoomAirConditioner.xml | 5 +- data_model/device_types/Thermostat.xml | 5 +- .../device_types/ThreadBorderRouter.xml | 80 --- .../device_types/ThreePhasePowerSource.xml | 82 --- data_model/device_types/Valve.xml | 72 --- data_model/device_types/WaterHeater.xml | 100 ---- data_model/device_types/WindowCovering.xml | 1 + .../device_types/WindowCoveringController.xml | 1 + data_model/spec_sha | 2 +- docs/spec_clusters.md | 10 +- scripts/spec_xml/generate_spec_xml.py | 10 - 141 files changed, 279 insertions(+), 2732 deletions(-) delete mode 100644 data_model/clusters/DemandResponseLoadControl.xml delete mode 100644 data_model/clusters/EnergyCalendar.xml delete mode 100644 data_model/clusters/EnergyPrice.xml delete mode 100644 data_model/clusters/NetworkIdentityManagement.xml delete mode 100644 data_model/clusters/OTASoftwareUpdate.xml rename data_model/clusters/{WiFiNetworkManagement.xml => ProxyConfiguration-Cluster.xml} (75%) rename data_model/clusters/{ThreadBorderRouterDiagnostics.xml => ProxyDiscovery-Cluster.xml} (73%) rename data_model/clusters/{Mode_WaterHeater.xml => ValidProxies-Cluster.xml} (70%) delete mode 100644 data_model/clusters/WaterHeaterManagement.xml delete mode 100644 data_model/clusters/WiFiPerDeviceCredentials.xml delete mode 100644 data_model/clusters/energy_management.xml delete mode 100644 data_model/clusters/network_infrastructure.xml delete mode 100644 data_model/device_types/BooleanSensor.xml delete mode 100644 data_model/device_types/EnergyTariff.xml delete mode 100644 data_model/device_types/EnergyTariffCalendar.xml delete mode 100644 data_model/device_types/HeatingCoolingUnit.xml delete mode 100644 data_model/device_types/NetworkInfraIntro-CommonRequirements.xml delete mode 100644 data_model/device_types/NetworkInfraIntro-Introduction.xml delete mode 100644 data_model/device_types/NetworkInfraIntro.xml delete mode 100644 data_model/device_types/NetworkInfraManager.xml delete mode 100644 data_model/device_types/ThreadBorderRouter.xml delete mode 100644 data_model/device_types/ThreePhasePowerSource.xml delete mode 100644 data_model/device_types/Valve.xml delete mode 100644 data_model/device_types/WaterHeater.xml diff --git a/data_model/clusters/ACL-Cluster.xml b/data_model/clusters/ACL-Cluster.xml index b965eb84234e0d..a193ef2ac3206f 100644 --- a/data_model/clusters/ACL-Cluster.xml +++ b/data_model/clusters/ACL-Cluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/AccountLogin.xml b/data_model/clusters/AccountLogin.xml index db87d05dc74902..8a9ed7d9389f40 100644 --- a/data_model/clusters/AccountLogin.xml +++ b/data_model/clusters/AccountLogin.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/AdminCommissioningCluster.xml b/data_model/clusters/AdminCommissioningCluster.xml index eea41bc65b6e2c..ccbb579134dc00 100644 --- a/data_model/clusters/AdminCommissioningCluster.xml +++ b/data_model/clusters/AdminCommissioningCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/AirQuality.xml b/data_model/clusters/AirQuality.xml index 2e188b97d23336..c05717863c5ff4 100644 --- a/data_model/clusters/AirQuality.xml +++ b/data_model/clusters/AirQuality.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/AlarmBase.xml b/data_model/clusters/AlarmBase.xml index f4ffc6344a8b90..fd0ccb5bc19d46 100644 --- a/data_model/clusters/AlarmBase.xml +++ b/data_model/clusters/AlarmBase.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ApplicationBasic.xml b/data_model/clusters/ApplicationBasic.xml index fa197a8d1e5cca..ee39b8a421209d 100644 --- a/data_model/clusters/ApplicationBasic.xml +++ b/data_model/clusters/ApplicationBasic.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ApplicationLauncher.xml b/data_model/clusters/ApplicationLauncher.xml index 6b84436e73d42d..57d6858dd8ce14 100644 --- a/data_model/clusters/ApplicationLauncher.xml +++ b/data_model/clusters/ApplicationLauncher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/AudioOutput.xml b/data_model/clusters/AudioOutput.xml index 468ba2750152a6..27bb5a20bb7952 100644 --- a/data_model/clusters/AudioOutput.xml +++ b/data_model/clusters/AudioOutput.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/BallastConfiguration.xml b/data_model/clusters/BallastConfiguration.xml index f25bef22cb4b6c..0f37d86067e994 100644 --- a/data_model/clusters/BallastConfiguration.xml +++ b/data_model/clusters/BallastConfiguration.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/BasicInformationCluster.xml b/data_model/clusters/BasicInformationCluster.xml index 82b9283b0d21d6..137e8b70408bf8 100644 --- a/data_model/clusters/BasicInformationCluster.xml +++ b/data_model/clusters/BasicInformationCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/Binding-Cluster.xml b/data_model/clusters/Binding-Cluster.xml index 937b9164e2a4f8..444c99b315348d 100644 --- a/data_model/clusters/Binding-Cluster.xml +++ b/data_model/clusters/Binding-Cluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/BooleanState.xml b/data_model/clusters/BooleanState.xml index 9205310c58f2be..5bb29f53ae0c3e 100644 --- a/data_model/clusters/BooleanState.xml +++ b/data_model/clusters/BooleanState.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/BooleanStateConfiguration.xml b/data_model/clusters/BooleanStateConfiguration.xml index a9c370b95fe15c..01444d565294b3 100644 --- a/data_model/clusters/BooleanStateConfiguration.xml +++ b/data_model/clusters/BooleanStateConfiguration.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Channel.xml b/data_model/clusters/Channel.xml index 1809f5262e7166..17144c9032c3e5 100644 --- a/data_model/clusters/Channel.xml +++ b/data_model/clusters/Channel.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ColorControl.xml b/data_model/clusters/ColorControl.xml index b913009f852761..456b3ff14cfff9 100644 --- a/data_model/clusters/ColorControl.xml +++ b/data_model/clusters/ColorControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ContentAppObserver.xml b/data_model/clusters/ContentAppObserver.xml index 184cce14924cda..d6808baf982215 100644 --- a/data_model/clusters/ContentAppObserver.xml +++ b/data_model/clusters/ContentAppObserver.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ContentControl.xml b/data_model/clusters/ContentControl.xml index 14996a7c28011a..b2539cf445c289 100644 --- a/data_model/clusters/ContentControl.xml +++ b/data_model/clusters/ContentControl.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/ContentLauncher.xml b/data_model/clusters/ContentLauncher.xml index b8f80de2e51ea7..9a5674efa8eb64 100644 --- a/data_model/clusters/ContentLauncher.xml +++ b/data_model/clusters/ContentLauncher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/DemandResponseLoadControl.xml b/data_model/clusters/DemandResponseLoadControl.xml deleted file mode 100644 index 206201b347612c..00000000000000 --- a/data_model/clusters/DemandResponseLoadControl.xml +++ /dev/null @@ -1,554 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/Descriptor-Cluster.xml b/data_model/clusters/Descriptor-Cluster.xml index 1b17fb4fdfdaea..659b2ffaa5ddc0 100644 --- a/data_model/clusters/Descriptor-Cluster.xml +++ b/data_model/clusters/Descriptor-Cluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/DeviceEnergyManagement.xml b/data_model/clusters/DeviceEnergyManagement.xml index e493c5b332182e..f74d7e572550cc 100644 --- a/data_model/clusters/DeviceEnergyManagement.xml +++ b/data_model/clusters/DeviceEnergyManagement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/DiagnosticLogsCluster.xml b/data_model/clusters/DiagnosticLogsCluster.xml index 5b67564b18f298..38520e81a85e16 100644 --- a/data_model/clusters/DiagnosticLogsCluster.xml +++ b/data_model/clusters/DiagnosticLogsCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsEthernet.xml b/data_model/clusters/DiagnosticsEthernet.xml index 9d4822479ef5a6..dfcd3d11c41f52 100644 --- a/data_model/clusters/DiagnosticsEthernet.xml +++ b/data_model/clusters/DiagnosticsEthernet.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsGeneral.xml b/data_model/clusters/DiagnosticsGeneral.xml index 1141123c83b6be..4da912b03dc3df 100644 --- a/data_model/clusters/DiagnosticsGeneral.xml +++ b/data_model/clusters/DiagnosticsGeneral.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsSoftware.xml b/data_model/clusters/DiagnosticsSoftware.xml index 2c0b0b8a91a6ae..7cb3c9ff39ad2f 100644 --- a/data_model/clusters/DiagnosticsSoftware.xml +++ b/data_model/clusters/DiagnosticsSoftware.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsThread.xml b/data_model/clusters/DiagnosticsThread.xml index a05d5dc1b2d2fc..120efaddf8c08e 100644 --- a/data_model/clusters/DiagnosticsThread.xml +++ b/data_model/clusters/DiagnosticsThread.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsWiFi.xml b/data_model/clusters/DiagnosticsWiFi.xml index 49ef964da7a545..b3951d967dc31f 100644 --- a/data_model/clusters/DiagnosticsWiFi.xml +++ b/data_model/clusters/DiagnosticsWiFi.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DishwasherAlarm.xml b/data_model/clusters/DishwasherAlarm.xml index b3b67e2bffb500..bdc399f9399486 100644 --- a/data_model/clusters/DishwasherAlarm.xml +++ b/data_model/clusters/DishwasherAlarm.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: short --> - + diff --git a/data_model/clusters/DoorLock.xml b/data_model/clusters/DoorLock.xml index 16d26420fe2009..fcf86f3a95aa24 100644 --- a/data_model/clusters/DoorLock.xml +++ b/data_model/clusters/DoorLock.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ElectricalEnergyMeasurement.xml b/data_model/clusters/ElectricalEnergyMeasurement.xml index 98020764397116..f8bbec4c03db95 100644 --- a/data_model/clusters/ElectricalEnergyMeasurement.xml +++ b/data_model/clusters/ElectricalEnergyMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ElectricalPowerMeasurement.xml b/data_model/clusters/ElectricalPowerMeasurement.xml index c695e8db031790..cfb8ce9018e73c 100644 --- a/data_model/clusters/ElectricalPowerMeasurement.xml +++ b/data_model/clusters/ElectricalPowerMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/EnergyCalendar.xml b/data_model/clusters/EnergyCalendar.xml deleted file mode 100644 index 8d3f1b343bb4a7..00000000000000 --- a/data_model/clusters/EnergyCalendar.xml +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/EnergyEVSE.xml b/data_model/clusters/EnergyEVSE.xml index d7786da5cda99d..4b881f5a1135a4 100644 --- a/data_model/clusters/EnergyEVSE.xml +++ b/data_model/clusters/EnergyEVSE.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/EnergyPreference.xml b/data_model/clusters/EnergyPreference.xml index c3676520ed6d01..eafb527a868b22 100644 --- a/data_model/clusters/EnergyPreference.xml +++ b/data_model/clusters/EnergyPreference.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/EnergyPrice.xml b/data_model/clusters/EnergyPrice.xml deleted file mode 100644 index 1683fe1bbc13cf..00000000000000 --- a/data_model/clusters/EnergyPrice.xml +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/FanControl.xml b/data_model/clusters/FanControl.xml index 756a7bd27466b3..224f811261f68b 100644 --- a/data_model/clusters/FanControl.xml +++ b/data_model/clusters/FanControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: short --> - + diff --git a/data_model/clusters/FlowMeasurement.xml b/data_model/clusters/FlowMeasurement.xml index 29f9d9d7ae58f9..71178874d57c14 100644 --- a/data_model/clusters/FlowMeasurement.xml +++ b/data_model/clusters/FlowMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/GeneralCommissioningCluster.xml b/data_model/clusters/GeneralCommissioningCluster.xml index e7877635bbac68..e440222780ea02 100644 --- a/data_model/clusters/GeneralCommissioningCluster.xml +++ b/data_model/clusters/GeneralCommissioningCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/Group-Key-Management-Cluster.xml b/data_model/clusters/Group-Key-Management-Cluster.xml index 8867a395299bbd..c1819628e34d7b 100644 --- a/data_model/clusters/Group-Key-Management-Cluster.xml +++ b/data_model/clusters/Group-Key-Management-Cluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/Groups.xml b/data_model/clusters/Groups.xml index 72902e878cbe9f..1f168e13fad933 100644 --- a/data_model/clusters/Groups.xml +++ b/data_model/clusters/Groups.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ICDManagement.xml b/data_model/clusters/ICDManagement.xml index 534b8340143083..512dfd119efef7 100644 --- a/data_model/clusters/ICDManagement.xml +++ b/data_model/clusters/ICDManagement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA // Update Name --> - + diff --git a/data_model/clusters/Identify.xml b/data_model/clusters/Identify.xml index 1cdc33aa0df727..8044ceb33dc3bd 100644 --- a/data_model/clusters/Identify.xml +++ b/data_model/clusters/Identify.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/IlluminanceMeasurement.xml b/data_model/clusters/IlluminanceMeasurement.xml index c39daa0e6bdc4d..d3228b845ca058 100644 --- a/data_model/clusters/IlluminanceMeasurement.xml +++ b/data_model/clusters/IlluminanceMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/KeypadInput.xml b/data_model/clusters/KeypadInput.xml index 4cfb509b06d0be..57d6ef4650e013 100644 --- a/data_model/clusters/KeypadInput.xml +++ b/data_model/clusters/KeypadInput.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Label-Cluster-FixedLabelCluster.xml b/data_model/clusters/Label-Cluster-FixedLabelCluster.xml index e73bfc274a9da4..98106b6fc33e40 100644 --- a/data_model/clusters/Label-Cluster-FixedLabelCluster.xml +++ b/data_model/clusters/Label-Cluster-FixedLabelCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Label-Cluster-LabelCluster.xml b/data_model/clusters/Label-Cluster-LabelCluster.xml index f107a0a7b3f12b..0ca5566f0dc132 100644 --- a/data_model/clusters/Label-Cluster-LabelCluster.xml +++ b/data_model/clusters/Label-Cluster-LabelCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Label-Cluster-UserLabelCluster.xml b/data_model/clusters/Label-Cluster-UserLabelCluster.xml index f7e809ab785c00..eba0099ffb59d2 100644 --- a/data_model/clusters/Label-Cluster-UserLabelCluster.xml +++ b/data_model/clusters/Label-Cluster-UserLabelCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/LaundryDryerControls.xml b/data_model/clusters/LaundryDryerControls.xml index a3f7b911fc9e9c..af4f787c0432b7 100644 --- a/data_model/clusters/LaundryDryerControls.xml +++ b/data_model/clusters/LaundryDryerControls.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/LaundryWasherControls.xml b/data_model/clusters/LaundryWasherControls.xml index 16879842721473..6c4f4bc0b0c3a5 100644 --- a/data_model/clusters/LaundryWasherControls.xml +++ b/data_model/clusters/LaundryWasherControls.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/LevelControl.xml b/data_model/clusters/LevelControl.xml index 5cacf7e89a5162..fa6cbe397a672a 100644 --- a/data_model/clusters/LevelControl.xml +++ b/data_model/clusters/LevelControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + + diff --git a/data_model/clusters/LocalizationTimeFormat.xml b/data_model/clusters/LocalizationTimeFormat.xml index fb8ceea3ee17a8..db8b809b0341a9 100644 --- a/data_model/clusters/LocalizationTimeFormat.xml +++ b/data_model/clusters/LocalizationTimeFormat.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/LocalizationUnit.xml b/data_model/clusters/LocalizationUnit.xml index be7ea6a0aa2d78..2c6e1ecbd648e6 100644 --- a/data_model/clusters/LocalizationUnit.xml +++ b/data_model/clusters/LocalizationUnit.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/LowPower.xml b/data_model/clusters/LowPower.xml index 4c228d3154dfa1..cf75cb0c680164 100644 --- a/data_model/clusters/LowPower.xml +++ b/data_model/clusters/LowPower.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/MediaInput.xml b/data_model/clusters/MediaInput.xml index b7d9d2ef017035..a92985ff924a75 100644 --- a/data_model/clusters/MediaInput.xml +++ b/data_model/clusters/MediaInput.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/MediaPlayback.xml b/data_model/clusters/MediaPlayback.xml index e9194b6854c569..03175277dc12c5 100644 --- a/data_model/clusters/MediaPlayback.xml +++ b/data_model/clusters/MediaPlayback.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Messages.xml b/data_model/clusters/Messages.xml index 61f21bef9c95f3..402310c4b92eea 100644 --- a/data_model/clusters/Messages.xml +++ b/data_model/clusters/Messages.xml @@ -96,7 +96,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/MicrowaveOvenControl.xml b/data_model/clusters/MicrowaveOvenControl.xml index 27f31dcba966b7..ecc9d23b143d4b 100644 --- a/data_model/clusters/MicrowaveOvenControl.xml +++ b/data_model/clusters/MicrowaveOvenControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ModeBase.xml b/data_model/clusters/ModeBase.xml index 2a11f85d343b39..dcd6cf1c448028 100644 --- a/data_model/clusters/ModeBase.xml +++ b/data_model/clusters/ModeBase.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/clusters/Mode_DeviceEnergyManagement.xml b/data_model/clusters/Mode_DeviceEnergyManagement.xml index 592c7d4290a342..e167e8649650ba 100644 --- a/data_model/clusters/Mode_DeviceEnergyManagement.xml +++ b/data_model/clusters/Mode_DeviceEnergyManagement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_Dishwasher.xml b/data_model/clusters/Mode_Dishwasher.xml index 4ff6e78714f648..40a19828d44ebb 100644 --- a/data_model/clusters/Mode_Dishwasher.xml +++ b/data_model/clusters/Mode_Dishwasher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_EVSE.xml b/data_model/clusters/Mode_EVSE.xml index de88cb3717c8bf..27a1adcfcd5a2a 100644 --- a/data_model/clusters/Mode_EVSE.xml +++ b/data_model/clusters/Mode_EVSE.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_LaundryWasher.xml b/data_model/clusters/Mode_LaundryWasher.xml index c59b2c3fef9051..5d3cce891790e1 100644 --- a/data_model/clusters/Mode_LaundryWasher.xml +++ b/data_model/clusters/Mode_LaundryWasher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_MicrowaveOven.xml b/data_model/clusters/Mode_MicrowaveOven.xml index 6e8a129444b9fd..6f1e8ed895f489 100644 --- a/data_model/clusters/Mode_MicrowaveOven.xml +++ b/data_model/clusters/Mode_MicrowaveOven.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_Oven.xml b/data_model/clusters/Mode_Oven.xml index f6c7111bb844cd..9c596e01467418 100644 --- a/data_model/clusters/Mode_Oven.xml +++ b/data_model/clusters/Mode_Oven.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_RVCClean.xml b/data_model/clusters/Mode_RVCClean.xml index 0738d20c0c23dd..eed508072f6460 100644 --- a/data_model/clusters/Mode_RVCClean.xml +++ b/data_model/clusters/Mode_RVCClean.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_RVCRun.xml b/data_model/clusters/Mode_RVCRun.xml index b5811a0a6cfe05..314afe1be2a984 100644 --- a/data_model/clusters/Mode_RVCRun.xml +++ b/data_model/clusters/Mode_RVCRun.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_Refrigerator.xml b/data_model/clusters/Mode_Refrigerator.xml index d51e30b68d1320..b4550283daf9e5 100644 --- a/data_model/clusters/Mode_Refrigerator.xml +++ b/data_model/clusters/Mode_Refrigerator.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/NetworkCommissioningCluster.xml b/data_model/clusters/NetworkCommissioningCluster.xml index f9810212a79659..855947e5dda349 100644 --- a/data_model/clusters/NetworkCommissioningCluster.xml +++ b/data_model/clusters/NetworkCommissioningCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/NetworkIdentityManagement.xml b/data_model/clusters/NetworkIdentityManagement.xml deleted file mode 100644 index 20e264277a4330..00000000000000 --- a/data_model/clusters/NetworkIdentityManagement.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/OTAProvider.xml b/data_model/clusters/OTAProvider.xml index baf3996d3b911f..2a5be10961f02c 100644 --- a/data_model/clusters/OTAProvider.xml +++ b/data_model/clusters/OTAProvider.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/OTARequestor.xml b/data_model/clusters/OTARequestor.xml index 592e900ff6720b..f6a5ff0365abed 100644 --- a/data_model/clusters/OTARequestor.xml +++ b/data_model/clusters/OTARequestor.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/OTASoftwareUpdate.xml b/data_model/clusters/OTASoftwareUpdate.xml deleted file mode 100644 index 16389bd7fe9b67..00000000000000 --- a/data_model/clusters/OTASoftwareUpdate.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/OccupancySensing.xml b/data_model/clusters/OccupancySensing.xml index 9479f2041d6c6b..48756121d24769 100644 --- a/data_model/clusters/OccupancySensing.xml +++ b/data_model/clusters/OccupancySensing.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/OnOff.xml b/data_model/clusters/OnOff.xml index 0b1e32af50cddb..9366985e5ce35e 100644 --- a/data_model/clusters/OnOff.xml +++ b/data_model/clusters/OnOff.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/OperationalCredentialCluster.xml b/data_model/clusters/OperationalCredentialCluster.xml index 1a2becd5c478a2..2aa070f96b2573 100644 --- a/data_model/clusters/OperationalCredentialCluster.xml +++ b/data_model/clusters/OperationalCredentialCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/OperationalState.xml b/data_model/clusters/OperationalState.xml index 98990eac3ded4d..3648a8c81ec8f4 100644 --- a/data_model/clusters/OperationalState.xml +++ b/data_model/clusters/OperationalState.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/OperationalState_Oven.xml b/data_model/clusters/OperationalState_Oven.xml index c44ac37b7ccac9..fbcc634330faa7 100644 --- a/data_model/clusters/OperationalState_Oven.xml +++ b/data_model/clusters/OperationalState_Oven.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/OperationalState_RVC.xml b/data_model/clusters/OperationalState_RVC.xml index 7e37a6b5f6f01b..f33791fcf86407 100644 --- a/data_model/clusters/OperationalState_RVC.xml +++ b/data_model/clusters/OperationalState_RVC.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/PowerSourceCluster.xml b/data_model/clusters/PowerSourceCluster.xml index 28a9154116ed7c..1c01cc548bfdee 100644 --- a/data_model/clusters/PowerSourceCluster.xml +++ b/data_model/clusters/PowerSourceCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/PowerSourceConfigurationCluster.xml b/data_model/clusters/PowerSourceConfigurationCluster.xml index 11e3bd47dd9186..6a47ce1b54cdbd 100644 --- a/data_model/clusters/PowerSourceConfigurationCluster.xml +++ b/data_model/clusters/PowerSourceConfigurationCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/PowerTopology.xml b/data_model/clusters/PowerTopology.xml index dac690fdcc465d..4ebdda614a4aec 100644 --- a/data_model/clusters/PowerTopology.xml +++ b/data_model/clusters/PowerTopology.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/PressureMeasurement.xml b/data_model/clusters/PressureMeasurement.xml index d9c4a4584404fe..a46e911253941f 100644 --- a/data_model/clusters/PressureMeasurement.xml +++ b/data_model/clusters/PressureMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/WiFiNetworkManagement.xml b/data_model/clusters/ProxyConfiguration-Cluster.xml similarity index 75% rename from data_model/clusters/WiFiNetworkManagement.xml rename to data_model/clusters/ProxyConfiguration-Cluster.xml index 1a3fceec2747d3..8ad566ec8527b2 100644 --- a/data_model/clusters/WiFiNetworkManagement.xml +++ b/data_model/clusters/ProxyConfiguration-Cluster.xml @@ -1,6 +1,6 @@ - + - + - + + + + + + + + + + + + + + + + - - - + + + + - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/ThreadBorderRouterDiagnostics.xml b/data_model/clusters/ProxyDiscovery-Cluster.xml similarity index 73% rename from data_model/clusters/ThreadBorderRouterDiagnostics.xml rename to data_model/clusters/ProxyDiscovery-Cluster.xml index 5527c486a0cc51..6fa4a9eb6f3a06 100644 --- a/data_model/clusters/ThreadBorderRouterDiagnostics.xml +++ b/data_model/clusters/ProxyDiscovery-Cluster.xml @@ -1,6 +1,6 @@ - + - + - + - - - - - + + - - - - - + + + + + + + + + + - - - - - + + - - - - - + + + + + + + + + + diff --git a/data_model/clusters/PumpConfigurationControl.xml b/data_model/clusters/PumpConfigurationControl.xml index cfd2971a395ecb..79fafe659c95e2 100644 --- a/data_model/clusters/PumpConfigurationControl.xml +++ b/data_model/clusters/PumpConfigurationControl.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/RefrigeratorAlarm.xml b/data_model/clusters/RefrigeratorAlarm.xml index caad94da1f6fad..a3a75011813cd1 100644 --- a/data_model/clusters/RefrigeratorAlarm.xml +++ b/data_model/clusters/RefrigeratorAlarm.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: short --> - + diff --git a/data_model/clusters/Scenes.xml b/data_model/clusters/Scenes.xml index d9c0ee76fe37d2..bf68f8528fa159 100644 --- a/data_model/clusters/Scenes.xml +++ b/data_model/clusters/Scenes.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/SmokeCOAlarm.xml b/data_model/clusters/SmokeCOAlarm.xml index d3d35f13f15f25..25c034ac94082c 100644 --- a/data_model/clusters/SmokeCOAlarm.xml +++ b/data_model/clusters/SmokeCOAlarm.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Switch.xml b/data_model/clusters/Switch.xml index e7170049ac051f..c7b607c637c74c 100644 --- a/data_model/clusters/Switch.xml +++ b/data_model/clusters/Switch.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/TargetNavigator.xml b/data_model/clusters/TargetNavigator.xml index cfb3a0c17a6f99..c5fb59919585c1 100644 --- a/data_model/clusters/TargetNavigator.xml +++ b/data_model/clusters/TargetNavigator.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/TemperatureControl.xml b/data_model/clusters/TemperatureControl.xml index 70fc100d83bbab..3f5fa9c00332d6 100644 --- a/data_model/clusters/TemperatureControl.xml +++ b/data_model/clusters/TemperatureControl.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/TemperatureMeasurement.xml b/data_model/clusters/TemperatureMeasurement.xml index 540af82bcedd18..176fad6b246a60 100644 --- a/data_model/clusters/TemperatureMeasurement.xml +++ b/data_model/clusters/TemperatureMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Thermostat.xml b/data_model/clusters/Thermostat.xml index 71a0c48c6a8eb8..75640c697e0478 100644 --- a/data_model/clusters/Thermostat.xml +++ b/data_model/clusters/Thermostat.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/ThermostatUserInterfaceConfiguration.xml b/data_model/clusters/ThermostatUserInterfaceConfiguration.xml index 63fdba001c67a9..b4ecd49f93ae4a 100644 --- a/data_model/clusters/ThermostatUserInterfaceConfiguration.xml +++ b/data_model/clusters/ThermostatUserInterfaceConfiguration.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/TimeSync.xml b/data_model/clusters/TimeSync.xml index 68e98a1bf427fe..9d4057db8bdb85 100644 --- a/data_model/clusters/TimeSync.xml +++ b/data_model/clusters/TimeSync.xml @@ -58,7 +58,7 @@ Davis, CA 95616, USA :imagesdir: service_device_management/images :xrefstyle: full --> - + diff --git a/data_model/clusters/Mode_WaterHeater.xml b/data_model/clusters/ValidProxies-Cluster.xml similarity index 70% rename from data_model/clusters/Mode_WaterHeater.xml rename to data_model/clusters/ValidProxies-Cluster.xml index 56f1a1e9a66951..b9db8e1762647f 100644 --- a/data_model/clusters/Mode_WaterHeater.xml +++ b/data_model/clusters/ValidProxies-Cluster.xml @@ -1,6 +1,6 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/ValveConfigurationControl.xml b/data_model/clusters/ValveConfigurationControl.xml index 548fed7d7357c2..b0f2ec91b0fa95 100644 --- a/data_model/clusters/ValveConfigurationControl.xml +++ b/data_model/clusters/ValveConfigurationControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/WakeOnLAN.xml b/data_model/clusters/WakeOnLAN.xml index deb5af5a75ac7d..4f6e032c084b38 100644 --- a/data_model/clusters/WakeOnLAN.xml +++ b/data_model/clusters/WakeOnLAN.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/WaterHeaterManagement.xml b/data_model/clusters/WaterHeaterManagement.xml deleted file mode 100644 index cc641c8269fb3c..00000000000000 --- a/data_model/clusters/WaterHeaterManagement.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/WiFiPerDeviceCredentials.xml b/data_model/clusters/WiFiPerDeviceCredentials.xml deleted file mode 100644 index 807ea27c64053b..00000000000000 --- a/data_model/clusters/WiFiPerDeviceCredentials.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/WindowCovering.xml b/data_model/clusters/WindowCovering.xml index 7b0afd461fcb96..af59da5a9f72de 100644 --- a/data_model/clusters/WindowCovering.xml +++ b/data_model/clusters/WindowCovering.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/bridge-clusters-ActionsCluster.xml b/data_model/clusters/bridge-clusters-ActionsCluster.xml index e02b12e43d64a4..5b9b54429b9429 100644 --- a/data_model/clusters/bridge-clusters-ActionsCluster.xml +++ b/data_model/clusters/bridge-clusters-ActionsCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :sectnums: --> - + diff --git a/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml b/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml index db85cc296b8922..a7c990182a7dde 100644 --- a/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml +++ b/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :sectnums: --> - + diff --git a/data_model/clusters/cluster_ids.json b/data_model/clusters/cluster_ids.json index be7c9464690ea8..40a46edd00722e 100644 --- a/data_model/clusters/cluster_ids.json +++ b/data_model/clusters/cluster_ids.json @@ -32,6 +32,9 @@ "63": "GroupKeyManagement", "64": "Fixed Label", "65": "User Label", + "66": "ProxyConfiguration", + "67": "ProxyDiscovery", + "68": "ValidProxies", "69": "Boolean State", "70": "ICDManagement", "72": "Oven Cavity Operational State", @@ -60,17 +63,12 @@ "129": "Valve Configuration and Control", "144": "Electrical Power Measurement", "145": "Electrical Energy Measurement", - "148": "Water Heater Management", - "149": "Energy Price", - "150": "Demand Response and Load Control", "151": "Messages", "152": "Device Energy Management", "153": "Energy EVSE", - "154": "Energy Calendar", "155": "Energy Preference", "156": "Power Topology", "157": "Energy EVSE Mode", - "158": "Water Heater Mode", "159": "Device Energy Management Mode", "257": "Door Lock", "258": "Window Covering", @@ -96,8 +94,6 @@ "1069": "PM10 Concentration Measurement", "1070": "Total Volatile Organic Compounds Concentration Measurement", "1071": "Radon Concentration Measurement", - "1104": "Network Identity Management", - "1105": "Wi", "1283": "Wake on LAN", "1284": "Channel", "1285": "Target Navigator", diff --git a/data_model/clusters/energy_management.xml b/data_model/clusters/energy_management.xml deleted file mode 100644 index 93858d1d1b3c89..00000000000000 --- a/data_model/clusters/energy_management.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/network_infrastructure.xml b/data_model/clusters/network_infrastructure.xml deleted file mode 100644 index 8045740d5de0b6..00000000000000 --- a/data_model/clusters/network_infrastructure.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/device_types/BooleanSensor.xml b/data_model/device_types/BooleanSensor.xml deleted file mode 100644 index 185fdc47176813..00000000000000 --- a/data_model/device_types/BooleanSensor.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/ColorDimmerSwitch.xml b/data_model/device_types/ColorDimmerSwitch.xml index e391700918e1c4..190ab6c7fc8b7e 100644 --- a/data_model/device_types/ColorDimmerSwitch.xml +++ b/data_model/device_types/ColorDimmerSwitch.xml @@ -80,7 +80,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/ColorTemperatureLight.xml b/data_model/device_types/ColorTemperatureLight.xml index e782dd24f58f4f..4f7cf64a9fd0a2 100644 --- a/data_model/device_types/ColorTemperatureLight.xml +++ b/data_model/device_types/ColorTemperatureLight.xml @@ -107,10 +107,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/ControlBridge.xml b/data_model/device_types/ControlBridge.xml index 27e00f69403728..04ff66db808cc9 100644 --- a/data_model/device_types/ControlBridge.xml +++ b/data_model/device_types/ControlBridge.xml @@ -80,7 +80,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/DimmableLight.xml b/data_model/device_types/DimmableLight.xml index ec66b81a610451..059a0802f77906 100644 --- a/data_model/device_types/DimmableLight.xml +++ b/data_model/device_types/DimmableLight.xml @@ -106,10 +106,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/DimmablePlug-InUnit.xml b/data_model/device_types/DimmablePlug-InUnit.xml index bbd043912ab6d7..4d344bfc9fb89c 100644 --- a/data_model/device_types/DimmablePlug-InUnit.xml +++ b/data_model/device_types/DimmablePlug-InUnit.xml @@ -107,10 +107,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/DimmerSwitch.xml b/data_model/device_types/DimmerSwitch.xml index 008e54eee8efc3..0ad9f23638349a 100644 --- a/data_model/device_types/DimmerSwitch.xml +++ b/data_model/device_types/DimmerSwitch.xml @@ -80,7 +80,10 @@ Davis, CA 95616, USA - + + + + \ No newline at end of file diff --git a/data_model/device_types/DoorLockController.xml b/data_model/device_types/DoorLockController.xml index 30342b95a126bd..4d031a37be1eec 100644 --- a/data_model/device_types/DoorLockController.xml +++ b/data_model/device_types/DoorLockController.xml @@ -68,7 +68,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/EnergyTariff.xml b/data_model/device_types/EnergyTariff.xml deleted file mode 100644 index bf27554ff281db..00000000000000 --- a/data_model/device_types/EnergyTariff.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/EnergyTariffCalendar.xml b/data_model/device_types/EnergyTariffCalendar.xml deleted file mode 100644 index ee3a6b9347db38..00000000000000 --- a/data_model/device_types/EnergyTariffCalendar.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/ExtendedColorLight.xml b/data_model/device_types/ExtendedColorLight.xml index 75988addc3f8cd..b4057d6b5bc997 100644 --- a/data_model/device_types/ExtendedColorLight.xml +++ b/data_model/device_types/ExtendedColorLight.xml @@ -107,10 +107,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/HeatingCoolingUnit.xml b/data_model/device_types/HeatingCoolingUnit.xml deleted file mode 100644 index 39fbb766111b31..00000000000000 --- a/data_model/device_types/HeatingCoolingUnit.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/NetworkInfraIntro-CommonRequirements.xml b/data_model/device_types/NetworkInfraIntro-CommonRequirements.xml deleted file mode 100644 index 454dc857f0b8db..00000000000000 --- a/data_model/device_types/NetworkInfraIntro-CommonRequirements.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/device_types/NetworkInfraIntro-Introduction.xml b/data_model/device_types/NetworkInfraIntro-Introduction.xml deleted file mode 100644 index e5bc56b1f095ac..00000000000000 --- a/data_model/device_types/NetworkInfraIntro-Introduction.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/device_types/NetworkInfraIntro.xml b/data_model/device_types/NetworkInfraIntro.xml deleted file mode 100644 index 22d91b6f459c6d..00000000000000 --- a/data_model/device_types/NetworkInfraIntro.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/device_types/NetworkInfraManager.xml b/data_model/device_types/NetworkInfraManager.xml deleted file mode 100644 index 67c3ee49f75f92..00000000000000 --- a/data_model/device_types/NetworkInfraManager.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/OnOffLight.xml b/data_model/device_types/OnOffLight.xml index fe98ac6b6d7028..f71c0bf77fa42c 100644 --- a/data_model/device_types/OnOffLight.xml +++ b/data_model/device_types/OnOffLight.xml @@ -86,7 +86,7 @@ Davis, CA 95616, USA - + @@ -106,10 +106,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/OnOffLightSwitch.xml b/data_model/device_types/OnOffLightSwitch.xml index 9896264d5b9e4f..d6ac7f79520d26 100644 --- a/data_model/device_types/OnOffLightSwitch.xml +++ b/data_model/device_types/OnOffLightSwitch.xml @@ -77,7 +77,10 @@ Davis, CA 95616, USA - + + + + \ No newline at end of file diff --git a/data_model/device_types/OnOffPlug-inUnit.xml b/data_model/device_types/OnOffPlug-inUnit.xml index dbcb7f7e739629..3be1ed0f9eb13d 100644 --- a/data_model/device_types/OnOffPlug-inUnit.xml +++ b/data_model/device_types/OnOffPlug-inUnit.xml @@ -86,7 +86,7 @@ Davis, CA 95616, USA - + @@ -106,10 +106,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/OnOffSensor.xml b/data_model/device_types/OnOffSensor.xml index cdd59585119fa2..935a438fb0bbef 100644 --- a/data_model/device_types/OnOffSensor.xml +++ b/data_model/device_types/OnOffSensor.xml @@ -80,7 +80,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/Pump.xml b/data_model/device_types/Pump.xml index f8c0ce92b1229d..461725136abaec 100644 --- a/data_model/device_types/Pump.xml +++ b/data_model/device_types/Pump.xml @@ -77,7 +77,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/PumpController.xml b/data_model/device_types/PumpController.xml index 3b27f35737197b..3dcb36899ec908 100644 --- a/data_model/device_types/PumpController.xml +++ b/data_model/device_types/PumpController.xml @@ -82,7 +82,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/RoomAirConditioner.xml b/data_model/device_types/RoomAirConditioner.xml index 7f3acd50eb2c91..305a893dabc0fe 100644 --- a/data_model/device_types/RoomAirConditioner.xml +++ b/data_model/device_types/RoomAirConditioner.xml @@ -78,7 +78,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/Thermostat.xml b/data_model/device_types/Thermostat.xml index 16c0efe75620a0..49ba4b6779f084 100644 --- a/data_model/device_types/Thermostat.xml +++ b/data_model/device_types/Thermostat.xml @@ -95,7 +95,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/ThreadBorderRouter.xml b/data_model/device_types/ThreadBorderRouter.xml deleted file mode 100644 index a0aee3bfeb0433..00000000000000 --- a/data_model/device_types/ThreadBorderRouter.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/ThreePhasePowerSource.xml b/data_model/device_types/ThreePhasePowerSource.xml deleted file mode 100644 index 726af1a16c10a4..00000000000000 --- a/data_model/device_types/ThreePhasePowerSource.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/Valve.xml b/data_model/device_types/Valve.xml deleted file mode 100644 index 4ce864b01ab246..00000000000000 --- a/data_model/device_types/Valve.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/WaterHeater.xml b/data_model/device_types/WaterHeater.xml deleted file mode 100644 index eeebfee95ea300..00000000000000 --- a/data_model/device_types/WaterHeater.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/WindowCovering.xml b/data_model/device_types/WindowCovering.xml index e647e8aa005959..a2d54453b7337f 100644 --- a/data_model/device_types/WindowCovering.xml +++ b/data_model/device_types/WindowCovering.xml @@ -77,6 +77,7 @@ Davis, CA 95616, USA + diff --git a/data_model/device_types/WindowCoveringController.xml b/data_model/device_types/WindowCoveringController.xml index 406953630947ea..c48f327754c599 100644 --- a/data_model/device_types/WindowCoveringController.xml +++ b/data_model/device_types/WindowCoveringController.xml @@ -80,6 +80,7 @@ Davis, CA 95616, USA + diff --git a/data_model/spec_sha b/data_model/spec_sha index cb39a57acee19b..274f0d55122714 100644 --- a/data_model/spec_sha +++ b/data_model/spec_sha @@ -1 +1 @@ -5cf986ac3980bb2b658bae7bf13df8aeec021999 +ab9cf4653d40fe9193bbc7fe9febf74c08bf7dfa diff --git a/docs/spec_clusters.md b/docs/spec_clusters.md index 02715424bbb5d8..976b9f85e42c19 100644 --- a/docs/spec_clusters.md +++ b/docs/spec_clusters.md @@ -36,6 +36,9 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |63 |0x003F |GroupKeyManagement | |64 |0x0040 |Fixed Label | |65 |0x0041 |User Label | +|66 |0x0042 |ProxyConfiguration | +|67 |0x0043 |ProxyDiscovery | +|68 |0x0044 |ValidProxies | |69 |0x0045 |Boolean State | |70 |0x0046 |ICDManagement | |72 |0x0048 |Oven Cavity Operational State | @@ -64,17 +67,12 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |129 |0x0081 |Valve Configuration and Control | |144 |0x0090 |Electrical Power Measurement | |145 |0x0091 |Electrical Energy Measurement | -|148 |0x0094 |Water Heater Management | -|149 |0x0095 |Energy Price | -|150 |0x0096 |Demand Response and Load Control | |151 |0x0097 |Messages | |152 |0x0098 |Device Energy Management | |153 |0x0099 |Energy EVSE | -|154 |0x009A |Energy Calendar | |155 |0x009B |Energy Preference | |156 |0x009C |Power Topology | |157 |0x009D |Energy EVSE Mode | -|158 |0x009E |Water Heater Mode | |159 |0x009F |Device Energy Management Mode | |257 |0x0101 |Door Lock | |258 |0x0102 |Window Covering | @@ -100,8 +98,6 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |1069 |0x042D |PM10 Concentration Measurement | |1070 |0x042E |Total Volatile Organic Compounds Concentration Measurement| |1071 |0x042F |Radon Concentration Measurement | -|1104 |0x0450 |Network Identity Management | -|1105 |0x0451 |Wi | |1283 |0x0503 |Wake on LAN | |1284 |0x0504 |Channel | |1285 |0x0505 |Target Navigator | diff --git a/scripts/spec_xml/generate_spec_xml.py b/scripts/spec_xml/generate_spec_xml.py index ecdd47e6a6904f..bb33c13533991d 100755 --- a/scripts/spec_xml/generate_spec_xml.py +++ b/scripts/spec_xml/generate_spec_xml.py @@ -140,16 +140,6 @@ def scrape_all_clusters(dir: str, exclude_list: list[str] = []) -> None: print(f'Removing file {xml_path} as it does not include any cluster definitions') os.remove(xml_path) continue - # For now, we're going to manually remove the word "Cluster" from the cluster name field - # to make the diff easier. The update to 1.2.4 of the scraper added this. - # TODO: submit a separate PR with JUST this change revered and remove this code. - with open(xml_path, 'rb') as input: - xml_str = input.read() - - original_name = bytes(cluster.attrib['name'], 'utf-8') - replacement_name = bytes(cluster.attrib['name'].removesuffix(" Cluster"), 'utf-8') - with open(xml_path, 'wb') as output: - output.write(xml_str.replace(original_name, replacement_name)) def scrape_device_types(scraper, spec_root, output_dir, dry_run, include_in_progress): From 3cc96a14bede4b757fc457c919809af92e8794a2 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Tue, 4 Jun 2024 16:14:51 +0200 Subject: [PATCH 043/162] Replace nl-unit-test with pigweed for protocols/secure_channel (#33499) * secure channel tests to pigweed * Remove nlunit tests dependency * Update conversion to pigweed * Relocate class * Revert old implementation * Restore * Move definition of TEST_F_FROM_FIXTURE to UnitTest * Fix test error * Add missing deps * Revert order change * Restyle * Revert * Add missing header * Add UnitTestPigweedUtils * IoT SDK update tests list * Remove unused define * Change target type * license * Assert * rollback * cleanup * Change function to method * Restyle * Fix dependency between tests * Fix merge * Fix * Review fix * Fix typo * Fix review issues * Fix review issues --- src/BUILD.gn | 1 - src/lib/support/tests/BUILD.gn | 9 + src/lib/support/tests/ExtraPwTestMacros.h | 56 ++ src/protocols/secure_channel/tests/BUILD.gn | 38 +- .../secure_channel/tests/TestCASESession.cpp | 620 ++++++++---------- .../tests/TestCheckInCounter.cpp | 2 - .../TestDefaultSessionResumptionStorage.cpp | 234 +++---- .../tests/TestMessageCounterManager.cpp | 117 +--- .../secure_channel/tests/TestPASESession.cpp | 370 +++++------ .../tests/TestPairingSession.cpp | 115 +--- .../TestSimpleSessionResumptionStorage.cpp | 97 +-- .../secure_channel/tests/TestStatusReport.cpp | 137 ++-- src/system/tests/BUILD.gn | 1 + src/system/tests/TestSystemPacketBuffer.cpp | 11 +- .../unit-tests/test_components_nl.txt | 3 +- 15 files changed, 694 insertions(+), 1117 deletions(-) create mode 100644 src/lib/support/tests/ExtraPwTestMacros.h diff --git a/src/BUILD.gn b/src/BUILD.gn index 5f7d6cc95ab6ba..d455a596b4e346 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -101,7 +101,6 @@ if (chip_build_tests) { "${chip_root}/src/lib/format/tests", "${chip_root}/src/lib/support/tests", "${chip_root}/src/protocols/secure_channel/tests", - "${chip_root}/src/protocols/secure_channel/tests:tests_nltest", "${chip_root}/src/system/tests", "${chip_root}/src/transport/tests", ] diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn index 565eb85097d133..b8cdcfeb2e059f 100644 --- a/src/lib/support/tests/BUILD.gn +++ b/src/lib/support/tests/BUILD.gn @@ -19,6 +19,15 @@ import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/chip_test_suite.gni") +pw_source_set("pw-test-macros") { + output_dir = "${root_out_dir}/lib" + public_deps = [ + "$dir_pw_log:impl", + "$dir_pw_unit_test", + ] + sources = [ "ExtraPwTestMacros.h" ] +} + chip_test_suite("tests") { output_name = "libSupportTests" diff --git a/src/lib/support/tests/ExtraPwTestMacros.h b/src/lib/support/tests/ExtraPwTestMacros.h new file mode 100644 index 00000000000000..ab592800716592 --- /dev/null +++ b/src/lib/support/tests/ExtraPwTestMacros.h @@ -0,0 +1,56 @@ +/* + * + * Copyright (c) 2024 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 + +/* + * Run Fixture's class function as a test. + * It is used to execute test cases that need to use private members of a particular class. + * Unlike the pigweed macro `FRIEND_TEST`, this approach allows you to define the entire + * test_fixture class as a friend, rather than having to define each testcase as a friend. + * + * @param test_fixture - the fixture class. + * + * @param test_name - the name of the test function. + * + * Example: + * class Foo // class to be tested + * { + * friend class TestCtx; + * private: + * bool privateFunction(); + * }; + * + * class TestCtx: public ::testing::Test + * { + * public: + * void testFunction(); + * }; + * + * TEST_F_FROM_FIXTURE(TestCtx, testFunction) + * { + * Foo foo; + * EXPECT_TRUE(foo.privateFunction()); + * } + * + */ +#define TEST_F_FROM_FIXTURE(test_fixture, test_name) \ + TEST_F(test_fixture, test_name) \ + { \ + test_name(); \ + } \ + void test_fixture::test_name() diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn index 371937c4297b7b..0760998e818422 100644 --- a/src/protocols/secure_channel/tests/BUILD.gn +++ b/src/protocols/secure_channel/tests/BUILD.gn @@ -1,6 +1,5 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/app/icd/icd.gni") @@ -8,32 +7,9 @@ chip_test_suite("tests") { output_name = "libSecureChannelTests" test_sources = [ + "TestCASESession.cpp", "TestCheckInCounter.cpp", "TestCheckinMsg.cpp", - ] - - sources = [ "CheckIn_Message_test_vectors.h" ] - - cflags = [ "-Wconversion" ] - public_deps = [ - "${chip_root}/src/app/icd/server:icd-server-config", - "${chip_root}/src/credentials/tests:cert_test_vectors", - "${chip_root}/src/lib/core", - "${chip_root}/src/lib/support", - "${chip_root}/src/lib/support:test_utils", - "${chip_root}/src/lib/support:testing", - "${chip_root}/src/protocols/secure_channel", - "${chip_root}/src/protocols/secure_channel:check-in-counter", - "${dir_pw_unit_test}", - ] -} - -chip_test_suite_using_nltest("tests_nltest") { - # Renamed ouput during the transition away from nltest - output_name = "libSecureChannelTestsNL" - - test_sources = [ - "TestCASESession.cpp", "TestDefaultSessionResumptionStorage.cpp", "TestPASESession.cpp", "TestPairingSession.cpp", @@ -44,22 +20,26 @@ chip_test_suite_using_nltest("tests_nltest") { # "TestMessageCounterManager.cpp", ] + sources = [ "CheckIn_Message_test_vectors.h" ] + + cflags = [ "-Wconversion" ] public_deps = [ + "${chip_root}/src/app/icd/server:icd-server-config", + "${chip_root}/src/credentials/tests:cert_test_vectors", "${chip_root}/src/crypto/tests:tests.lib", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/lib/support:test_utils", "${chip_root}/src/lib/support:testing", - "${chip_root}/src/lib/support:testing_nlunit", + "${chip_root}/src/lib/support/tests:pw-test-macros", "${chip_root}/src/messaging/tests:helpers", "${chip_root}/src/protocols", "${chip_root}/src/protocols/secure_channel", + "${chip_root}/src/protocols/secure_channel:check-in-counter", "${chip_root}/src/transport/raw/tests:helpers", - "${nlunit_test_root}:nlunit-test", + "${dir_pw_unit_test}", ] - cflags = [ "-Wconversion" ] - if (chip_enable_icd_server) { public_deps += [ "${chip_root}/src/app/icd/server:configuration-data" ] } diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index 68d6ddd177eeb8..24aaffce0dbcb4 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -34,10 +35,8 @@ #include #include #include -#include -#include +#include #include -#include #include #include #include @@ -55,9 +54,9 @@ using namespace chip::Protocols; using namespace chip::Crypto; namespace chip { -namespace { +class TestCASESecurePairingDelegate; -class TestContext : public Test::LoopbackMessagingContext +class TestCASESession : public Test::LoopbackMessagingContext, public ::testing::Test { public: // Performs shared setup for all tests in the test suite @@ -70,16 +69,23 @@ class TestContext : public Test::LoopbackMessagingContext ConfigInitializeNodes(false); chip::Test::LoopbackMessagingContext::SetUp(); } + virtual void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } + + void ServiceEvents(); + void SecurePairingHandshakeTestCommon(SessionManager & sessionManager, CASESession & pairingCommissioner, + TestCASESecurePairingDelegate & delegateCommissioner); + + void SimulateUpdateNOCInvalidatePendingEstablishment(); }; -void ServiceEvents(TestContext & ctx) +void TestCASESession::ServiceEvents() { // Takes a few rounds of this because handling IO messages may schedule work, // and scheduled work may queue messages for sending... for (int i = 0; i < 3; ++i) { - ctx.DrainAndServiceIO(); + DrainAndServiceIO(); chip::DeviceLayer::PlatformMgr().ScheduleWork( [](intptr_t) -> void { chip::DeviceLayer::PlatformMgr().StopEventLoopTask(); }, (intptr_t) nullptr); @@ -90,12 +96,11 @@ void ServiceEvents(TestContext & ctx) class TemporarySessionManager { public: - TemporarySessionManager(nlTestSuite * suite, TestContext & ctx) : mCtx(ctx) + TemporarySessionManager(TestCASESession & ctx) : mCtx(ctx) { - NL_TEST_ASSERT(suite, - CHIP_NO_ERROR == - mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), - &mStorage, &ctx.GetFabricTable(), ctx.GetSessionKeystore())); + EXPECT_EQ(CHIP_NO_ERROR, + mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), &mStorage, + &ctx.GetFabricTable(), ctx.GetSessionKeystore())); // The setup here is really weird: we are using one session manager for // the actual messages we send (the PASE handshake, so the // unauthenticated sessions) and a different one for allocating the PASE @@ -115,7 +120,7 @@ class TemporarySessionManager operator SessionManager &() { return mSessionManager; } private: - TestContext & mCtx; + TestCASESession & mCtx; TestPersistentStorageDelegate mStorage; SessionManager mSessionManager; }; @@ -334,22 +339,22 @@ CHIP_ERROR InitCredentialSets() return CHIP_NO_ERROR; } -void TestContext::SetUpTestSuite() +void TestCASESession::SetUpTestSuite() { - CHIP_ERROR err = CHIP_NO_ERROR; LoopbackMessagingContext::SetUpTestSuite(); - // TODO: use ASSERT_EQ, once transition to pw_unit_test is complete - VerifyOrDieWithMsg((err = chip::DeviceLayer::PlatformMgr().InitChipStack()) == CHIP_NO_ERROR, AppServer, - "Init CHIP stack failed: %" CHIP_ERROR_FORMAT, err.Format()); - VerifyOrDieWithMsg((err = InitFabricTable(gCommissionerFabrics, &gCommissionerStorageDelegate, /* opKeyStore = */ nullptr, - &gCommissionerOpCertStore)) == CHIP_NO_ERROR, - AppServer, "InitFabricTable failed: %" CHIP_ERROR_FORMAT, err.Format()); - VerifyOrDieWithMsg((err = InitCredentialSets()) == CHIP_NO_ERROR, AppServer, "InitCredentialSets failed: %" CHIP_ERROR_FORMAT, - err.Format()); + + ASSERT_EQ(chip::DeviceLayer::PlatformMgr().InitChipStack(), CHIP_NO_ERROR); + + ASSERT_EQ( + InitFabricTable(gCommissionerFabrics, &gCommissionerStorageDelegate, /* opKeyStore = */ nullptr, &gCommissionerOpCertStore), + CHIP_NO_ERROR); + + ASSERT_EQ(InitCredentialSets(), CHIP_NO_ERROR); + chip::DeviceLayer::SetSystemLayerForTesting(&GetSystemLayer()); } -void TestContext::TearDownTestSuite() +void TestCASESession::TearDownTestSuite() { chip::DeviceLayer::SetSystemLayerForTesting(nullptr); gDeviceOperationalKeystore.Shutdown(); @@ -362,52 +367,27 @@ void TestContext::TearDownTestSuite() LoopbackMessagingContext::TearDownTestSuite(); } -} // anonymous namespace - -// Specifically for SimulateUpdateNOCInvalidatePendingEstablishment, we need it to be static so that the class below can -// be a friend to CASESession so that test can get access to CASESession::State and test method that are not public. To -// keep the rest of this file consistent we brought all other tests into this class. -class TestCASESession +TEST_F(TestCASESession, SecurePairingWaitTest) { -public: - static void SecurePairingWaitTest(nlTestSuite * inSuite, void * inContext); - static void SecurePairingStartTest(nlTestSuite * inSuite, void * inContext); - static void SecurePairingHandshakeTest(nlTestSuite * inSuite, void * inContext); - static void SecurePairingHandshakeServerTest(nlTestSuite * inSuite, void * inContext); - static void ClientReceivesBusyTest(nlTestSuite * inSuite, void * inContext); - static void Sigma1ParsingTest(nlTestSuite * inSuite, void * inContext); - static void DestinationIdTest(nlTestSuite * inSuite, void * inContext); - static void SessionResumptionStorage(nlTestSuite * inSuite, void * inContext); -#if CONFIG_BUILD_FOR_HOST_UNIT_TEST - static void SimulateUpdateNOCInvalidatePendingEstablishment(nlTestSuite * inSuite, void * inContext); -#endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST - static void Sigma1BadDestinationIdTest(nlTestSuite * inSuite, void * inContext); -}; - -void TestCASESession::SecurePairingWaitTest(nlTestSuite * inSuite, void * inContext) -{ - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); // Test all combinations of invalid parameters TestCASESecurePairingDelegate delegate; - FabricTable fabrics; + // Making this static to reduce stack usage, as some platforms have limits on stack size. + static FabricTable fabrics; CASESession caseSession; - NL_TEST_ASSERT(inSuite, caseSession.GetSecureSessionType() == SecureSession::Type::kCASE); + EXPECT_EQ(caseSession.GetSecureSessionType(), SecureSession::Type::kCASE); caseSession.SetGroupDataProvider(&gDeviceGroupDataProvider); - NL_TEST_ASSERT(inSuite, - caseSession.PrepareForSessionEstablishment(sessionManager, nullptr, nullptr, nullptr, nullptr, ScopedNodeId(), - Optional::Missing()) == - CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, - caseSession.PrepareForSessionEstablishment(sessionManager, nullptr, nullptr, nullptr, &delegate, ScopedNodeId(), - Optional::Missing()) == - CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, - caseSession.PrepareForSessionEstablishment(sessionManager, &fabrics, nullptr, nullptr, &delegate, ScopedNodeId(), - Optional::Missing()) == CHIP_NO_ERROR); + EXPECT_EQ(caseSession.PrepareForSessionEstablishment(sessionManager, nullptr, nullptr, nullptr, nullptr, ScopedNodeId(), + Optional::Missing()), + CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(caseSession.PrepareForSessionEstablishment(sessionManager, nullptr, nullptr, nullptr, &delegate, ScopedNodeId(), + Optional::Missing()), + CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(caseSession.PrepareForSessionEstablishment(sessionManager, &fabrics, nullptr, nullptr, &delegate, ScopedNodeId(), + Optional::Missing()), + CHIP_NO_ERROR); // Calling Clear() here since ASAN will have an issue if FabricTable destructor is called before CASESession's // destructor. We could reorder FabricTable and CaseSession, but this makes it a little more clear what we are @@ -415,42 +395,37 @@ void TestCASESession::SecurePairingWaitTest(nlTestSuite * inSuite, void * inCont caseSession.Clear(); } -void TestCASESession::SecurePairingStartTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, SecurePairingStartTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); // Test all combinations of invalid parameters TestCASESecurePairingDelegate delegate; CASESession pairing; pairing.SetGroupDataProvider(&gCommissionerGroupDataProvider); - ExchangeContext * context = ctx.NewUnauthenticatedExchangeToBob(&pairing); + ExchangeContext * context = NewUnauthenticatedExchangeToBob(&pairing); - NL_TEST_ASSERT(inSuite, - pairing.EstablishSession(sessionManager, nullptr, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, nullptr, - nullptr, nullptr, nullptr, - Optional::Missing()) != CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_NE(pairing.EstablishSession(sessionManager, nullptr, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, nullptr, + nullptr, nullptr, nullptr, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); - NL_TEST_ASSERT(inSuite, - pairing.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, nullptr, nullptr, nullptr, nullptr, - Optional::Missing()) != CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_NE(pairing.EstablishSession(sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + nullptr, nullptr, nullptr, nullptr, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); - NL_TEST_ASSERT(inSuite, - pairing.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, context, nullptr, nullptr, - &delegate, Optional::Missing()) == CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_EQ(pairing.EstablishSession(sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + context, nullptr, nullptr, &delegate, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); // There should have been two message sent: Sigma1 and an ack. - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == 2); + EXPECT_EQ(loopback.mSentMessageCount, 2u); - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); - NL_TEST_ASSERT(inSuite, rm->TestGetCountRetransTable() == 0); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); + EXPECT_EQ(rm->TestGetCountRetransTable(), 0); loopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; @@ -459,22 +434,19 @@ void TestCASESession::SecurePairingStartTest(nlTestSuite * inSuite, void * inCon loopback.mSentMessageCount = 0; loopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; - ExchangeContext * context1 = ctx.NewUnauthenticatedExchangeToBob(&pairing1); + ExchangeContext * context1 = NewUnauthenticatedExchangeToBob(&pairing1); - NL_TEST_ASSERT(inSuite, - pairing1.EstablishSession( - sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, context1, - nullptr, nullptr, &delegate, Optional::Missing()) == CHIP_ERROR_BAD_REQUEST); - ServiceEvents(ctx); + EXPECT_EQ(pairing1.EstablishSession(sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + context1, nullptr, nullptr, &delegate, Optional::Missing()), + CHIP_ERROR_BAD_REQUEST); + ServiceEvents(); loopback.mMessageSendError = CHIP_NO_ERROR; } -void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, SessionManager & sessionManager, - CASESession & pairingCommissioner, TestCASESecurePairingDelegate & delegateCommissioner) +void TestCASESession::SecurePairingHandshakeTestCommon(SessionManager & sessionManager, CASESession & pairingCommissioner, + TestCASESecurePairingDelegate & delegateCommissioner) { - TestContext & ctx = *reinterpret_cast(inContext); - // Test all combinations of invalid parameters TestCASESecurePairingDelegate delegateAccessory; CASESession pairingAccessory; @@ -483,39 +455,36 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S ReliableMessageProtocolConfig nonSleepyCommissionerRmpConfig( System::Clock::Milliseconds32(5000), System::Clock::Milliseconds32(300), System::Clock::Milliseconds16(4000)); - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::CASE_Sigma1, - &pairingAccessory) == CHIP_NO_ERROR); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::CASE_Sigma1, + &pairingAccessory), + CHIP_NO_ERROR); - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); pairingAccessory.SetGroupDataProvider(&gDeviceGroupDataProvider); - NL_TEST_ASSERT(inSuite, - pairingAccessory.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, - &delegateAccessory, ScopedNodeId(), - MakeOptional(verySleepyAccessoryRmpConfig)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, - nullptr, nullptr, &delegateCommissioner, - MakeOptional(nonSleepyCommissionerRmpConfig)) == CHIP_NO_ERROR); - ServiceEvents(ctx); - - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == sTestCaseMessageCount); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, pairingAccessory.GetRemoteMRPConfig().mIdleRetransTimeout == System::Clock::Milliseconds32(5000)); - NL_TEST_ASSERT(inSuite, pairingAccessory.GetRemoteMRPConfig().mActiveRetransTimeout == System::Clock::Milliseconds32(300)); - NL_TEST_ASSERT(inSuite, pairingAccessory.GetRemoteMRPConfig().mActiveThresholdTime == System::Clock::Milliseconds16(4000)); - NL_TEST_ASSERT(inSuite, pairingCommissioner.GetRemoteMRPConfig().mIdleRetransTimeout == System::Clock::Milliseconds32(360000)); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.GetRemoteMRPConfig().mActiveRetransTimeout == System::Clock::Milliseconds32(100000)); - NL_TEST_ASSERT(inSuite, pairingCommissioner.GetRemoteMRPConfig().mActiveThresholdTime == System::Clock::Milliseconds16(300)); + EXPECT_EQ(pairingAccessory.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, &delegateAccessory, + ScopedNodeId(), MakeOptional(verySleepyAccessoryRmpConfig)), + CHIP_NO_ERROR); + EXPECT_EQ(pairingCommissioner.EstablishSession( + sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, + nullptr, nullptr, &delegateCommissioner, MakeOptional(nonSleepyCommissionerRmpConfig)), + CHIP_NO_ERROR); + ServiceEvents(); + + EXPECT_EQ(loopback.mSentMessageCount, sTestCaseMessageCount); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mIdleRetransTimeout, System::Clock::Milliseconds32(5000)); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mActiveRetransTimeout, System::Clock::Milliseconds32(300)); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mActiveThresholdTime, System::Clock::Milliseconds16(4000)); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mIdleRetransTimeout, System::Clock::Milliseconds32(360000)); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mActiveRetransTimeout, System::Clock::Milliseconds32(100000)); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mActiveThresholdTime, System::Clock::Milliseconds16(300)); #if CONFIG_BUILD_FOR_HOST_UNIT_TEST // Confirming that FabricTable sending a notification that fabric was updated doesn't affect // already established connections. @@ -523,26 +492,24 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S // This is compiled for host tests which is enough test coverage gCommissionerFabrics.SendUpdateFabricNotificationForTest(gCommissionerFabricIndex); gDeviceFabrics.SendUpdateFabricNotificationForTest(gDeviceFabricIndex); - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == sTestCaseMessageCount); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); + EXPECT_EQ(loopback.mSentMessageCount, sTestCaseMessageCount); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST } -void TestCASESession::SecurePairingHandshakeTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, SecurePairingHandshakeTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); TestCASESecurePairingDelegate delegateCommissioner; CASESession pairingCommissioner; pairingCommissioner.SetGroupDataProvider(&gCommissionerGroupDataProvider); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, delegateCommissioner); + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, delegateCommissioner); } -void TestCASESession::SecurePairingHandshakeServerTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, SecurePairingHandshakeServerTest) { // TODO: Add cases for mismatching IPK config between initiator/responder @@ -551,47 +518,43 @@ void TestCASESession::SecurePairingHandshakeServerTest(nlTestSuite * inSuite, vo auto * pairingCommissioner = chip::Platform::New(); pairingCommissioner->SetGroupDataProvider(&gCommissionerGroupDataProvider); - TestContext & ctx = *reinterpret_cast(inContext); - - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.mSentMessageCount = 0; // Use the same session manager on both CASE client and server sides to validate that both // components may work simultaneously on a single device. - NL_TEST_ASSERT(inSuite, - gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &ctx.GetSecureSessionManager(), - &gDeviceFabrics, nullptr, nullptr, - &gDeviceGroupDataProvider) == CHIP_NO_ERROR); + EXPECT_EQ(gPairingServer.ListenForSessionEstablishment(&GetExchangeManager(), &GetSecureSessionManager(), &gDeviceFabrics, + nullptr, nullptr, &gDeviceGroupDataProvider), + CHIP_NO_ERROR); - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(pairingCommissioner); - NL_TEST_ASSERT(inSuite, - pairingCommissioner->EstablishSession(ctx.GetSecureSessionManager(), &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, - nullptr, nullptr, &delegateCommissioner, - Optional::Missing()) == CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_EQ(pairingCommissioner->EstablishSession( + GetSecureSessionManager(), &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + contextCommissioner, nullptr, nullptr, &delegateCommissioner, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == sTestCaseMessageCount); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); + EXPECT_EQ(loopback.mSentMessageCount, sTestCaseMessageCount); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); // Validate that secure session is created SessionHolder & holder = delegateCommissioner.GetSessionHolder(); - NL_TEST_ASSERT(inSuite, bool(holder)); + EXPECT_TRUE(bool(holder)); - NL_TEST_ASSERT(inSuite, (holder->GetPeer() == chip::ScopedNodeId{ Node01_01, gCommissionerFabricIndex })); + EXPECT_EQ(holder->GetPeer(), (chip::ScopedNodeId{ Node01_01, gCommissionerFabricIndex })); auto * pairingCommissioner1 = chip::Platform::New(); pairingCommissioner1->SetGroupDataProvider(&gCommissionerGroupDataProvider); - ExchangeContext * contextCommissioner1 = ctx.NewUnauthenticatedExchangeToBob(pairingCommissioner1); + ExchangeContext * contextCommissioner1 = NewUnauthenticatedExchangeToBob(pairingCommissioner1); - NL_TEST_ASSERT(inSuite, - pairingCommissioner1->EstablishSession(ctx.GetSecureSessionManager(), &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner1, - nullptr, nullptr, &delegateCommissioner, - Optional::Missing()) == CHIP_NO_ERROR); + EXPECT_EQ(pairingCommissioner1->EstablishSession(GetSecureSessionManager(), &gCommissionerFabrics, + ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner1, + nullptr, nullptr, &delegateCommissioner, + Optional::Missing()), + CHIP_NO_ERROR); - ServiceEvents(ctx); + ServiceEvents(); chip::Platform::Delete(pairingCommissioner); chip::Platform::Delete(pairingCommissioner1); @@ -599,52 +562,49 @@ void TestCASESession::SecurePairingHandshakeServerTest(nlTestSuite * inSuite, vo gPairingServer.Shutdown(); } -void TestCASESession::ClientReceivesBusyTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, ClientReceivesBusyTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); TestCASESecurePairingDelegate delegateCommissioner1, delegateCommissioner2; CASESession pairingCommissioner1, pairingCommissioner2; pairingCommissioner1.SetGroupDataProvider(&gCommissionerGroupDataProvider); pairingCommissioner2.SetGroupDataProvider(&gCommissionerGroupDataProvider); - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, - gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &ctx.GetSecureSessionManager(), - &gDeviceFabrics, nullptr, nullptr, - &gDeviceGroupDataProvider) == CHIP_NO_ERROR); + EXPECT_EQ(gPairingServer.ListenForSessionEstablishment(&GetExchangeManager(), &GetSecureSessionManager(), &gDeviceFabrics, + nullptr, nullptr, &gDeviceGroupDataProvider), + CHIP_NO_ERROR); - ExchangeContext * contextCommissioner1 = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner1); - ExchangeContext * contextCommissioner2 = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner2); + ExchangeContext * contextCommissioner1 = NewUnauthenticatedExchangeToBob(&pairingCommissioner1); + ExchangeContext * contextCommissioner2 = NewUnauthenticatedExchangeToBob(&pairingCommissioner2); - NL_TEST_ASSERT(inSuite, - pairingCommissioner1.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner1, - nullptr, nullptr, &delegateCommissioner1, NullOptional) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - pairingCommissioner2.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner2, - nullptr, nullptr, &delegateCommissioner2, NullOptional) == CHIP_NO_ERROR); + EXPECT_EQ(pairingCommissioner1.EstablishSession(sessionManager, &gCommissionerFabrics, + ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner1, + nullptr, nullptr, &delegateCommissioner1, NullOptional), + CHIP_NO_ERROR); + EXPECT_EQ(pairingCommissioner2.EstablishSession(sessionManager, &gCommissionerFabrics, + ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner2, + nullptr, nullptr, &delegateCommissioner2, NullOptional), + CHIP_NO_ERROR); - ServiceEvents(ctx); + ServiceEvents(); // We should have one full handshake and one Sigma1 + Busy + ack. If that // ever changes (e.g. because our server starts supporting multiple parallel // handshakes), this test needs to be fixed so that the server is still // responding BUSY to the client. - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == sTestCaseMessageCount + 3); - NL_TEST_ASSERT(inSuite, delegateCommissioner1.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner2.mNumPairingComplete == 0); + EXPECT_EQ(loopback.mSentMessageCount, sTestCaseMessageCount + 3); + EXPECT_EQ(delegateCommissioner1.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner2.mNumPairingComplete, 0u); - NL_TEST_ASSERT(inSuite, delegateCommissioner1.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner2.mNumPairingErrors == 1); + EXPECT_EQ(delegateCommissioner1.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner2.mNumPairingErrors, 1u); - NL_TEST_ASSERT(inSuite, delegateCommissioner1.mNumBusyResponses == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner2.mNumBusyResponses == 1); + EXPECT_EQ(delegateCommissioner1.mNumBusyResponses, 0u); + EXPECT_EQ(delegateCommissioner2.mNumBusyResponses, 1u); gPairingServer.Shutdown(); } @@ -673,7 +633,7 @@ struct Sigma1Params static constexpr bool expectSuccess = true; }; -void TestCASESession::DestinationIdTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, DestinationIdTest) { // Validate example test vector from CASE section of spec @@ -708,20 +668,20 @@ void TestCASESession::DestinationIdTest(nlTestSuite * inSuite, void * inContext) CHIP_ERROR err = GenerateCaseDestinationId(ByteSpan(kIpkOperationalGroupKeyFromSpec), ByteSpan(kInitiatorRandomFromSpec), ByteSpan(kRootPubKeyFromSpec), kFabricIdFromSpec, kNodeIdFromSpec, destinationIdSpan); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == err); - NL_TEST_ASSERT(inSuite, destinationIdSpan.size() == sizeof(destinationIdBuf)); - NL_TEST_ASSERT(inSuite, destinationIdSpan.data_equal(ByteSpan(kExpectedDestinationIdFromSpec))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(destinationIdSpan.size(), sizeof(destinationIdBuf)); + EXPECT_TRUE(destinationIdSpan.data_equal(ByteSpan(kExpectedDestinationIdFromSpec))); memset(destinationIdSpan.data(), 0, destinationIdSpan.size()); // Test changing input: should yield different - err = GenerateCaseDestinationId(ByteSpan(kIpkOperationalGroupKeyFromSpec), ByteSpan(kInitiatorRandomFromSpec), - ByteSpan(kRootPubKeyFromSpec), kFabricIdFromSpec, - kNodeIdFromSpec + 1, // <--- Change node ID - destinationIdSpan); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == err); - NL_TEST_ASSERT(inSuite, destinationIdSpan.size() == sizeof(destinationIdBuf)); - NL_TEST_ASSERT(inSuite, !destinationIdSpan.data_equal(ByteSpan(kExpectedDestinationIdFromSpec))); + EXPECT_EQ(GenerateCaseDestinationId(ByteSpan(kIpkOperationalGroupKeyFromSpec), ByteSpan(kInitiatorRandomFromSpec), + ByteSpan(kRootPubKeyFromSpec), kFabricIdFromSpec, + kNodeIdFromSpec + 1, // <--- Change node ID + destinationIdSpan), + CHIP_NO_ERROR); + EXPECT_EQ(destinationIdSpan.size(), sizeof(destinationIdBuf)); + EXPECT_FALSE(destinationIdSpan.data_equal(ByteSpan(kExpectedDestinationIdFromSpec))); } template @@ -776,12 +736,11 @@ static CHIP_ERROR EncodeSigma1(MutableByteSpan & buf) } // A macro, so we can tell which test failed based on line number. -#define TestSigma1Parsing(inSuite, mem, bufferSize, params) \ +#define TestSigma1Parsing(mem, bufferSize, params) \ do \ { \ MutableByteSpan buf(mem.Get(), bufferSize); \ - CHIP_ERROR err = EncodeSigma1(buf); \ - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); \ + EXPECT_EQ(EncodeSigma1(buf), CHIP_NO_ERROR); \ \ TLV::ContiguousBufferTLVReader reader; \ reader.Init(buf); \ @@ -794,12 +753,12 @@ static CHIP_ERROR EncodeSigma1(MutableByteSpan & buf) ByteSpan resumptionId; \ ByteSpan initiatorResumeMIC; \ CASESession session; \ - err = session.ParseSigma1(reader, initiatorRandom, initiatorSessionId, destinationId, initiatorEphPubKey, \ - resumptionRequested, resumptionId, initiatorResumeMIC); \ - NL_TEST_ASSERT(inSuite, (err == CHIP_NO_ERROR) == params::expectSuccess); \ + EXPECT_EQ(session.ParseSigma1(reader, initiatorRandom, initiatorSessionId, destinationId, initiatorEphPubKey, \ + resumptionRequested, resumptionId, initiatorResumeMIC) == CHIP_NO_ERROR, \ + params::expectSuccess); \ if (params::expectSuccess) \ { \ - NL_TEST_ASSERT(inSuite, resumptionRequested == (params::resumptionIdLen != 0 && params::initiatorResumeMICLen != 0)); \ + EXPECT_EQ(resumptionRequested, params::resumptionIdLen != 0 && params::initiatorResumeMICLen != 0); \ /* Add other verification tests here as desired */ \ } \ } while (0) @@ -889,30 +848,29 @@ struct Sigma1SessionIdTooBig : public BadSigma1ParamsBase static constexpr uint32_t initiatorSessionId = UINT16_MAX + 1; }; -void TestCASESession::Sigma1ParsingTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, Sigma1ParsingTest) { // 1280 bytes must be enough by definition. constexpr size_t bufferSize = 1280; chip::Platform::ScopedMemoryBuffer mem; - NL_TEST_ASSERT(inSuite, mem.Calloc(bufferSize)); - - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1Params); - - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1NoStructEnd); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1WrongTags); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongRandom); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortRandom); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongDest); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortDest); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongPubkey); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortPubkey); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1WithResumption); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongResumptionId); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortResumptionId); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongResumeMIC); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortResumeMIC); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1SessionIdMax); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1SessionIdTooBig); + EXPECT_TRUE(mem.Calloc(bufferSize)); + + TestSigma1Parsing(mem, bufferSize, Sigma1Params); + TestSigma1Parsing(mem, bufferSize, Sigma1NoStructEnd); + TestSigma1Parsing(mem, bufferSize, Sigma1WrongTags); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongRandom); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortRandom); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongDest); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortDest); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongPubkey); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortPubkey); + TestSigma1Parsing(mem, bufferSize, Sigma1WithResumption); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongResumptionId); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortResumptionId); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongResumeMIC); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortResumeMIC); + TestSigma1Parsing(mem, bufferSize, Sigma1SessionIdMax); + TestSigma1Parsing(mem, bufferSize, Sigma1SessionIdTooBig); } struct SessionResumptionTestStorage : SessionResumptionStorage @@ -962,7 +920,7 @@ struct SessionResumptionTestStorage : SessionResumptionStorage Crypto::P256ECDHDerivedSecret * mSharedSecret = nullptr; }; -void TestCASESession::SessionResumptionStorage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, SessionResumptionStorage) { // Test the SessionResumptionStorage external interface. // @@ -973,7 +931,6 @@ void TestCASESession::SessionResumptionStorage(nlTestSuite * inSuite, void * inC // if the peers have mismatched session resumption information, we should // fall back to CASE. - TestContext & ctx = *reinterpret_cast(inContext); TestCASESecurePairingDelegate delegateCommissioner; chip::SessionResumptionStorage::ResumptionIdStorage resumptionIdA; chip::SessionResumptionStorage::ResumptionIdStorage resumptionIdB; @@ -982,19 +939,19 @@ void TestCASESession::SessionResumptionStorage(nlTestSuite * inSuite, void * inC // Create our fabric-scoped node IDs. const FabricInfo * fabricInfo = gCommissionerFabrics.FindFabricWithIndex(gCommissionerFabricIndex); - NL_TEST_ASSERT(inSuite, fabricInfo != nullptr); + ASSERT_NE(fabricInfo, nullptr); ScopedNodeId initiator = fabricInfo->GetScopedNodeIdForNode(Node01_02); ScopedNodeId responder = fabricInfo->GetScopedNodeIdForNode(Node01_01); // Generate a resumption IDs. - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(resumptionIdA.data(), resumptionIdA.size())); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(resumptionIdB.data(), resumptionIdB.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(resumptionIdA.data(), resumptionIdA.size()), CHIP_NO_ERROR); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(resumptionIdB.data(), resumptionIdB.size()), CHIP_NO_ERROR); // Generate a shared secrets. sharedSecretA.SetLength(sharedSecretA.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecretA.Bytes(), sharedSecretA.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecretA.Bytes(), sharedSecretA.Length()), CHIP_NO_ERROR); sharedSecretB.SetLength(sharedSecretB.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecretB.Bytes(), sharedSecretB.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecretB.Bytes(), sharedSecretB.Length()), CHIP_NO_ERROR); struct { @@ -1034,38 +991,37 @@ void TestCASESession::SessionResumptionStorage(nlTestSuite * inSuite, void * inC }, }; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); for (size_t i = 0; i < sizeof(testVectors) / sizeof(testVectors[0]); ++i) { auto * pairingCommissioner = chip::Platform::New(); pairingCommissioner->SetGroupDataProvider(&gCommissionerGroupDataProvider); loopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, - gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &ctx.GetSecureSessionManager(), - &gDeviceFabrics, &testVectors[i].responderStorage, nullptr, - &gDeviceGroupDataProvider) == CHIP_NO_ERROR); - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(pairingCommissioner); + EXPECT_EQ(gPairingServer.ListenForSessionEstablishment(&GetExchangeManager(), &GetSecureSessionManager(), &gDeviceFabrics, + &testVectors[i].responderStorage, nullptr, + &gDeviceGroupDataProvider), + CHIP_NO_ERROR); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(pairingCommissioner); auto establishmentReturnVal = pairingCommissioner->EstablishSession( - ctx.GetSecureSessionManager(), &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + GetSecureSessionManager(), &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, &testVectors[i].initiatorStorage, nullptr, &delegateCommissioner, Optional::Missing()); - ServiceEvents(ctx); - NL_TEST_ASSERT(inSuite, establishmentReturnVal == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == testVectors[i].expectedSentMessageCount); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == i + 1); + ServiceEvents(); + EXPECT_EQ(establishmentReturnVal, CHIP_NO_ERROR); + EXPECT_EQ(loopback.mSentMessageCount, testVectors[i].expectedSentMessageCount); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, i + 1); SessionHolder & holder = delegateCommissioner.GetSessionHolder(); - NL_TEST_ASSERT(inSuite, bool(holder)); - NL_TEST_ASSERT(inSuite, holder->GetPeer() == fabricInfo->GetScopedNodeIdForNode(Node01_01)); + EXPECT_TRUE(bool(holder)); + EXPECT_EQ(holder->GetPeer(), fabricInfo->GetScopedNodeIdForNode(Node01_01)); chip::Platform::Delete(pairingCommissioner); + gPairingServer.Shutdown(); } } #if CONFIG_BUILD_FOR_HOST_UNIT_TEST -void TestCASESession::SimulateUpdateNOCInvalidatePendingEstablishment(nlTestSuite * inSuite, void * inContext) +TEST_F_FROM_FIXTURE(TestCASESession, SimulateUpdateNOCInvalidatePendingEstablishment) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); TestCASESecurePairingDelegate delegateCommissioner; CASESession pairingCommissioner; pairingCommissioner.SetGroupDataProvider(&gCommissionerGroupDataProvider); @@ -1073,70 +1029,65 @@ void TestCASESession::SimulateUpdateNOCInvalidatePendingEstablishment(nlTestSuit TestCASESecurePairingDelegate delegateAccessory; CASESession pairingAccessory; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::CASE_Sigma1, - &pairingAccessory) == CHIP_NO_ERROR); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::CASE_Sigma1, + &pairingAccessory), + CHIP_NO_ERROR); // In order for all the test iterations below, we need to stop the CASE sigma handshake in the middle such // that the CASE session is in the process of being established. pairingCommissioner.SetStopSigmaHandshakeAt(MakeOptional(CASESession::State::kSentSigma1)); - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); pairingAccessory.SetGroupDataProvider(&gDeviceGroupDataProvider); - NL_TEST_ASSERT(inSuite, - pairingAccessory.PrepareForSessionEstablishment( - sessionManager, &gDeviceFabrics, nullptr, nullptr, &delegateAccessory, ScopedNodeId(), - Optional::Missing()) == CHIP_NO_ERROR); + EXPECT_EQ(pairingAccessory.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, &delegateAccessory, + ScopedNodeId(), Optional::Missing()), + CHIP_NO_ERROR); gDeviceFabrics.SendUpdateFabricNotificationForTest(gDeviceFabricIndex); - ServiceEvents(ctx); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); + ServiceEvents(); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, - nullptr, nullptr, &delegateCommissioner, - Optional::Missing()) == CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_EQ(pairingCommissioner.EstablishSession( + sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, + nullptr, nullptr, &delegateCommissioner, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); // At this point the CASESession is in the process of establishing. Confirm that there are no errors and there are session // has not been established. - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 0u); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); // Simulating an update to the Fabric NOC for gCommissionerFabrics fabric table. // Confirm that CASESession on commisioner side has reported an error. gCommissionerFabrics.SendUpdateFabricNotificationForTest(gCommissionerFabricIndex); - ServiceEvents(ctx); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 1); + ServiceEvents(); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 1u); // Simulating an update to the Fabric NOC for gDeviceFabrics fabric table. // Confirm that CASESession on accessory side has reported an error. gDeviceFabrics.SendUpdateFabricNotificationForTest(gDeviceFabricIndex); - ServiceEvents(ctx); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 1); + ServiceEvents(); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 1u); // Sanity check that pairing did not complete. - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 0); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 0u); } #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST -namespace { class ExpectErrorExchangeDelegate : public ExchangeDelegate { public: - ExpectErrorExchangeDelegate(nlTestSuite * suite, uint16_t expectedProtocolCode) : - mSuite(suite), mExpectedProtocolCode(expectedProtocolCode) - {} + ExpectErrorExchangeDelegate(uint16_t expectedProtocolCode) : mExpectedProtocolCode(expectedProtocolCode) {} private: CHIP_ERROR OnMessageReceived(ExchangeContext * ec, const PayloadHeader & payloadHeader, @@ -1144,15 +1095,14 @@ class ExpectErrorExchangeDelegate : public ExchangeDelegate { using namespace SecureChannel; - NL_TEST_ASSERT(mSuite, payloadHeader.HasMessageType(MsgType::StatusReport)); + EXPECT_TRUE(payloadHeader.HasMessageType(MsgType::StatusReport)); SecureChannel::StatusReport statusReport; - CHIP_ERROR err = statusReport.Parse(std::move(buf)); - NL_TEST_ASSERT(mSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(statusReport.Parse(std::move(buf)), CHIP_NO_ERROR); - NL_TEST_ASSERT(mSuite, statusReport.GetProtocolId() == SecureChannel::Id); - NL_TEST_ASSERT(mSuite, statusReport.GetGeneralCode() == GeneralStatusCode::kFailure); - NL_TEST_ASSERT(mSuite, statusReport.GetProtocolCode() == mExpectedProtocolCode); + EXPECT_EQ(statusReport.GetProtocolId(), SecureChannel::Id); + EXPECT_EQ(statusReport.GetGeneralCode(), GeneralStatusCode::kFailure); + EXPECT_EQ(statusReport.GetProtocolCode(), mExpectedProtocolCode); return CHIP_NO_ERROR; } @@ -1160,105 +1110,49 @@ class ExpectErrorExchangeDelegate : public ExchangeDelegate Messaging::ExchangeMessageDispatch & GetMessageDispatch() override { return SessionEstablishmentExchangeDispatch::Instance(); } - nlTestSuite * mSuite; uint16_t mExpectedProtocolCode; }; -} // anonymous namespace -void TestCASESession::Sigma1BadDestinationIdTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, Sigma1BadDestinationIdTest) { using SecureChannel::MsgType; - TestContext & ctx = *reinterpret_cast(inContext); - - SessionManager & sessionManager = ctx.GetSecureSessionManager(); + SessionManager & sessionManager = GetSecureSessionManager(); constexpr size_t bufferSize = 600; System::PacketBufferHandle data = chip::System::PacketBufferHandle::New(bufferSize); - NL_TEST_ASSERT(inSuite, !data.IsNull()); + ASSERT_FALSE(data.IsNull()); MutableByteSpan buf(data->Start(), data->AvailableDataLength()); // This uses a bogus destination id that is not going to match anything in practice. - CHIP_ERROR err = EncodeSigma1(buf); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(EncodeSigma1(buf), CHIP_NO_ERROR); data->SetDataLength(static_cast(buf.size())); - Optional session = sessionManager.CreateUnauthenticatedSession(ctx.GetAliceAddress(), GetDefaultMRPConfig()); - NL_TEST_ASSERT(inSuite, session.HasValue()); + Optional session = sessionManager.CreateUnauthenticatedSession(GetAliceAddress(), GetDefaultMRPConfig()); + EXPECT_TRUE(session.HasValue()); TestCASESecurePairingDelegate caseDelegate; CASESession caseSession; caseSession.SetGroupDataProvider(&gDeviceGroupDataProvider); - err = caseSession.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, &caseDelegate, - ScopedNodeId(), NullOptional); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(caseSession.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, &caseDelegate, + ScopedNodeId(), NullOptional), + CHIP_NO_ERROR); - err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(MsgType::CASE_Sigma1, &caseSession); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(MsgType::CASE_Sigma1, &caseSession), CHIP_NO_ERROR); - ExpectErrorExchangeDelegate delegate(inSuite, SecureChannel::kProtocolCodeNoSharedRoot); - ExchangeContext * exchange = ctx.GetExchangeManager().NewContext(session.Value(), &delegate); - NL_TEST_ASSERT(inSuite, exchange != nullptr); + ExpectErrorExchangeDelegate delegate(SecureChannel::kProtocolCodeNoSharedRoot); + ExchangeContext * exchange = GetExchangeManager().NewContext(session.Value(), &delegate); + ASSERT_NE(exchange, nullptr); - err = exchange->SendMessage(MsgType::CASE_Sigma1, std::move(data), SendMessageFlags::kExpectResponse); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(exchange->SendMessage(MsgType::CASE_Sigma1, std::move(data), SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - ServiceEvents(ctx); + ServiceEvents(); - NL_TEST_ASSERT(inSuite, caseDelegate.mNumPairingErrors == 1); - NL_TEST_ASSERT(inSuite, caseDelegate.mNumPairingComplete == 0); + EXPECT_EQ(caseDelegate.mNumPairingErrors, 1u); + EXPECT_EQ(caseDelegate.mNumPairingComplete, 0u); - ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(MsgType::CASE_Sigma1); + GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(MsgType::CASE_Sigma1); caseSession.Clear(); } } // namespace chip - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("WaitInit", chip::TestCASESession::SecurePairingWaitTest), - NL_TEST_DEF("Start", chip::TestCASESession::SecurePairingStartTest), - NL_TEST_DEF("Handshake", chip::TestCASESession::SecurePairingHandshakeTest), - NL_TEST_DEF("ServerHandshake", chip::TestCASESession::SecurePairingHandshakeServerTest), - NL_TEST_DEF("ClientReceivesBusy", chip::TestCASESession::ClientReceivesBusyTest), - NL_TEST_DEF("Sigma1Parsing", chip::TestCASESession::Sigma1ParsingTest), - NL_TEST_DEF("DestinationId", chip::TestCASESession::DestinationIdTest), - NL_TEST_DEF("SessionResumptionStorage", chip::TestCASESession::SessionResumptionStorage), -#if CONFIG_BUILD_FOR_HOST_UNIT_TEST - // This is compiled for host tests which is enough test coverage to ensure updating NOC invalidates - // CASESession that are in the process of establishing. - NL_TEST_DEF("InvalidatePendingSessionEstablishment", chip::TestCASESession::SimulateUpdateNOCInvalidatePendingEstablishment), -#endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST - NL_TEST_DEF("Sigma1BadDestinationId", chip::TestCASESession::Sigma1BadDestinationIdTest), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-SecurePairing-CASE", - &sTests[0], - NL_TEST_WRAP_FUNCTION(TestContext::SetUpTestSuite), - NL_TEST_WRAP_FUNCTION(TestContext::TearDownTestSuite), - NL_TEST_WRAP_METHOD(TestContext, SetUp), - NL_TEST_WRAP_METHOD(TestContext, TearDown), -}; -// clang-format on - -/** - * Main - */ -int TestCASESessionTest() -{ - return chip::ExecuteTestsWithContext(&sSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestCASESessionTest) diff --git a/src/protocols/secure_channel/tests/TestCheckInCounter.cpp b/src/protocols/secure_channel/tests/TestCheckInCounter.cpp index e4a71777d17b97..57dbd4b3496cdd 100644 --- a/src/protocols/secure_channel/tests/TestCheckInCounter.cpp +++ b/src/protocols/secure_channel/tests/TestCheckInCounter.cpp @@ -56,7 +56,6 @@ void VerifyCheckInCounterValues(uint32_t startValue, uint32_t expectedValue, Che EXPECT_EQ(counter.GetValue(), startValue); // Test operation - CHIP_ERROR err = CHIP_NO_ERROR; switch (operation) { case CheckInCounterOperations::kInvalidateHalf: { @@ -68,7 +67,6 @@ void VerifyCheckInCounterValues(uint32_t startValue, uint32_t expectedValue, Che break; } default: { - err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; FAIL(); } }; diff --git a/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp b/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp index 82e755b783b4b8..59dcf3080a8ec3 100644 --- a/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp +++ b/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp @@ -15,16 +15,15 @@ * limitations under the License. */ +#include #include #include -#include -#include // DefaultSessionResumptionStorage is a partial implementation. // Use SimpleSessionResumptionStorage, which extends it, to test. #include -void TestSave(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultSessionResumptionStorage, TestSave) { chip::SimpleSessionResumptionStorage sessionStorage; chip::TestPersistentStorageDelegate storage; @@ -40,14 +39,11 @@ void TestSave(nlTestSuite * inSuite, void * inContext) // Populate test vectors. for (size_t i = 0; i < ArraySize(vectors); ++i) { - NL_TEST_ASSERT( - inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size()), CHIP_NO_ERROR); *vectors[i].resumptionId.data() = static_cast(i); // set first byte to our index to ensure uniqueness for the FindByResumptionId call vectors[i].sharedSecret.SetLength(vectors[i].sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, - CHIP_NO_ERROR == - chip::Crypto::DRBG_get_bytes(vectors[i].sharedSecret.Bytes(), vectors[i].sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].sharedSecret.Bytes(), vectors[i].sharedSecret.Length()), CHIP_NO_ERROR); vectors[i].node = chip::ScopedNodeId(static_cast(i + 1), static_cast(i + 1)); vectors[i].cats.values[0] = static_cast(rand()); vectors[i].cats.values[1] = static_cast(rand()); @@ -57,9 +53,8 @@ void TestSave(nlTestSuite * inSuite, void * inContext) // Fill storage. for (size_t i = 0; i < CHIP_CONFIG_CASE_SESSION_RESUME_CACHE_SIZE; ++i) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vectors[i].node, vectors[i].resumptionId, vectors[i].sharedSecret, vectors[i].cats) == - CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(vectors[i].node, vectors[i].resumptionId, vectors[i].sharedSecret, vectors[i].cats), + CHIP_NO_ERROR); } // Verify behavior for over-fill. @@ -69,9 +64,9 @@ void TestSave(nlTestSuite * inSuite, void * inContext) // case should be modified to match. { size_t last = ArraySize(vectors) - 1; - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vectors[last].node, vectors[last].resumptionId, vectors[last].sharedSecret, - vectors[last].cats) == CHIP_NO_ERROR); + EXPECT_EQ( + sessionStorage.Save(vectors[last].node, vectors[last].resumptionId, vectors[last].sharedSecret, vectors[last].cats), + CHIP_NO_ERROR); // Copy our data to our test vector index 0 to match // what is now in storage. vectors[0].node = vectors[last].node; @@ -89,28 +84,24 @@ void TestSave(nlTestSuite * inSuite, void * inContext) chip::CATValues outCats; // Verify retrieval by node. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(vector.resumptionId.data(), outResumptionId.data(), vector.resumptionId.size()) == 0); - NL_TEST_ASSERT(inSuite, - memcmp(vector.sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vector.sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vector.cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vector.cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vector.cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(vector.resumptionId.data(), outResumptionId.data(), vector.resumptionId.size()), 0); + EXPECT_EQ(memcmp(vector.sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vector.sharedSecret.Length()), 0); + EXPECT_EQ(vector.cats.values[0], outCats.values[0]); + EXPECT_EQ(vector.cats.values[1], outCats.values[1]); + EXPECT_EQ(vector.cats.values[2], outCats.values[2]); // Validate retrieval by resumption ID. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, vector.node == outNode); - NL_TEST_ASSERT(inSuite, - memcmp(vector.sharedSecret.Bytes(), outSharedSecret.ConstBytes(), vector.sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vector.cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vector.cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vector.cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(vector.node, outNode); + EXPECT_EQ(memcmp(vector.sharedSecret.Bytes(), outSharedSecret.ConstBytes(), vector.sharedSecret.Length()), 0); + EXPECT_EQ(vector.cats.values[0], outCats.values[0]); + EXPECT_EQ(vector.cats.values[1], outCats.values[1]); + EXPECT_EQ(vector.cats.values[2], outCats.values[2]); } } -void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultSessionResumptionStorage, TestInPlaceSave) { chip::SimpleSessionResumptionStorage sessionStorage; chip::TestPersistentStorageDelegate storage; @@ -139,14 +130,11 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) // Populate test vectors. for (size_t i = 0; i < ArraySize(vectors); ++i) { - NL_TEST_ASSERT( - inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size()), CHIP_NO_ERROR); *vectors[i].resumptionId.data() = static_cast(i); // set first byte to our index to ensure uniqueness for the FindByResumptionId call vectors[i].sharedSecret.SetLength(vectors[i].sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, - CHIP_NO_ERROR == - chip::Crypto::DRBG_get_bytes(vectors[i].sharedSecret.Bytes(), vectors[i].sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].sharedSecret.Bytes(), vectors[i].sharedSecret.Length()), CHIP_NO_ERROR); vectors[i].node = nodes[i % ArraySize(nodes)]; vectors[i].cats.values[0] = static_cast(rand()); vectors[i].cats.values[1] = static_cast(rand()); @@ -156,9 +144,8 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) // Add one entry for each node. for (size_t i = 0; i < ArraySize(nodes); ++i) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vectors[i].node, vectors[i].resumptionId, vectors[i].sharedSecret, vectors[i].cats) == - CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(vectors[i].node, vectors[i].resumptionId, vectors[i].sharedSecret, vectors[i].cats), + CHIP_NO_ERROR); } // Read back and verify values. @@ -170,37 +157,27 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) chip::CATValues outCats; // Verify retrieval by node. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vectors[i].node, outResumptionId, outSharedSecret, outCats) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - memcmp(vectors[i].resumptionId.data(), outResumptionId.data(), vectors[i].resumptionId.size()) == 0); - NL_TEST_ASSERT( - inSuite, - memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByScopedNodeId(vectors[i].node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(vectors[i].resumptionId.data(), outResumptionId.data(), vectors[i].resumptionId.size()), 0); + EXPECT_EQ(memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()), 0); + EXPECT_EQ(vectors[i].cats.values[0], outCats.values[0]); + EXPECT_EQ(vectors[i].cats.values[1], outCats.values[1]); + EXPECT_EQ(vectors[i].cats.values[2], outCats.values[2]); // Validate retrieval by resumption ID. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vectors[i].resumptionId, outNode, outSharedSecret, outCats) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, vectors[i].node == outNode); - NL_TEST_ASSERT( - inSuite, - memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByResumptionId(vectors[i].resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(vectors[i].node, outNode); + EXPECT_EQ(memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()), 0); + EXPECT_EQ(vectors[i].cats.values[0], outCats.values[0]); + EXPECT_EQ(vectors[i].cats.values[1], outCats.values[1]); + EXPECT_EQ(vectors[i].cats.values[2], outCats.values[2]); } // Now add all test vectors. This should overwrite each node's record // many times. for (auto & vector : vectors) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vector.node, vector.resumptionId, vector.sharedSecret, vector.cats) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(vector.node, vector.resumptionId, vector.sharedSecret, vector.cats), CHIP_NO_ERROR); } // Read back and verify that only the last record for each node was retained. @@ -212,36 +189,27 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) chip::CATValues outCats; // Verify retrieval by node. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vectors[i].node, outResumptionId, outSharedSecret, outCats) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - memcmp(vectors[i].resumptionId.data(), outResumptionId.data(), vectors[i].resumptionId.size()) == 0); - NL_TEST_ASSERT( - inSuite, - memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByScopedNodeId(vectors[i].node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(vectors[i].resumptionId.data(), outResumptionId.data(), vectors[i].resumptionId.size()), 0); + EXPECT_EQ(memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()), 0); + EXPECT_EQ(vectors[i].cats.values[0], outCats.values[0]); + EXPECT_EQ(vectors[i].cats.values[1], outCats.values[1]); + EXPECT_EQ(vectors[i].cats.values[2], outCats.values[2]); // Validate retrieval by resumption ID. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vectors[i].resumptionId, outNode, outSharedSecret, outCats) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, vectors[i].node == outNode); - NL_TEST_ASSERT( - inSuite, - memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByResumptionId(vectors[i].resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(vectors[i].node, outNode); + EXPECT_EQ(memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()), 0); + EXPECT_EQ(vectors[i].cats.values[0], outCats.values[0]); + EXPECT_EQ(vectors[i].cats.values[1], outCats.values[1]); + EXPECT_EQ(vectors[i].cats.values[2], outCats.values[2]); } // Remove all records for all fabrics. If all three tables of (index, state, // links) are in sync, deleting for each fabric should clean error free. for (const auto & node : nodes) { - NL_TEST_ASSERT(inSuite, sessionStorage.DeleteAll(node.GetFabricIndex()) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.DeleteAll(node.GetFabricIndex()), CHIP_NO_ERROR); } // Verify that no entries can be located any longer for any node or @@ -254,12 +222,10 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) chip::CATValues outCats; // Verify all records for all nodes are gone. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats) != CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); // Verify all records for all resumption IDs are gone. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats) != CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); } // Verify no state table persistent storage entries were leaked. @@ -267,7 +233,7 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) { uint16_t size = 0; auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(node).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } // Verify no link table persistent storage entries were leaked. for (auto & vector : vectors) @@ -275,11 +241,11 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) uint16_t size = 0; auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(vector.resumptionId).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } } -void TestDelete(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultSessionResumptionStorage, TestDelete) { chip::SimpleSessionResumptionStorage sessionStorage; chip::TestPersistentStorageDelegate storage; @@ -293,13 +259,12 @@ void TestDelete(nlTestSuite * inSuite, void * inContext) // Create a shared secret. We can use the same one for all entries. sharedSecret.SetLength(sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length()), CHIP_NO_ERROR); // Populate test vectors. for (size_t i = 0; i < ArraySize(vectors); ++i) { - NL_TEST_ASSERT( - inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size()), CHIP_NO_ERROR); *vectors[i].resumptionId.data() = static_cast(i); // set first byte to our index to ensure uniqueness for the delete test vectors[i].node = chip::ScopedNodeId(static_cast(i + 1), static_cast(i + 1)); @@ -308,8 +273,7 @@ void TestDelete(nlTestSuite * inSuite, void * inContext) // Fill storage. for (auto & vector : vectors) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vector.node, vector.resumptionId, sharedSecret, chip::CATValues{}) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(vector.node, vector.resumptionId, sharedSecret, chip::CATValues{}), CHIP_NO_ERROR); } // Delete values in turn from storage and verify they are removed. @@ -319,11 +283,9 @@ void TestDelete(nlTestSuite * inSuite, void * inContext) chip::SessionResumptionStorage::ResumptionIdStorage outResumptionId; chip::Crypto::P256ECDHDerivedSecret outSharedSecret; chip::CATValues outCats; - NL_TEST_ASSERT(inSuite, sessionStorage.Delete(vector.node) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats) != CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats) != CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Delete(vector.node), CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); } // Verify no state or link table persistent storage entries were leaked. @@ -333,17 +295,17 @@ void TestDelete(nlTestSuite * inSuite, void * inContext) { auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(vector.node).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } { auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(vector.resumptionId).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } } } -void TestDeleteAll(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultSessionResumptionStorage, TestDeleteAll) { chip::SimpleSessionResumptionStorage sessionStorage; chip::TestPersistentStorageDelegate storage; @@ -361,7 +323,7 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) // Create a shared secret. We can use the same one for all entries. sharedSecret.SetLength(sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length()), CHIP_NO_ERROR); // Populate test vectors. for (size_t i = 0; i < sizeof(vectors) / sizeof(vectors[0]); ++i) @@ -369,10 +331,9 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) vectors[i].fabricIndex = static_cast(i + 1); for (size_t j = 0; j < sizeof(vectors[0].nodes) / sizeof(vectors[0].nodes[0]); ++j) { - NL_TEST_ASSERT( - inSuite, - CHIP_NO_ERROR == - chip::Crypto::DRBG_get_bytes(vectors[i].nodes[j].resumptionId.data(), vectors[i].nodes[j].resumptionId.size())); + EXPECT_EQ( + chip::Crypto::DRBG_get_bytes(vectors[i].nodes[j].resumptionId.data(), vectors[i].nodes[j].resumptionId.size()), + CHIP_NO_ERROR); vectors[i].nodes[j].node = chip::ScopedNodeId(static_cast(j), vectors[i].fabricIndex); } } @@ -382,8 +343,7 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) { for (auto & node : vector.nodes) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(node.node, node.resumptionId, sharedSecret, chip::CATValues{}) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(node.node, node.resumptionId, sharedSecret, chip::CATValues{}), CHIP_NO_ERROR); } } @@ -397,16 +357,14 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) // Verify fabric node entries exist. for (const auto & node : vector.nodes) { - NL_TEST_ASSERT( - inSuite, sessionStorage.FindByScopedNodeId(node.node, outResumptionId, outSharedSecret, outCats) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.FindByScopedNodeId(node.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); } // Delete fabric. - NL_TEST_ASSERT(inSuite, sessionStorage.DeleteAll(vector.fabricIndex) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.DeleteAll(vector.fabricIndex), CHIP_NO_ERROR); // Verify fabric node entries no longer exist. for (const auto & node : vector.nodes) { - NL_TEST_ASSERT( - inSuite, sessionStorage.FindByScopedNodeId(node.node, outResumptionId, outSharedSecret, outCats) != CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByScopedNodeId(node.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); } } // Verify no state or link table persistent storage entries were leaked. @@ -418,53 +376,13 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) { auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(node.node).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } { auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(node.resumptionId).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } } } } - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestSave", TestSave), - NL_TEST_DEF("TestInPlaceSave", TestInPlaceSave), - NL_TEST_DEF("TestDelete", TestDelete), - NL_TEST_DEF("TestDeleteAll", TestDeleteAll), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-DefaultSessionResumptionStorage", - &sTests[0], - nullptr, - nullptr, -}; -// clang-format on - -/** - * Main - */ -int TestDefaultSessionResumptionStorage() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestDefaultSessionResumptionStorage) diff --git a/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp b/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp index c2e71591acda14..41b6539ecf0773 100644 --- a/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp +++ b/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp @@ -23,8 +23,7 @@ #include #include -#include -#include + #include #include #include @@ -35,8 +34,8 @@ #include #include +#include #include -#include #include @@ -48,8 +47,6 @@ using namespace chip::Transport; using namespace chip::Messaging; using namespace chip::Protocols; -using TestContext = chip::Test::LoopbackMessagingContext; - const char PAYLOAD[] = "Hello!"; class MockAppDelegate : public ExchangeDelegate @@ -67,109 +64,55 @@ class MockAppDelegate : public ExchangeDelegate int ReceiveHandlerCallCount = 0; }; -void MessageCounterSyncProcess(nlTestSuite * inSuite, void * inContext) +struct TestMessageCounterManager : public chip::Test::LoopbackMessagingContext, public ::testing::Test { - TestContext & ctx = *reinterpret_cast(inContext); + static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } + static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - CHIP_ERROR err = CHIP_NO_ERROR; + void SetUp() override { chip::Test::LoopbackMessagingContext::SetUp(); } + void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } +}; + +TEST_F(TestMessageCounterManager, MessageCounterSyncProcess) +{ - SessionHandle localSession = ctx.GetSessionBobToAlice(); - SessionHandle peerSession = ctx.GetSessionAliceToBob(); + SessionHandle localSession = GetSessionBobToAlice(); + SessionHandle peerSession = GetSessionAliceToBob(); - Transport::SecureSession * localState = ctx.GetSecureSessionManager().GetSecureSession(localSession); - Transport::SecureSession * peerState = ctx.GetSecureSessionManager().GetSecureSession(peerSession); + Transport::SecureSession * localState = GetSecureSessionManager().GetSecureSession(localSession); + Transport::SecureSession * peerState = GetSecureSessionManager().GetSecureSession(peerSession); localState->GetSessionMessageCounter().GetPeerMessageCounter().Reset(); - err = ctx.GetMessageCounterManager().SendMsgCounterSyncReq(localSession, localState); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(GetMessageCounterManager().SendMsgCounterSyncReq(localSession, localState), CHIP_NO_ERROR); MessageCounter & peerCounter = peerState->GetSessionMessageCounter().GetLocalMessageCounter(); PeerMessageCounter & localCounter = localState->GetSessionMessageCounter().GetPeerMessageCounter(); - NL_TEST_ASSERT(inSuite, localCounter.IsSynchronized()); - NL_TEST_ASSERT(inSuite, localCounter.GetCounter() == peerCounter.Value()); + EXPECT_TRUE(localCounter.IsSynchronized()); + EXPECT_EQ(localCounter.GetCounter(), peerCounter.Value()); } -void CheckReceiveMessage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestMessageCounterManager, CheckReceiveMessage) { - TestContext & ctx = *reinterpret_cast(inContext); - CHIP_ERROR err = CHIP_NO_ERROR; - - SessionHandle peerSession = ctx.GetSessionAliceToBob(); - Transport::SecureSession * peerState = ctx.GetSecureSessionManager().GetSecureSession(peerSession); + SessionHandle peerSession = GetSessionAliceToBob(); + Transport::SecureSession * peerState = GetSecureSessionManager().GetSecureSession(peerSession); peerState->GetSessionMessageCounter().GetPeerMessageCounter().Reset(); MockAppDelegate callback; - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(chip::Protocols::Echo::MsgType::EchoRequest, &callback); + GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(chip::Protocols::Echo::MsgType::EchoRequest, &callback); uint16_t payload_len = sizeof(PAYLOAD); System::PacketBufferHandle msgBuf = MessagePacketBuffer::NewWithData(PAYLOAD, payload_len); - NL_TEST_ASSERT(inSuite, !msgBuf.IsNull()); + ASSERT_FALSE(msgBuf.IsNull()); - Messaging::ExchangeContext * ec = ctx.NewExchangeToAlice(nullptr); - NL_TEST_ASSERT(inSuite, ec != nullptr); + Messaging::ExchangeContext * ec = NewExchangeToAlice(nullptr); + ASSERT_NE(ec, nullptr); - err = ec->SendMessage(chip::Protocols::Echo::MsgType::EchoRequest, std::move(msgBuf), - Messaging::SendFlags{ Messaging::SendMessageFlags::kNoAutoRequestAck }); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, peerState->GetSessionMessageCounter().GetPeerMessageCounter().IsSynchronized()); - NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); + EXPECT_EQ(ec->SendMessage(chip::Protocols::Echo::MsgType::EchoRequest, std::move(msgBuf), + Messaging::SendFlags{ Messaging::SendMessageFlags::kNoAutoRequestAck }), + CHIP_NO_ERROR); + EXPECT_TRUE(peerState->GetSessionMessageCounter().GetPeerMessageCounter().IsSynchronized()); + EXPECT_EQ(callback.ReceiveHandlerCallCount, 1); } // Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("Test MessageCounterManager::MessageCounterSyncProcess", MessageCounterSyncProcess), - NL_TEST_DEF("Test MessageCounterManager::ReceiveMessage", CheckReceiveMessage), - NL_TEST_SENTINEL() -}; -// clang-format on - -int Initialize(void * aContext); -int Finalize(void * aContext); - -// clang-format off -nlTestSuite sSuite = -{ - "Test-MessageCounterManager", - &sTests[0], - Initialize, - Finalize -}; -// clang-format on - -/** - * Initialize the test suite. - */ -int Initialize(void * aContext) -{ - auto * ctx = static_cast(aContext); - VerifyOrReturnError(ctx->Init(&sSuite) == CHIP_NO_ERROR, FAILURE); - - return SUCCESS; -} - -/** - * Finalize the test suite. - */ -int Finalize(void * aContext) -{ - reinterpret_cast(aContext)->Shutdown(); - return SUCCESS; -} - } // namespace - -/** - * Main - */ -int TestMessageCounterManager() -{ - return chip::ExecuteTestsWithContext(&sSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestMessageCounterManager); diff --git a/src/protocols/secure_channel/tests/TestPASESession.cpp b/src/protocols/secure_channel/tests/TestPASESession.cpp index 896f721579334d..5b3f957d51bf84 100644 --- a/src/protocols/secure_channel/tests/TestPASESession.cpp +++ b/src/protocols/secure_channel/tests/TestPASESession.cpp @@ -22,15 +22,13 @@ */ #include -#include +#include #include #include #include #include #include -#include -#include #include #include #include @@ -85,7 +83,8 @@ constexpr Spake2pVerifierSerialized sTestSpake2p01_SerializedVerifier = { 0xB7, 0xC0, 0x7F, 0xCC, 0x06, 0x27, 0xA1, 0xB8, 0x57, 0x3A, 0x14, 0x9F, 0xCD, 0x1F, 0xA4, 0x66, 0xCF }; -class TestContext : public chip::Test::LoopbackMessagingContext +class TestSecurePairingDelegate; +class TestPASESession : public chip::Test::LoopbackMessagingContext, public ::testing::Test { public: // Performs shared setup for all tests in the test suite @@ -99,6 +98,11 @@ class TestContext : public chip::Test::LoopbackMessagingContext } void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } + + void SecurePairingHandshakeTestCommon(SessionManager & sessionManager, PASESession & pairingCommissioner, + Optional mrpCommissionerConfig, + Optional mrpAccessoryConfig, + TestSecurePairingDelegate & delegateCommissioner); }; class PASETestLoopbackTransportDelegate : public Test::LoopbackTransportDelegate @@ -134,12 +138,11 @@ class MockAppDelegate : public ExchangeDelegate class TemporarySessionManager { public: - TemporarySessionManager(nlTestSuite * suite, TestContext & ctx) : mCtx(ctx) + TemporarySessionManager(TestPASESession & ctx) : mCtx(ctx) { - NL_TEST_ASSERT(suite, - CHIP_NO_ERROR == - mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), - &mStorage, &ctx.GetFabricTable(), ctx.GetSessionKeystore())); + EXPECT_EQ(CHIP_NO_ERROR, + mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), &mStorage, + &ctx.GetFabricTable(), ctx.GetSessionKeystore())); // The setup here is really weird: we are using one session manager for // the actual messages we send (the PASE handshake, so the // unauthenticated sessions) and a different one for allocating the PASE @@ -159,122 +162,114 @@ class TemporarySessionManager operator SessionManager &() { return mSessionManager; } private: - TestContext & mCtx; + TestPASESession & mCtx; TestPersistentStorageDelegate mStorage; SessionManager mSessionManager; }; using namespace System::Clock::Literals; -void SecurePairingWaitTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingWaitTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); // Test all combinations of invalid parameters TestSecurePairingDelegate delegate; PASESession pairing; - NL_TEST_ASSERT(inSuite, pairing.GetSecureSessionType() == SecureSession::Type::kPASE); + EXPECT_EQ(pairing.GetSecureSessionType(), SecureSession::Type::kPASE); - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); - NL_TEST_ASSERT(inSuite, - pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, ByteSpan(), - Optional::Missing(), - &delegate) == CHIP_ERROR_INVALID_ARGUMENT); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, - pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, - ByteSpan(reinterpret_cast("saltSalt"), 8), - Optional::Missing(), - nullptr) == CHIP_ERROR_INVALID_ARGUMENT); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, - pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, - ByteSpan(reinterpret_cast("saltSalt"), 8), - Optional::Missing(), - &delegate) == CHIP_ERROR_INVALID_ARGUMENT); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, - pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, - ByteSpan(sTestSpake2p01_Salt), Optional::Missing(), - &delegate) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); + EXPECT_EQ(pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, ByteSpan(), + Optional::Missing(), &delegate), + CHIP_ERROR_INVALID_ARGUMENT); + DrainAndServiceIO(); + + EXPECT_EQ(pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(reinterpret_cast("saltSalt"), 8), + Optional::Missing(), nullptr), + CHIP_ERROR_INVALID_ARGUMENT); + DrainAndServiceIO(); + + EXPECT_EQ(pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(reinterpret_cast("saltSalt"), 8), + Optional::Missing(), &delegate), + CHIP_ERROR_INVALID_ARGUMENT); + DrainAndServiceIO(); + + EXPECT_EQ(pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(sTestSpake2p01_Salt), Optional::Missing(), &delegate), + CHIP_NO_ERROR); + DrainAndServiceIO(); } -void SecurePairingStartTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingStartTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); // Test all combinations of invalid parameters TestSecurePairingDelegate delegate; PASESession pairing; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); - ExchangeContext * context = ctx.NewUnauthenticatedExchangeToBob(&pairing); + ExchangeContext * context = NewUnauthenticatedExchangeToBob(&pairing); - NL_TEST_ASSERT(inSuite, - pairing.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), nullptr, - nullptr) != CHIP_NO_ERROR); + EXPECT_NE( + pairing.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), nullptr, nullptr), + CHIP_NO_ERROR); loopback.Reset(); - NL_TEST_ASSERT(inSuite, - pairing.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), context, - &delegate) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); + EXPECT_EQ(pairing.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), context, + &delegate), + CHIP_NO_ERROR); + DrainAndServiceIO(); // There should have been two messages sent: PBKDFParamRequest and an ack. - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == 2); + EXPECT_EQ(loopback.mSentMessageCount, 2u); - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); - NL_TEST_ASSERT(inSuite, rm->TestGetCountRetransTable() == 0); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); + EXPECT_EQ(rm->TestGetCountRetransTable(), 0); loopback.Reset(); loopback.mSentMessageCount = 0; loopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; PASESession pairing1; - ExchangeContext * context1 = ctx.NewUnauthenticatedExchangeToBob(&pairing1); - NL_TEST_ASSERT(inSuite, - pairing1.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), - context1, &delegate) == CHIP_ERROR_BAD_REQUEST); - ctx.DrainAndServiceIO(); + ExchangeContext * context1 = NewUnauthenticatedExchangeToBob(&pairing1); + EXPECT_EQ(pairing1.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), context1, + &delegate), + CHIP_ERROR_BAD_REQUEST); + DrainAndServiceIO(); loopback.mMessageSendError = CHIP_NO_ERROR; } -void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, SessionManager & sessionManager, - PASESession & pairingCommissioner, - Optional mrpCommissionerConfig, - Optional mrpAccessoryConfig, - TestSecurePairingDelegate & delegateCommissioner) +void TestPASESession::SecurePairingHandshakeTestCommon(SessionManager & sessionManager, PASESession & pairingCommissioner, + Optional mrpCommissionerConfig, + Optional mrpAccessoryConfig, + TestSecurePairingDelegate & delegateCommissioner) { - TestContext & ctx = *reinterpret_cast(inContext); TestSecurePairingDelegate delegateAccessory; PASESession pairingAccessory; PASETestLoopbackTransportDelegate delegate; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.SetLoopbackTransportDelegate(&delegate); loopback.mSentMessageCount = 0; - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); if (loopback.mNumMessagesToDrop != 0) { - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); ReliableMessageContext * rc = contextCommissioner->GetReliableMessageContext(); - NL_TEST_ASSERT(inSuite, rm != nullptr); - NL_TEST_ASSERT(inSuite, rc != nullptr); + ASSERT_NE(rm, nullptr); + ASSERT_NE(rc, nullptr); // Adding an if-else to avoid affecting non-ICD tests #if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 @@ -293,20 +288,19 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S #endif // CHIP_CONFIG_ENABLE_ICD_SERVER } - NL_TEST_ASSERT(inSuite, - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType( - Protocols::SecureChannel::MsgType::PBKDFParamRequest, &pairingAccessory) == CHIP_NO_ERROR); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::PBKDFParamRequest, + &pairingAccessory), + CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - pairingAccessory.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, - ByteSpan(sTestSpake2p01_Salt), mrpAccessoryConfig, - &delegateAccessory) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); + EXPECT_EQ(pairingAccessory.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(sTestSpake2p01_Salt), mrpAccessoryConfig, &delegateAccessory), + CHIP_NO_ERROR); + DrainAndServiceIO(); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.Pair(sessionManager, sTestSpake2p01_PinCode, mrpCommissionerConfig, contextCommissioner, - &delegateCommissioner) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); + EXPECT_EQ(pairingCommissioner.Pair(sessionManager, sTestSpake2p01_PinCode, mrpCommissionerConfig, contextCommissioner, + &delegateCommissioner), + CHIP_NO_ERROR); + DrainAndServiceIO(); while (delegate.mMessageDropped) { @@ -323,145 +317,127 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S // Wait some time so the dropped message will be retransmitted when we drain the IO. chip::test_utils::SleepMillis(waitTimeout.count()); delegate.mMessageDropped = false; - ReliableMessageMgr::Timeout(&ctx.GetSystemLayer(), ctx.GetExchangeManager().GetReliableMessageMgr()); - ctx.DrainAndServiceIO(); + ReliableMessageMgr::Timeout(&GetSystemLayer(), GetExchangeManager().GetReliableMessageMgr()); + DrainAndServiceIO(); }; // Standalone acks also increment the mSentMessageCount. But some messages could be acked // via piggybacked acks. So we cannot check for a specific value of mSentMessageCount. // Let's make sure atleast number is >= than the minimum messages required to complete the // handshake. - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount >= sTestPaseMessageCount); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); + EXPECT_GE(loopback.mSentMessageCount, sTestPaseMessageCount); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); if (mrpCommissionerConfig.HasValue()) { - NL_TEST_ASSERT(inSuite, - pairingAccessory.GetRemoteMRPConfig().mIdleRetransTimeout == - mrpCommissionerConfig.Value().mIdleRetransTimeout); - NL_TEST_ASSERT(inSuite, - pairingAccessory.GetRemoteMRPConfig().mActiveRetransTimeout == - mrpCommissionerConfig.Value().mActiveRetransTimeout); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mIdleRetransTimeout, mrpCommissionerConfig.Value().mIdleRetransTimeout); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mActiveRetransTimeout, mrpCommissionerConfig.Value().mActiveRetransTimeout); } if (mrpAccessoryConfig.HasValue()) { - NL_TEST_ASSERT(inSuite, - pairingCommissioner.GetRemoteMRPConfig().mIdleRetransTimeout == - mrpAccessoryConfig.Value().mIdleRetransTimeout); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.GetRemoteMRPConfig().mActiveRetransTimeout == - mrpAccessoryConfig.Value().mActiveRetransTimeout); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mIdleRetransTimeout, mrpAccessoryConfig.Value().mIdleRetransTimeout); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mActiveRetransTimeout, mrpAccessoryConfig.Value().mActiveRetransTimeout); } // Now evict the PASE sessions. auto session = pairingCommissioner.CopySecureSession(); - NL_TEST_ASSERT(inSuite, session.HasValue()); + EXPECT_TRUE(session.HasValue()); session.Value()->AsSecureSession()->MarkForEviction(); session = pairingAccessory.CopySecureSession(); - NL_TEST_ASSERT(inSuite, session.HasValue()); + EXPECT_TRUE(session.HasValue()); session.Value()->AsSecureSession()->MarkForEviction(); // Evicting a session async notifies the PASESession's delegate. Normally // that notification is what would delete the PASESession, but in our case // that will happen as soon as things come off the stack. So make sure to // process the async bits before that happens. - ctx.DrainAndServiceIO(); + DrainAndServiceIO(); // And check that this did not result in any new notifications. - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); loopback.SetLoopbackTransportDelegate(nullptr); } -void SecurePairingHandshakeTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, - Optional::Missing(), + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Missing(), Optional::Missing(), delegateCommissioner); } -void SecurePairingHandshakeWithCommissionerMRPTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeWithCommissionerMRPTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); ReliableMessageProtocolConfig config(1000_ms32, 10000_ms32, 4000_ms16); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, - Optional::Value(config), + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Value(config), Optional::Missing(), delegateCommissioner); } -void SecurePairingHandshakeWithDeviceMRPTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeWithDeviceMRPTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); ReliableMessageProtocolConfig config(1000_ms32, 10000_ms32, 4000_ms16); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, - Optional::Missing(), + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Missing(), Optional::Value(config), delegateCommissioner); } -void SecurePairingHandshakeWithAllMRPTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeWithAllMRPTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); ReliableMessageProtocolConfig commissionerConfig(1000_ms32, 10000_ms32, 4000_ms16); ReliableMessageProtocolConfig deviceConfig(2000_ms32, 7000_ms32, 4000_ms16); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Value(commissionerConfig), Optional::Value(deviceConfig), delegateCommissioner); } -void SecurePairingHandshakeWithPacketLossTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeWithPacketLossTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); loopback.mNumMessagesToDrop = 2; - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, - Optional::Missing(), + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Missing(), Optional::Missing(), delegateCommissioner); - NL_TEST_ASSERT(inSuite, loopback.mDroppedMessageCount == 2); - NL_TEST_ASSERT(inSuite, loopback.mNumMessagesToDrop == 0); + EXPECT_EQ(loopback.mDroppedMessageCount, 2u); + EXPECT_EQ(loopback.mNumMessagesToDrop, 0u); } -void SecurePairingFailedHandshake(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingFailedHandshake) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; @@ -469,98 +445,60 @@ void SecurePairingFailedHandshake(nlTestSuite * inSuite, void * inContext) TestSecurePairingDelegate delegateAccessory; PASESession pairingAccessory; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); loopback.mSentMessageCount = 0; - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); ReliableMessageContext * rc = contextCommissioner->GetReliableMessageContext(); - NL_TEST_ASSERT(inSuite, rm != nullptr); - NL_TEST_ASSERT(inSuite, rc != nullptr); + ASSERT_NE(rm, nullptr); + ASSERT_NE(rc, nullptr); contextCommissioner->GetSessionHandle()->AsUnauthenticatedSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig({ 64_ms32, // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL 64_ms32, // CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL })); - NL_TEST_ASSERT(inSuite, - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType( - Protocols::SecureChannel::MsgType::PBKDFParamRequest, &pairingAccessory) == CHIP_NO_ERROR); - - NL_TEST_ASSERT(inSuite, - pairingAccessory.WaitForPairing( - sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, ByteSpan(sTestSpake2p01_Salt), - Optional::Missing(), &delegateAccessory) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, - pairingCommissioner.Pair(sessionManager, 4321, Optional::Missing(), - contextCommissioner, &delegateCommissioner) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 1); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::PBKDFParamRequest, + &pairingAccessory), + CHIP_NO_ERROR); + + EXPECT_EQ(pairingAccessory.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(sTestSpake2p01_Salt), Optional::Missing(), + &delegateAccessory), + CHIP_NO_ERROR); + DrainAndServiceIO(); + + EXPECT_EQ(pairingCommissioner.Pair(sessionManager, 4321, Optional::Missing(), + contextCommissioner, &delegateCommissioner), + CHIP_NO_ERROR); + DrainAndServiceIO(); + + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 0u); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 1u); } -void PASEVerifierSerializeTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, PASEVerifierSerializeTest) { Spake2pVerifier verifier; - NL_TEST_ASSERT(inSuite, verifier.Deserialize(ByteSpan(sTestSpake2p01_SerializedVerifier)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&verifier, &sTestSpake2p01_PASEVerifier, sizeof(Spake2pVerifier)) == 0); + EXPECT_EQ(verifier.Deserialize(ByteSpan(sTestSpake2p01_SerializedVerifier)), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&verifier, &sTestSpake2p01_PASEVerifier, sizeof(Spake2pVerifier)), 0); Spake2pVerifierSerialized serializedVerifier; MutableByteSpan serializedVerifierSpan(serializedVerifier); - NL_TEST_ASSERT(inSuite, verifier.Serialize(serializedVerifierSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, serializedVerifierSpan.size() == kSpake2p_VerifierSerialized_Length); - NL_TEST_ASSERT(inSuite, memcmp(serializedVerifier, sTestSpake2p01_SerializedVerifier, kSpake2p_VerifierSerialized_Length) == 0); + EXPECT_EQ(verifier.Serialize(serializedVerifierSpan), CHIP_NO_ERROR); + EXPECT_EQ(serializedVerifierSpan.size(), kSpake2p_VerifierSerialized_Length); + EXPECT_EQ(memcmp(serializedVerifier, sTestSpake2p01_SerializedVerifier, kSpake2p_VerifierSerialized_Length), 0); Spake2pVerifierSerialized serializedVerifier2; MutableByteSpan serializedVerifier2Span(serializedVerifier2); - NL_TEST_ASSERT(inSuite, chip::Crypto::DRBG_get_bytes(serializedVerifier, kSpake2p_VerifierSerialized_Length) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, verifier.Deserialize(ByteSpan(serializedVerifier)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, verifier.Serialize(serializedVerifier2Span) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(serializedVerifier, serializedVerifier2, kSpake2p_VerifierSerialized_Length) == 0); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(serializedVerifier, kSpake2p_VerifierSerialized_Length), CHIP_NO_ERROR); + EXPECT_EQ(verifier.Deserialize(ByteSpan(serializedVerifier)), CHIP_NO_ERROR); + EXPECT_EQ(verifier.Serialize(serializedVerifier2Span), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(serializedVerifier, serializedVerifier2, kSpake2p_VerifierSerialized_Length), 0); } - -// Test Suite - -static const nlTest sTests[] = { - NL_TEST_DEF("WaitInit", SecurePairingWaitTest), - NL_TEST_DEF("Start", SecurePairingStartTest), - NL_TEST_DEF("Handshake", SecurePairingHandshakeTest), - NL_TEST_DEF("Handshake with Commissioner MRP Parameters", SecurePairingHandshakeWithCommissionerMRPTest), - NL_TEST_DEF("Handshake with Device MRP Parameters", SecurePairingHandshakeWithDeviceMRPTest), - NL_TEST_DEF("Handshake with Both MRP Parameters", SecurePairingHandshakeWithAllMRPTest), - NL_TEST_DEF("Handshake with packet loss", SecurePairingHandshakeWithPacketLossTest), - NL_TEST_DEF("Failed Handshake", SecurePairingFailedHandshake), - NL_TEST_DEF("PASE Verifier Serialize", PASEVerifierSerializeTest), - NL_TEST_SENTINEL(), -}; - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-SecurePairing-PASE", - &sTests[0], - NL_TEST_WRAP_FUNCTION(TestContext::SetUpTestSuite), - NL_TEST_WRAP_FUNCTION(TestContext::TearDownTestSuite), - NL_TEST_WRAP_METHOD(TestContext, SetUp), - NL_TEST_WRAP_METHOD(TestContext, TearDown), -}; -// clang-format on - -} // anonymous namespace - -/** - * Main - */ -int TestPASESession() -{ - return chip::ExecuteTestsWithContext(&sSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestPASESession) +} // namespace diff --git a/src/protocols/secure_channel/tests/TestPairingSession.cpp b/src/protocols/secure_channel/tests/TestPairingSession.cpp index 4a3fe88d55c7aa..5a12f61fc5c69e 100644 --- a/src/protocols/secure_channel/tests/TestPairingSession.cpp +++ b/src/protocols/secure_channel/tests/TestPairingSession.cpp @@ -22,11 +22,11 @@ */ #include -#include +#include #include #include -#include + #include #include #include @@ -36,9 +36,16 @@ using namespace chip; using namespace chip::System::Clock; -class TestPairingSession : public PairingSession +class TestPairingSession : public PairingSession, public ::testing::Test { public: + static void SetUpTestSuite() + { + CHIP_ERROR error = chip::Platform::MemoryInit(); + ASSERT_EQ(error, CHIP_NO_ERROR); + } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } + Transport::SecureSession::Type GetSecureSessionType() const override { return Transport::SecureSession::Type::kPASE; } ScopedNodeId GetPeer() const override { return ScopedNodeId(); } ScopedNodeId GetLocalScopedNodeId() const override { return ScopedNodeId(); } @@ -56,10 +63,8 @@ class TestPairingSession : public PairingSession } }; -void PairingSessionEncodeDecodeMRPParams(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPairingSession, PairingSessionEncodeDecodeMRPParams) { - TestPairingSession session; - ReliableMessageProtocolConfig config(Milliseconds32(100), Milliseconds32(200), Milliseconds16(4000)); System::PacketBufferHandle buf = System::PacketBufferHandle::New(64, 0); @@ -67,108 +72,48 @@ void PairingSessionEncodeDecodeMRPParams(nlTestSuite * inSuite, void * inContext writer.Init(buf.Retain()); TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; - NL_TEST_ASSERT(inSuite, - writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType) == CHIP_NO_ERROR); + EXPECT_EQ(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, PairingSession::EncodeSessionParameters(TLV::ContextTag(1), config, writer) == CHIP_NO_ERROR); + EXPECT_EQ(PairingSession::EncodeSessionParameters(TLV::ContextTag(1), config, writer), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.EndContainer(outerContainerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.Finalize(&buf) == CHIP_NO_ERROR); + EXPECT_EQ(writer.EndContainer(outerContainerType), CHIP_NO_ERROR); + EXPECT_EQ(writer.Finalize(&buf), CHIP_NO_ERROR); System::PacketBufferTLVReader reader; TLV::TLVType containerType = TLV::kTLVType_Structure; reader.Init(std::move(buf)); - NL_TEST_ASSERT(inSuite, reader.Next(containerType, TLV::AnonymousTag()) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reader.EnterContainer(containerType) == CHIP_NO_ERROR); + EXPECT_EQ(reader.Next(containerType, TLV::AnonymousTag()), CHIP_NO_ERROR); + EXPECT_EQ(reader.EnterContainer(containerType), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reader.Next() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.DecodeMRPParametersIfPresent(TLV::ContextTag(1), reader) == CHIP_NO_ERROR); + EXPECT_EQ(reader.Next(), CHIP_NO_ERROR); + EXPECT_EQ(DecodeMRPParametersIfPresent(TLV::ContextTag(1), reader), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.GetRemoteMRPConfig() == config); + EXPECT_EQ(GetRemoteMRPConfig(), config); } -void PairingSessionTryDecodeMissingMRPParams(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPairingSession, PairingSessionTryDecodeMissingMRPParams) { - TestPairingSession session; - System::PacketBufferHandle buf = System::PacketBufferHandle::New(64, 0); System::PacketBufferTLVWriter writer; writer.Init(buf.Retain()); TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; - NL_TEST_ASSERT(inSuite, - writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.Put(TLV::ContextTag(1), static_cast(0x1234)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.EndContainer(outerContainerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.Finalize(&buf) == CHIP_NO_ERROR); + EXPECT_EQ(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType), CHIP_NO_ERROR); + EXPECT_EQ(writer.Put(TLV::ContextTag(1), static_cast(0x1234)), CHIP_NO_ERROR); + EXPECT_EQ(writer.EndContainer(outerContainerType), CHIP_NO_ERROR); + EXPECT_EQ(writer.Finalize(&buf), CHIP_NO_ERROR); System::PacketBufferTLVReader reader; TLV::TLVType containerType = TLV::kTLVType_Structure; reader.Init(std::move(buf)); - NL_TEST_ASSERT(inSuite, reader.Next(containerType, TLV::AnonymousTag()) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reader.EnterContainer(containerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reader.Next() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.DecodeMRPParametersIfPresent(TLV::ContextTag(2), reader) == CHIP_NO_ERROR); + EXPECT_EQ(reader.Next(containerType, TLV::AnonymousTag()), CHIP_NO_ERROR); + EXPECT_EQ(reader.EnterContainer(containerType), CHIP_NO_ERROR); + EXPECT_EQ(reader.Next(), CHIP_NO_ERROR); + EXPECT_EQ(DecodeMRPParametersIfPresent(TLV::ContextTag(2), reader), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.GetRemoteMRPConfig() == GetDefaultMRPConfig()); + EXPECT_EQ(GetRemoteMRPConfig(), GetDefaultMRPConfig()); } // Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("Encode and Decode MRP params", PairingSessionEncodeDecodeMRPParams), - NL_TEST_DEF("Decode missing MRP params", PairingSessionTryDecodeMissingMRPParams), - - NL_TEST_SENTINEL() -}; -// clang-format on - -/** - * Set up the test suite. - */ -int TestPairingSession_Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestPairingSession_Teardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-PairingSession", - &sTests[0], - TestPairingSession_Setup, - TestPairingSession_Teardown -}; -// clang-format on - -/** - * Main - */ -int TestPairingSessionInit() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestPairingSessionInit) diff --git a/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp b/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp index cb511f6993c57d..ee107f695542a9 100644 --- a/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp +++ b/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp @@ -15,8 +15,7 @@ * limitations under the License. */ -#include -#include +#include #include #include @@ -26,27 +25,27 @@ constexpr chip::NodeId node1 = 12344321; constexpr chip::FabricIndex fabric2 = 14; constexpr chip::NodeId node2 = 11223344; -void TestLink(nlTestSuite * inSuite, void * inContext) +TEST(TestSimpleSessionResumptionStorage, TestLink) { chip::TestPersistentStorageDelegate storage; chip::SimpleSessionResumptionStorage sessionStorage; sessionStorage.Init(&storage); chip::SimpleSessionResumptionStorage::ResumptionIdStorage resumptionId; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(resumptionId.data(), resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(resumptionId.data(), resumptionId.size()), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.SaveLink(resumptionId, chip::ScopedNodeId(node1, fabric1))); + EXPECT_EQ(sessionStorage.SaveLink(resumptionId, chip::ScopedNodeId(node1, fabric1)), CHIP_NO_ERROR); chip::ScopedNodeId node; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadLink(resumptionId, node)); - NL_TEST_ASSERT(inSuite, node == chip::ScopedNodeId(node1, fabric1)); + EXPECT_EQ(sessionStorage.LoadLink(resumptionId, node), CHIP_NO_ERROR); + EXPECT_EQ(node, chip::ScopedNodeId(node1, fabric1)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.DeleteLink(resumptionId)); + EXPECT_EQ(sessionStorage.DeleteLink(resumptionId), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == sessionStorage.LoadLink(resumptionId, node)); + EXPECT_EQ(sessionStorage.LoadLink(resumptionId, node), CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } -void TestState(nlTestSuite * inSuite, void * inContext) +TEST(TestSimpleSessionResumptionStorage, TestState) { chip::TestPersistentStorageDelegate storage; chip::SimpleSessionResumptionStorage sessionStorage; @@ -55,31 +54,30 @@ void TestState(nlTestSuite * inSuite, void * inContext) chip::ScopedNodeId node(node1, fabric1); chip::SimpleSessionResumptionStorage::ResumptionIdStorage resumptionId; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(resumptionId.data(), resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(resumptionId.data(), resumptionId.size()), CHIP_NO_ERROR); chip::Crypto::P256ECDHDerivedSecret sharedSecret; sharedSecret.SetLength(sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length()), CHIP_NO_ERROR); chip::CATValues peerCATs; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.SaveState(node, resumptionId, sharedSecret, peerCATs)); + EXPECT_EQ(sessionStorage.SaveState(node, resumptionId, sharedSecret, peerCATs), CHIP_NO_ERROR); chip::SimpleSessionResumptionStorage::ResumptionIdStorage resumptionId2; chip::Crypto::P256ECDHDerivedSecret sharedSecret2; chip::CATValues peerCATs2; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadState(node, resumptionId2, sharedSecret2, peerCATs2)); - NL_TEST_ASSERT(inSuite, resumptionId == resumptionId2); - NL_TEST_ASSERT(inSuite, memcmp(sharedSecret.Bytes(), sharedSecret2.Bytes(), sharedSecret.Length()) == 0); + EXPECT_EQ(sessionStorage.LoadState(node, resumptionId2, sharedSecret2, peerCATs2), CHIP_NO_ERROR); + EXPECT_EQ(resumptionId, resumptionId2); + EXPECT_EQ(memcmp(sharedSecret.Bytes(), sharedSecret2.Bytes(), sharedSecret.Length()), 0); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.DeleteState(node)); + EXPECT_EQ(sessionStorage.DeleteState(node), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == - sessionStorage.LoadState(node, resumptionId2, sharedSecret2, peerCATs2)); + EXPECT_EQ(sessionStorage.LoadState(node, resumptionId2, sharedSecret2, peerCATs2), + CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } -void TestIndex(nlTestSuite * inSuite, void * inContext) +TEST(TestSimpleSessionResumptionStorage, TestIndex) { chip::TestPersistentStorageDelegate storage; chip::SimpleSessionResumptionStorage sessionStorage; @@ -88,63 +86,26 @@ void TestIndex(nlTestSuite * inSuite, void * inContext) chip::ScopedNodeId node(node1, fabric1); chip::DefaultSessionResumptionStorage::SessionIndex index0o; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadIndex(index0o)); - NL_TEST_ASSERT(inSuite, index0o.mSize == 0); + EXPECT_EQ(sessionStorage.LoadIndex(index0o), CHIP_NO_ERROR); + EXPECT_EQ(index0o.mSize, 0u); chip::DefaultSessionResumptionStorage::SessionIndex index1; index1.mSize = 0; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.SaveIndex(index1)); + EXPECT_EQ(sessionStorage.SaveIndex(index1), CHIP_NO_ERROR); chip::DefaultSessionResumptionStorage::SessionIndex index1o; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadIndex(index1o)); - NL_TEST_ASSERT(inSuite, index1o.mSize == 0); + EXPECT_EQ(sessionStorage.LoadIndex(index1o), CHIP_NO_ERROR); + EXPECT_EQ(index1o.mSize, 0u); chip::DefaultSessionResumptionStorage::SessionIndex index2; index2.mSize = 2; index2.mNodes[0] = chip::ScopedNodeId(node1, fabric1); index2.mNodes[1] = chip::ScopedNodeId(node2, fabric2); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.SaveIndex(index2)); + EXPECT_EQ(CHIP_NO_ERROR, sessionStorage.SaveIndex(index2)); chip::DefaultSessionResumptionStorage::SessionIndex index2o; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadIndex(index2o)); - NL_TEST_ASSERT(inSuite, index2o.mSize == 2); - NL_TEST_ASSERT(inSuite, index2o.mNodes[0] == chip::ScopedNodeId(node1, fabric1)); - NL_TEST_ASSERT(inSuite, index2o.mNodes[1] == chip::ScopedNodeId(node2, fabric2)); + EXPECT_EQ(CHIP_NO_ERROR, sessionStorage.LoadIndex(index2o)); + EXPECT_EQ(index2o.mSize, 2u); + EXPECT_EQ(index2o.mNodes[0], chip::ScopedNodeId(node1, fabric1)); + EXPECT_EQ(index2o.mNodes[1], chip::ScopedNodeId(node2, fabric2)); } // Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestLink", TestLink), - NL_TEST_DEF("TestState", TestState), - NL_TEST_DEF("TestIndex", TestState), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-SimpleSessionResumptionStorage", - &sTests[0], - nullptr, - nullptr, -}; -// clang-format on - -/** - * Main - */ -int TestSimpleSessionResumptionStorage() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestSimpleSessionResumptionStorage) diff --git a/src/protocols/secure_channel/tests/TestStatusReport.cpp b/src/protocols/secure_channel/tests/TestStatusReport.cpp index 093453029b156b..65bc639dcca7c3 100644 --- a/src/protocols/secure_channel/tests/TestStatusReport.cpp +++ b/src/protocols/secure_channel/tests/TestStatusReport.cpp @@ -19,19 +19,29 @@ #include #include #include -#include + #include #include #include #include -#include +#include using namespace chip; using namespace chip::Protocols; using namespace chip::Protocols::SecureChannel; -void TestStatusReport_NoData(nlTestSuite * inSuite, void * inContext) +struct TestStatusReport : public ::testing::Test +{ + static void SetUpTestSuite() + { + CHIP_ERROR error = chip::Platform::MemoryInit(); + ASSERT_EQ(error, CHIP_NO_ERROR); + } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestStatusReport, NoData) { GeneralStatusCode generalCode = GeneralStatusCode::kSuccess; auto protocolId = SecureChannel::Id; @@ -44,20 +54,19 @@ void TestStatusReport_NoData(nlTestSuite * inSuite, void * inContext) testReport.WriteToBuffer(bbuf); System::PacketBufferHandle msgBuf = bbuf.Finalize(); - NL_TEST_ASSERT(inSuite, !msgBuf.IsNull()); + ASSERT_FALSE(msgBuf.IsNull()); StatusReport reportToParse; - CHIP_ERROR err = reportToParse.Parse(std::move(msgBuf)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reportToParse.GetGeneralCode() == generalCode); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolId() == protocolId); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolCode() == protocolCode); + EXPECT_EQ(reportToParse.Parse(std::move(msgBuf)), CHIP_NO_ERROR); + EXPECT_EQ(reportToParse.GetGeneralCode(), generalCode); + EXPECT_EQ(reportToParse.GetProtocolId(), protocolId); + EXPECT_EQ(reportToParse.GetProtocolCode(), protocolCode); const System::PacketBufferHandle & data = reportToParse.GetProtocolData(); - NL_TEST_ASSERT(inSuite, data.IsNull()); + EXPECT_TRUE(data.IsNull()); } -void TestStatusReport_WithData(nlTestSuite * inSuite, void * inContext) +TEST_F(TestStatusReport, WithData) { GeneralStatusCode generalCode = GeneralStatusCode::kFailure; auto protocolId = SecureChannel::Id; @@ -73,39 +82,34 @@ void TestStatusReport_WithData(nlTestSuite * inSuite, void * inContext) testReport.WriteToBuffer(bbuf); System::PacketBufferHandle msgBuf = bbuf.Finalize(); - NL_TEST_ASSERT(inSuite, !msgBuf.IsNull()); + ASSERT_FALSE(msgBuf.IsNull()); StatusReport reportToParse; - CHIP_ERROR err = reportToParse.Parse(std::move(msgBuf)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reportToParse.GetGeneralCode() == generalCode); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolId() == protocolId); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolCode() == protocolCode); + EXPECT_EQ(reportToParse.Parse(std::move(msgBuf)), CHIP_NO_ERROR); + EXPECT_EQ(reportToParse.GetGeneralCode(), generalCode); + EXPECT_EQ(reportToParse.GetProtocolId(), protocolId); + EXPECT_EQ(reportToParse.GetProtocolCode(), protocolCode); const System::PacketBufferHandle & rcvData = reportToParse.GetProtocolData(); - if (rcvData.IsNull()) - { - NL_TEST_ASSERT(inSuite, false); - return; - } - NL_TEST_ASSERT(inSuite, rcvData->DataLength() == dataLen); - NL_TEST_ASSERT(inSuite, !memcmp(rcvData->Start(), data, dataLen)); + ASSERT_FALSE(rcvData.IsNull()); + EXPECT_EQ(rcvData->DataLength(), dataLen); + EXPECT_EQ(memcmp(rcvData->Start(), data, dataLen), 0); } -void TestBadStatusReport(nlTestSuite * inSuite, void * inContext) +TEST_F(TestStatusReport, TestBadStatusReport) { StatusReport report; System::PacketBufferHandle badMsg = System::PacketBufferHandle::New(10); CHIP_ERROR err = report.Parse(std::move(badMsg)); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); StatusReport report2; badMsg = nullptr; err = report2.Parse(std::move(badMsg)); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); } -void TestMakeBusyStatusReport(nlTestSuite * inSuite, void * inContext) +TEST_F(TestStatusReport, TestMakeBusyStatusReport) { GeneralStatusCode generalCode = GeneralStatusCode::kBusy; auto protocolId = SecureChannel::Id; @@ -113,81 +117,22 @@ void TestMakeBusyStatusReport(nlTestSuite * inSuite, void * inContext) System::Clock::Milliseconds16 minimumWaitTime = System::Clock::Milliseconds16(5000); System::PacketBufferHandle handle = StatusReport::MakeBusyStatusReportMessage(minimumWaitTime); - NL_TEST_ASSERT(inSuite, !handle.IsNull()); + ASSERT_FALSE(handle.IsNull()); StatusReport reportToParse; - CHIP_ERROR err = reportToParse.Parse(std::move(handle)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == err); - NL_TEST_ASSERT(inSuite, reportToParse.GetGeneralCode() == generalCode); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolId() == protocolId); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolCode() == protocolCode); + EXPECT_EQ(reportToParse.Parse(std::move(handle)), CHIP_NO_ERROR); + EXPECT_EQ(reportToParse.GetGeneralCode(), generalCode); + EXPECT_EQ(reportToParse.GetProtocolId(), protocolId); + EXPECT_EQ(reportToParse.GetProtocolCode(), protocolCode); const System::PacketBufferHandle & rcvData = reportToParse.GetProtocolData(); - NL_TEST_ASSERT(inSuite, !rcvData.IsNull()); - NL_TEST_ASSERT(inSuite, rcvData->DataLength() == sizeof(minimumWaitTime)); + ASSERT_FALSE(rcvData.IsNull()); + EXPECT_EQ(rcvData->DataLength(), sizeof(minimumWaitTime)); uint16_t readMinimumWaitTime = 0; Encoding::LittleEndian::Reader reader(rcvData->Start(), rcvData->DataLength()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == reader.Read16(&readMinimumWaitTime).StatusCode()); - NL_TEST_ASSERT(inSuite, System::Clock::Milliseconds16(readMinimumWaitTime) == minimumWaitTime); + EXPECT_EQ(reader.Read16(&readMinimumWaitTime).StatusCode(), CHIP_NO_ERROR); + EXPECT_EQ(System::Clock::Milliseconds16(readMinimumWaitTime), minimumWaitTime); } // Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestStatusReport_NoData", TestStatusReport_NoData), - NL_TEST_DEF("TestStatusReport_WithData", TestStatusReport_WithData), - NL_TEST_DEF("TestBadStatusReport", TestBadStatusReport), - NL_TEST_DEF("TestMakeBusyStatusReport", TestMakeBusyStatusReport), - - NL_TEST_SENTINEL() -}; -// clang-format on - -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-StatusReport", - &sTests[0], - TestSetup, - TestTeardown, -}; -// clang-format on - -/** - * Main - */ -int TestStatusReport() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestStatusReport) diff --git a/src/system/tests/BUILD.gn b/src/system/tests/BUILD.gn index 2f2fd4de0a6a6d..01965170ab9b0c 100644 --- a/src/system/tests/BUILD.gn +++ b/src/system/tests/BUILD.gn @@ -46,6 +46,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/inet", + "${chip_root}/src/lib/support/tests:pw-test-macros", "${chip_root}/src/platform", "${chip_root}/src/system", ] diff --git a/src/system/tests/TestSystemPacketBuffer.cpp b/src/system/tests/TestSystemPacketBuffer.cpp index c71ad542d6225a..bf1456487307a3 100644 --- a/src/system/tests/TestSystemPacketBuffer.cpp +++ b/src/system/tests/TestSystemPacketBuffer.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -192,16 +193,6 @@ class TestSystemPacketBuffer : public ::testing::Test void CheckSetStart(); }; -/* - * Run fixture's class function as a test. - */ -#define TEST_F_FROM_FIXTURE(test_fixture, test_name) \ - TEST_F(test_fixture, test_name) \ - { \ - test_name(); \ - } \ - void test_fixture::test_name() - /** * Allocate memory for a test buffer and configure according to test buffer configuration. */ diff --git a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt index 925be3fdd2b499..6c038b398d914f 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt @@ -1,2 +1 @@ -AppTestsNL -SecureChannelTestsNL +AppTestsNL \ No newline at end of file From a42570bfc530d47aff5936e3321ab12d78284f87 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Tue, 4 Jun 2024 19:07:53 +0200 Subject: [PATCH 044/162] Setup bloat reports for Tizen CI builds (#33729) * Setup bloat reports for Tizen CI builds * Apply suggestions from code review Co-authored-by: Andrei Litvin * Configuration for Tizen --------- Co-authored-by: Andrei Litvin --- .github/workflows/examples-tizen.yaml | 23 +++++++++ scripts/tools/memory/platform/tizen.cfg | 67 +++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 scripts/tools/memory/platform/tizen.cfg diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 17cd275e0d5b52..295f6d158c87d9 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -50,6 +50,12 @@ jobs: with: platform: tizen + - name: Set up environment for size reports + uses: ./.github/actions/setup-size-reports + if: ${{ !env.ACT }} + with: + gh-context: ${{ toJson(github) }} + - name: Build Tizen examples run: | ./scripts/run_in_build_env.sh \ @@ -61,3 +67,20 @@ jobs: build \ --copy-artifacts-to out/artifacts \ " + + - name: Bloat report - chip-tool + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + tizen arm chip-tool-ubsan out/tizen-arm-chip-tool-ubsan/chip-tool \ + /tmp/bloat_reports/ + - name: Bloat report - all-clusters-app + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + tizen arm all-clusters-app out/tizen-arm-all-clusters/chip-all-clusters-app \ + /tmp/bloat_reports/ + + - name: Uploading Size Reports + uses: ./.github/actions/upload-size-reports + if: ${{ !env.ACT }} + with: + platform-name: Tizen diff --git a/scripts/tools/memory/platform/tizen.cfg b/scripts/tools/memory/platform/tizen.cfg new file mode 100644 index 00000000000000..294bf21386de3e --- /dev/null +++ b/scripts/tools/memory/platform/tizen.cfg @@ -0,0 +1,67 @@ +# Copyright (c) 2024 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. + +# Memory tools default configuation for Tizen. + +{ + 'section': { + # By default, only these sections will be included + # when operating by sections. + 'default': [ + '.text', '.data', '.data.rel.ro', '.bss', '.dynamic', '.got', + '.init', '.init_array', '.rodata' + ] + }, + 'region': { + # Regions are sets of sections that can be used for aggregate reports. + 'sections': { + 'FLASH': [ + ".dynstr", + ".dynsym", + ".eh_frame_hdr", + ".eh_frame", + ".fini", + ".gcc_except_table", + ".gnu.version_d", + ".gnu.version_r", + ".gnu.version", + ".hash", + ".init", + ".interp", + ".note.ABI-tag", + ".rodata1", + ".rodata", + ".strtab", + ".symtab", + ".text", + ], + 'RAM': [ + ".bss", + ".ctors", + ".data1", + ".data.rel.ro", + ".data", + ".dtors", + ".dynamic", + ".fini_array", + ".got.plt", + ".init_array", + ".jcr", + ".preinit_array", + ".tbss", + ".tdata", + ] + } + }, +} From d8e7e43fec024800a3441762f68123b369c85164 Mon Sep 17 00:00:00 2001 From: Song GUO Date: Tue, 4 Jun 2024 17:53:30 +0000 Subject: [PATCH 045/162] [python] Add ICD support to Python binding (#33533) * [icd] Add ICD support to python * [python] Add ICD support to Python binding * Update * update * update * Update * Use ScopedNodeId in ICD commissioning callbacks * update * fix --- .../commands/pairing/PairingCommand.cpp | 14 +- .../commands/pairing/PairingCommand.h | 4 +- .../commands/pairing/PairingCommand.cpp | 16 +- .../commands/pairing/PairingCommand.h | 4 +- src/controller/CHIPDeviceController.cpp | 10 +- src/controller/DevicePairingDelegate.h | 4 +- .../java/AndroidDeviceControllerWrapper.cpp | 12 +- .../java/AndroidDeviceControllerWrapper.h | 2 +- src/controller/python/BUILD.gn | 3 + .../ChipDeviceController-ScriptBinding.cpp | 88 +++++++++- ...Controller-ScriptDevicePairingDelegate.cpp | 40 +++++ ...ceController-ScriptDevicePairingDelegate.h | 8 +- src/controller/python/OpCredsBinding.cpp | 5 + src/controller/python/chip/ChipDeviceCtrl.py | 163 +++++++++++++++++- src/controller/python/chip/ChipReplStartup.py | 4 +- .../python/chip/icd/PyChipCheckInDelegate.cpp | 33 ++++ .../python/chip/icd/PyChipCheckInDelegate.h | 42 +++++ src/controller/python/chip/internal/types.py | 6 +- 18 files changed, 419 insertions(+), 39 deletions(-) create mode 100644 src/controller/python/chip/icd/PyChipCheckInDelegate.cpp create mode 100644 src/controller/python/chip/icd/PyChipCheckInDelegate.h diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index 5f6c179779f3c2..76c8ac8a58cc19 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -436,7 +436,7 @@ void PairingCommand::OnReadCommissioningInfo(const Controller::ReadCommissioning info.icd.idleModeDuration, info.icd.activeModeDuration, info.icd.activeModeThreshold); } -void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounter) +void PairingCommand::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icdCounter) { char icdSymmetricKeyHex[chip::Crypto::kAES_CCM128_Key_Length * 2 + 1]; @@ -444,7 +444,7 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte sizeof(icdSymmetricKeyHex), chip::Encoding::HexFlags::kNullTerminate); app::ICDClientInfo clientInfo; - clientInfo.peer_node = ScopedNodeId(nodeId, CurrentCommissioner().GetFabricIndex()); + clientInfo.peer_node = nodeId; clientInfo.monitored_subject = mICDMonitoredSubject.Value(); clientInfo.start_icd_counter = icdCounter; @@ -457,7 +457,7 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte if (err != CHIP_NO_ERROR) { CHIPCommand::sICDClientStorage.RemoveKey(clientInfo); - ChipLogError(chipTool, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", ChipLogValueX64(nodeId), + ChipLogError(chipTool, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", ChipLogValueX64(nodeId.GetNodeId()), err.AsString()); SetCommandExitStatus(err); return; @@ -465,18 +465,18 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte mDeviceIsICD = true; - ChipLogProgress(chipTool, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId)); + ChipLogProgress(chipTool, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId.GetNodeId())); ChipLogProgress(chipTool, "ICD Registration Complete for device " ChipLogFormatX64 " / Check-In NodeID: " ChipLogFormatX64 " / Monitored Subject: " ChipLogFormatX64 " / Symmetric Key: %s / ICDCounter %u", - ChipLogValueX64(nodeId), ChipLogValueX64(mICDCheckInNodeId.Value()), + ChipLogValueX64(nodeId.GetNodeId()), ChipLogValueX64(mICDCheckInNodeId.Value()), ChipLogValueX64(mICDMonitoredSubject.Value()), icdSymmetricKeyHex, icdCounter); } -void PairingCommand::OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) +void PairingCommand::OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) { ChipLogProgress(chipTool, "ICD Stay Active Complete for device " ChipLogFormatX64 " / promisedActiveDuration: %u", - ChipLogValueX64(deviceId), promisedActiveDuration); + ChipLogValueX64(deviceId.GetNodeId()), promisedActiveDuration); } void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) diff --git a/examples/chip-tool/commands/pairing/PairingCommand.h b/examples/chip-tool/commands/pairing/PairingCommand.h index 99b0fd0c91882e..aaa8dc714e1017 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.h +++ b/examples/chip-tool/commands/pairing/PairingCommand.h @@ -197,8 +197,8 @@ class PairingCommand : public CHIPCommand, void OnPairingDeleted(CHIP_ERROR error) override; void OnReadCommissioningInfo(const chip::Controller::ReadCommissioningInfo & info) override; void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR error) override; - void OnICDRegistrationComplete(NodeId deviceId, uint32_t icdCounter) override; - void OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) override; + void OnICDRegistrationComplete(chip::ScopedNodeId deviceId, uint32_t icdCounter) override; + void OnICDStayActiveComplete(chip::ScopedNodeId deviceId, uint32_t promisedActiveDuration) override; /////////// DeviceDiscoveryDelegate Interface ///////// void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; diff --git a/examples/fabric-admin/commands/pairing/PairingCommand.cpp b/examples/fabric-admin/commands/pairing/PairingCommand.cpp index 379b56431379e4..92754c2adaa69a 100644 --- a/examples/fabric-admin/commands/pairing/PairingCommand.cpp +++ b/examples/fabric-admin/commands/pairing/PairingCommand.cpp @@ -436,7 +436,7 @@ void PairingCommand::OnReadCommissioningInfo(const Controller::ReadCommissioning info.icd.idleModeDuration, info.icd.activeModeDuration, info.icd.activeModeThreshold); } -void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounter) +void PairingCommand::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icdCounter) { char icdSymmetricKeyHex[chip::Crypto::kAES_CCM128_Key_Length * 2 + 1]; @@ -444,7 +444,7 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte sizeof(icdSymmetricKeyHex), chip::Encoding::HexFlags::kNullTerminate); app::ICDClientInfo clientInfo; - clientInfo.peer_node = ScopedNodeId(nodeId, CurrentCommissioner().GetFabricIndex()); + clientInfo.peer_node = nodeId; clientInfo.monitored_subject = mICDMonitoredSubject.Value(); clientInfo.start_icd_counter = icdCounter; @@ -457,26 +457,26 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte if (err != CHIP_NO_ERROR) { CHIPCommand::sICDClientStorage.RemoveKey(clientInfo); - ChipLogError(NotSpecified, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", ChipLogValueX64(nodeId), - err.AsString()); + ChipLogError(NotSpecified, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", + ChipLogValueX64(nodeId.GetNodeId()), err.AsString()); SetCommandExitStatus(err); return; } mDeviceIsICD = true; - ChipLogProgress(NotSpecified, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId)); + ChipLogProgress(NotSpecified, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId.GetNodeId())); ChipLogProgress(NotSpecified, "ICD Registration Complete for device " ChipLogFormatX64 " / Check-In NodeID: " ChipLogFormatX64 " / Monitored Subject: " ChipLogFormatX64 " / Symmetric Key: %s / ICDCounter %u", - ChipLogValueX64(nodeId), ChipLogValueX64(mICDCheckInNodeId.Value()), + ChipLogValueX64(nodeId.GetNodeId()), ChipLogValueX64(mICDCheckInNodeId.Value()), ChipLogValueX64(mICDMonitoredSubject.Value()), icdSymmetricKeyHex, icdCounter); } -void PairingCommand::OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) +void PairingCommand::OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) { ChipLogProgress(NotSpecified, "ICD Stay Active Complete for device " ChipLogFormatX64 " / promisedActiveDuration: %u", - ChipLogValueX64(deviceId), promisedActiveDuration); + ChipLogValueX64(deviceId.GetNodeId()), promisedActiveDuration); } void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) diff --git a/examples/fabric-admin/commands/pairing/PairingCommand.h b/examples/fabric-admin/commands/pairing/PairingCommand.h index 8de34a0ba989ed..331d177448aed5 100644 --- a/examples/fabric-admin/commands/pairing/PairingCommand.h +++ b/examples/fabric-admin/commands/pairing/PairingCommand.h @@ -196,8 +196,8 @@ class PairingCommand : public CHIPCommand, void OnPairingDeleted(CHIP_ERROR error) override; void OnReadCommissioningInfo(const chip::Controller::ReadCommissioningInfo & info) override; void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR error) override; - void OnICDRegistrationComplete(NodeId deviceId, uint32_t icdCounter) override; - void OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) override; + void OnICDRegistrationComplete(chip::ScopedNodeId deviceId, uint32_t icdCounter) override; + void OnICDStayActiveComplete(chip::ScopedNodeId deviceId, uint32_t promisedActiveDuration) override; /////////// DeviceDiscoveryDelegate Interface ///////// void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 1381ed3381a649..75c95ee20abc06 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1326,8 +1326,8 @@ void DeviceCommissioner::OnICDManagementRegisterClientResponse( if (commissioner->mPairingDelegate != nullptr) { - commissioner->mPairingDelegate->OnICDRegistrationComplete(commissioner->mDeviceBeingCommissioned->GetDeviceId(), - data.ICDCounter); + commissioner->mPairingDelegate->OnICDRegistrationComplete( + ScopedNodeId(commissioner->mDeviceBeingCommissioned->GetDeviceId(), commissioner->GetFabricIndex()), data.ICDCounter); } exit: @@ -1346,8 +1346,10 @@ void DeviceCommissioner::OnICDManagementStayActiveResponse( if (commissioner->mPairingDelegate != nullptr) { - commissioner->mPairingDelegate->OnICDStayActiveComplete(commissioner->mDeviceBeingCommissioned->GetDeviceId(), - data.promisedActiveDuration); + commissioner->mPairingDelegate->OnICDStayActiveComplete( + + ScopedNodeId(commissioner->mDeviceBeingCommissioned->GetDeviceId(), commissioner->GetFabricIndex()), + data.promisedActiveDuration); } exit: diff --git a/src/controller/DevicePairingDelegate.h b/src/controller/DevicePairingDelegate.h index 558a6c16a6bc2e..849df45436d9e8 100644 --- a/src/controller/DevicePairingDelegate.h +++ b/src/controller/DevicePairingDelegate.h @@ -136,7 +136,7 @@ class DLL_EXPORT DevicePairingDelegate * @param[in] icdNodeId The node id of the ICD. * @param[in] icdCounter The ICD Counter received from the device. */ - virtual void OnICDRegistrationComplete(NodeId icdNodeId, uint32_t icdCounter) {} + virtual void OnICDRegistrationComplete(ScopedNodeId icdNodeId, uint32_t icdCounter) {} /** * @brief @@ -147,7 +147,7 @@ class DLL_EXPORT DevicePairingDelegate * @param[in] promisedActiveDurationMsec The actual duration that the ICD server can stay active * from the time it receives the StayActiveRequest command. */ - virtual void OnICDStayActiveComplete(NodeId icdNodeId, uint32_t promisedActiveDurationMsec) {} + virtual void OnICDStayActiveComplete(ScopedNodeId icdNodeId, uint32_t promisedActiveDurationMsec) {} }; } // namespace Controller diff --git a/src/controller/java/AndroidDeviceControllerWrapper.cpp b/src/controller/java/AndroidDeviceControllerWrapper.cpp index 526f6830844f13..87f53735bcf617 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.cpp +++ b/src/controller/java/AndroidDeviceControllerWrapper.cpp @@ -994,13 +994,13 @@ void AndroidDeviceControllerWrapper::OnICDRegistrationInfoRequired() env->CallVoidMethod(mJavaObjectRef.ObjectRef(), onICDRegistrationInfoRequiredMethod); } -void AndroidDeviceControllerWrapper::OnICDRegistrationComplete(chip::NodeId icdNodeId, uint32_t icdCounter) +void AndroidDeviceControllerWrapper::OnICDRegistrationComplete(chip::ScopedNodeId icdNodeId, uint32_t icdCounter) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; chip::app::ICDClientInfo clientInfo; - clientInfo.peer_node = ScopedNodeId(icdNodeId, Controller()->GetFabricIndex()); + clientInfo.peer_node = icdNodeId; clientInfo.monitored_subject = mAutoCommissioner.GetCommissioningParameters().GetICDMonitoredSubject().Value(); clientInfo.start_icd_counter = icdCounter; @@ -1014,13 +1014,13 @@ void AndroidDeviceControllerWrapper::OnICDRegistrationComplete(chip::NodeId icdN if (err == CHIP_NO_ERROR) { - ChipLogProgress(Controller, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(icdNodeId)); + ChipLogProgress(Controller, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(icdNodeId.GetNodeId())); } else { getICDClientStorage()->RemoveKey(clientInfo); - ChipLogError(Controller, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", ChipLogValueX64(icdNodeId), - err.AsString()); + ChipLogError(Controller, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", + ChipLogValueX64(icdNodeId.GetNodeId()), err.AsString()); } mDeviceIsICD = true; @@ -1055,7 +1055,7 @@ void AndroidDeviceControllerWrapper::OnICDRegistrationComplete(chip::NodeId icdN icdDeviceInfoObj = env->NewObject( icdDeviceInfoClass, icdDeviceInfoStructCtor, jSymmetricKey, static_cast(mUserActiveModeTriggerHint.Raw()), jUserActiveModeTriggerInstruction, static_cast(mIdleModeDuration), static_cast(mActiveModeDuration), - static_cast(mActiveModeThreshold), static_cast(icdNodeId), static_cast(icdCounter), + static_cast(mActiveModeThreshold), static_cast(icdNodeId.GetNodeId()), static_cast(icdCounter), static_cast(mAutoCommissioner.GetCommissioningParameters().GetICDMonitoredSubject().Value()), static_cast(Controller()->GetFabricId()), static_cast(Controller()->GetFabricIndex())); diff --git a/src/controller/java/AndroidDeviceControllerWrapper.h b/src/controller/java/AndroidDeviceControllerWrapper.h index 1d26d31d112774..02d50499bbbcda 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.h +++ b/src/controller/java/AndroidDeviceControllerWrapper.h @@ -118,7 +118,7 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel const chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworksResponse::DecodableType & dataResponse) override; void OnScanNetworksFailure(CHIP_ERROR error) override; void OnICDRegistrationInfoRequired() override; - void OnICDRegistrationComplete(chip::NodeId icdNodeId, uint32_t icdCounter) override; + void OnICDRegistrationComplete(chip::ScopedNodeId icdNodeId, uint32_t icdCounter) override; // PersistentStorageDelegate implementation CHIP_ERROR SyncSetKeyValue(const char * key, const void * value, uint16_t size) override; diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index 4676f89b362970..9adda770125317 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -76,6 +76,8 @@ shared_library("ChipDeviceCtrl") { "chip/crypto/p256keypair.cpp", "chip/crypto/p256keypair.h", "chip/discovery/NodeResolution.cpp", + "chip/icd/PyChipCheckInDelegate.cpp", + "chip/icd/PyChipCheckInDelegate.h", "chip/interaction_model/Delegate.cpp", "chip/interaction_model/Delegate.h", "chip/internal/ChipThreadWork.cpp", @@ -121,6 +123,7 @@ shared_library("ChipDeviceCtrl") { public_deps = [ "${chip_root}/src/app", + "${chip_root}/src/app/icd/client:handler", "${chip_root}/src/app/server", "${chip_root}/src/credentials:default_attestation_verifier", "${chip_root}/src/lib", diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 728fd5801f1cb1..821b2a34e03b60 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -42,6 +42,9 @@ #include #include +#include +#include +#include #include #include #include @@ -55,7 +58,9 @@ #include #include #include +#include #include +#include #include #include @@ -101,20 +106,24 @@ chip::Platform::ScopedMemoryBuffer sDefaultNTPBuf; app::Clusters::TimeSynchronization::Structs::DSTOffsetStruct::Type sDSTBuf; app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::Type sTimeZoneBuf; chip::Platform::ScopedMemoryBuffer sTimeZoneNameBuf; -chip::Controller::CommissioningParameters sCommissioningParameters; - } // namespace +chip::Controller::CommissioningParameters sCommissioningParameters; +chip::app::DefaultICDClientStorage sICDClientStorage; chip::Controller::ScriptPairingDeviceDiscoveryDelegate sPairingDeviceDiscoveryDelegate; chip::Credentials::GroupDataProviderImpl sGroupDataProvider; chip::Credentials::PersistentStorageOpCertStore sPersistentStorageOpCertStore; chip::Crypto::RawKeySessionKeystore sSessionKeystore; +chip::app::CheckInHandler sCheckInHandler; + // NOTE: Remote device ID is in sync with the echo server device id // At some point, we may want to add an option to connect to a device without // knowing its id, because the ID can be learned on the first response that is received. +chip::Controller::PyChipCheckInDelegate sCheckInDelegate; chip::NodeId kDefaultLocalDeviceId = chip::kTestControllerNodeId; chip::NodeId kRemoteDeviceId = chip::kTestDeviceNodeId; +uint8_t sICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length]; extern "C" { PyChipError pychip_DeviceController_StackInit(Controller::Python::StorageAdapter * storageAdapter, bool enableServerInteractions); @@ -126,6 +135,7 @@ PyChipError pychip_DeviceController_GetAddressAndPort(chip::Controller::DeviceCo char * outAddress, uint64_t maxAddressLen, uint16_t * outPort); PyChipError pychip_DeviceController_GetCompressedFabricId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outFabricId); PyChipError pychip_DeviceController_GetFabricId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outFabricId); +PyChipError pychip_DeviceController_GetFabricIndex(chip::Controller::DeviceCommissioner * devCtrl, uint8_t * outFabricIndex); PyChipError pychip_DeviceController_GetNodeId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outNodeId); // Rendezvous @@ -144,6 +154,8 @@ PyChipError pychip_DeviceController_SetDSTOffset(int32_t offset, uint64_t validS PyChipError pychip_DeviceController_SetDefaultNtp(const char * defaultNTP); PyChipError pychip_DeviceController_SetTrustedTimeSource(chip::NodeId nodeId, chip::EndpointId endpoint); PyChipError pychip_DeviceController_SetCheckMatchingFabric(bool check); +struct IcdRegistrationParameters; +PyChipError pychip_DeviceController_SetIcdRegistrationParameters(bool enabled, const IcdRegistrationParameters * params); PyChipError pychip_DeviceController_ResetCommissioningParameters(); PyChipError pychip_DeviceController_CloseSession(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeid); PyChipError pychip_DeviceController_EstablishPASESessionIP(chip::Controller::DeviceCommissioner * devCtrl, const char * peerAddrStr, @@ -235,6 +247,11 @@ void * pychip_Storage_InitializeStorageAdapter(chip::Controller::Python::PyObjec chip::Controller::Python::SetGetKeyValueCb getCb, chip::Controller::Python::SyncDeleteKeyValueCb deleteCb); void pychip_Storage_ShutdownAdapter(chip::Controller::Python::StorageAdapter * storageAdapter); + +// +// ICD +// +void pychip_CheckInDelegate_SetOnCheckInCompleteCallback(PyChipCheckInDelegate::OnCheckInCompleteCallback * callback); } void * pychip_Storage_InitializeStorageAdapter(chip::Controller::Python::PyObject * context, @@ -260,6 +277,8 @@ PyChipError pychip_DeviceController_StackInit(Controller::Python::StorageAdapter factoryParams.fabricIndependentStorage = storageAdapter; factoryParams.sessionKeystore = &sSessionKeystore; + sICDClientStorage.Init(storageAdapter, &sSessionKeystore); + sGroupDataProvider.SetStorageDelegate(storageAdapter); sGroupDataProvider.SetSessionKeystore(factoryParams.sessionKeystore); PyReturnErrorOnFailure(ToPyChipError(sGroupDataProvider.Init())); @@ -290,6 +309,11 @@ PyChipError pychip_DeviceController_StackInit(Controller::Python::StorageAdapter // DeviceControllerFactory::GetInstance().RetainSystemState(); + auto engine = chip::app::InteractionModelEngine::GetInstance(); + PyReturnErrorOnFailure(ToPyChipError(sCheckInDelegate.Init(&sICDClientStorage, engine))); + PyReturnErrorOnFailure(ToPyChipError(sCheckInHandler.Init( + DeviceControllerFactory::GetInstance().GetSystemState()->ExchangeMgr(), &sICDClientStorage, &sCheckInDelegate, engine))); + // // Finally, start up the main Matter thread. Any further interactions with the stack // will now need to happen on the Matter thread, OR protected with the stack lock. @@ -342,6 +366,12 @@ PyChipError pychip_DeviceController_GetFabricId(chip::Controller::DeviceCommissi return ToPyChipError(CHIP_NO_ERROR); } +PyChipError pychip_DeviceController_GetFabricIndex(chip::Controller::DeviceCommissioner * devCtrl, uint8_t * outFabricIndex) +{ + *outFabricIndex = devCtrl->GetFabricIndex(); + return ToPyChipError(CHIP_NO_ERROR); +} + PyChipError pychip_DeviceController_GetNodeId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outNodeId) { *outNodeId = devCtrl->GetNodeId(); @@ -554,6 +584,55 @@ PyChipError pychip_DeviceController_SetCheckMatchingFabric(bool check) return ToPyChipError(CHIP_NO_ERROR); } +struct IcdRegistrationParameters +{ + uint8_t * symmetricKey; + size_t symmetricKeyLength; + uint64_t checkInNodeId; + uint64_t monitoredSubject; + uint32_t stayActiveMsec; +}; + +PyChipError pychip_DeviceController_SetIcdRegistrationParameters(bool enabled, const IcdRegistrationParameters * params) +{ + if (!enabled) + { + sCommissioningParameters.SetICDRegistrationStrategy(ICDRegistrationStrategy::kIgnore); + return ToPyChipError(CHIP_NO_ERROR); + } + + if (params == nullptr) + { + return ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT); + } + + if (params->symmetricKey == nullptr || params->symmetricKeyLength != sizeof(sICDSymmetricKey)) + { + return ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT); + } + + if (params->checkInNodeId == 0) + { + return ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT); + } + if (params->monitoredSubject == 0) + { + return ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT); + } + + memcpy(sICDSymmetricKey, params->symmetricKey, sizeof(sICDSymmetricKey)); + sCommissioningParameters.SetICDSymmetricKey(ByteSpan(sICDSymmetricKey)); + if (params->stayActiveMsec != 0) + { + sCommissioningParameters.SetICDStayActiveDurationMsec(params->stayActiveMsec); + } + sCommissioningParameters.SetICDCheckInNodeId(params->checkInNodeId); + sCommissioningParameters.SetICDMonitoredSubject(params->monitoredSubject); + sCommissioningParameters.SetICDRegistrationStrategy(ICDRegistrationStrategy::kBeforeComplete); + + return ToPyChipError(CHIP_NO_ERROR); +} + PyChipError pychip_DeviceController_ResetCommissioningParameters() { sCommissioningParameters = CommissioningParameters(); @@ -871,3 +950,8 @@ PyChipError pychip_DeviceController_PostTaskOnChipThread(ChipThreadTaskRunnerFun PlatformMgr().ScheduleWork(callback, reinterpret_cast(pythonContext)); return ToPyChipError(CHIP_NO_ERROR); } + +void pychip_CheckInDelegate_SetOnCheckInCompleteCallback(PyChipCheckInDelegate::OnCheckInCompleteCallback * callback) +{ + chip::MainLoopWork::ExecuteInMainLoop([callback]() { sCheckInDelegate.SetOnCheckInCompleteCallback(callback); }); +} diff --git a/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp b/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp index c1df8125793d02..c979e0d9cd77a3 100644 --- a/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp +++ b/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp @@ -19,12 +19,17 @@ #include "ChipDeviceController-ScriptDevicePairingDelegate.h" #include "lib/support/TypeTraits.h" +#include #include #include #include #include +extern chip::app::DefaultICDClientStorage sICDClientStorage; +extern chip::Controller::CommissioningParameters sCommissioningParameters; +extern uint8_t sICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length]; + namespace chip { namespace Controller { @@ -180,5 +185,40 @@ ScriptDevicePairingDelegate::GetOpenWindowCallback(Controller::CommissioningWind return &mOpenWindowCallback; } +void ScriptDevicePairingDelegate::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icdCounter) +{ + app::ICDClientInfo clientInfo; + clientInfo.peer_node = nodeId; + clientInfo.monitored_subject = sCommissioningParameters.GetICDMonitoredSubject().Value(); + clientInfo.start_icd_counter = icdCounter; + + CHIP_ERROR err = sICDClientStorage.SetKey(clientInfo, ByteSpan(sICDSymmetricKey)); + if (err == CHIP_NO_ERROR) + { + err = sICDClientStorage.StoreEntry(clientInfo); + } + + if (err != CHIP_NO_ERROR) + { + sICDClientStorage.RemoveKey(clientInfo); + ChipLogError(Controller, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", + ChipLogValueX64(nodeId.GetNodeId()), err.AsString()); + return; + } + + ChipLogProgress(Controller, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId.GetNodeId())); + ChipLogProgress(Controller, + "ICD Registration Complete for device " ChipLogFormatX64 " / Check-In NodeID: " ChipLogFormatX64 + " / Monitored Subject: " ChipLogFormatX64 " / ICDCounter %u", + ChipLogValueX64(nodeId.GetNodeId()), ChipLogValueX64(sCommissioningParameters.GetICDCheckInNodeId().Value()), + ChipLogValueX64(clientInfo.monitored_subject), icdCounter); +} + +void ScriptDevicePairingDelegate::OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) +{ + ChipLogProgress(Controller, "ICD Stay Active Complete for device " ChipLogFormatX64 " / promisedActiveDuration: %u", + ChipLogValueX64(deviceId.GetNodeId()), promisedActiveDuration); +} + } // namespace Controller } // namespace chip diff --git a/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.h b/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.h index 2740b6eb85e983..d6665f8fb2baba 100644 --- a/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.h +++ b/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.h @@ -27,6 +27,7 @@ #include #include +#include #include namespace chip { @@ -68,11 +69,14 @@ class ScriptDevicePairingDelegate final : public Controller::DevicePairingDelega void OnCommissioningFailure(PeerId peerId, CHIP_ERROR error, CommissioningStage stageFailed, Optional additionalErrorInfo) override; void OnCommissioningStatusUpdate(PeerId peerId, CommissioningStage stageCompleted, CHIP_ERROR error) override; + void OnICDRegistrationComplete(ScopedNodeId deviceId, uint32_t icdCounter) override; + void OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) override; void OnFabricCheck(NodeId matchingNodeId) override; Callback::Callback * GetOpenWindowCallback(Controller::CommissioningWindowOpener * context); void OnOpenCommissioningWindow(NodeId deviceId, CHIP_ERROR status, SetupPayload payload); void SetExpectingPairingComplete(bool value) { expectingPairingComplete = value; } + void SetFabricIndex(FabricIndex fabricIndex) { mFabricIndex = fabricIndex; } private: DevicePairingDelegate_OnPairingCompleteFunct mOnPairingCompleteCallback = nullptr; @@ -84,7 +88,9 @@ class ScriptDevicePairingDelegate final : public Controller::DevicePairingDelega DevicePairingDelegate_OnFabricCheckFunct mOnFabricCheckCallback = nullptr; Callback::Callback mOpenWindowCallback; Controller::CommissioningWindowOpener * mWindowOpener = nullptr; - bool expectingPairingComplete = false; + + bool expectingPairingComplete = false; + FabricIndex mFabricIndex = 0; }; } // namespace Controller diff --git a/src/controller/python/OpCredsBinding.cpp b/src/controller/python/OpCredsBinding.cpp index 5fd4205d4c7ce7..427ee9be46ba3c 100644 --- a/src/controller/python/OpCredsBinding.cpp +++ b/src/controller/python/OpCredsBinding.cpp @@ -26,6 +26,7 @@ #include "controller/python/chip/crypto/p256keypair.h" #include "controller/python/chip/interaction_model/Delegate.h" +#include #include #include #include @@ -104,6 +105,7 @@ class OperationalCredentialsAdapter : public OperationalCredentialsDelegate extern chip::Credentials::GroupDataProviderImpl sGroupDataProvider; extern chip::Controller::ScriptDevicePairingDelegate sPairingDelegate; +extern chip::app::DefaultICDClientStorage sICDClientStorage; class TestCommissioner : public chip::Controller::AutoCommissioner { @@ -569,6 +571,9 @@ PyChipError pychip_OpCreds_AllocateController(OpCredsContext * context, chip::Co chip::Credentials::SetSingleIpkEpochKey(&sGroupDataProvider, devCtrl->GetFabricIndex(), defaultIpk, compressedFabricIdSpan); VerifyOrReturnError(err == CHIP_NO_ERROR, ToPyChipError(err)); + sICDClientStorage.UpdateFabricList(devCtrl->GetFabricIndex()); + pairingDelegate->SetFabricIndex(devCtrl->GetFabricIndex()); + *outDevCtrl = devCtrl.release(); *outPairingDelegate = pairingDelegate.release(); diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 4fb8fb28bcaf90..2ba7c584db927b 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -35,11 +35,12 @@ import enum import json import logging +import secrets import threading import time import typing -from ctypes import (CDLL, CFUNCTYPE, POINTER, byref, c_bool, c_char, c_char_p, c_int, c_int32, c_size_t, c_uint8, c_uint16, - c_uint32, c_uint64, c_void_p, create_string_buffer, pointer, py_object, resize, string_at) +from ctypes import (CDLL, CFUNCTYPE, POINTER, Structure, byref, c_bool, c_char, c_char_p, c_int, c_int32, c_size_t, c_uint8, + c_uint16, c_uint32, c_uint64, c_void_p, create_string_buffer, pointer, py_object, resize, string_at) from dataclasses import dataclass import dacite @@ -98,6 +99,21 @@ class NOCChain: adminSubject: int +@dataclass +class ICDRegistrationParameters: + symmetricKey: typing.Optional[bytes] + checkInNodeId: typing.Optional[int] + monitoredSubject: typing.Optional[int] + stayActiveMs: typing.Optional[int] + + class CStruct(Structure): + _fields_ = [('symmetricKey', c_char_p), ('symmetricKeyLength', c_size_t), ('checkInNodeId', + c_uint64), ('monitoredSubject', c_uint64), ('stayActiveMsec', c_uint32)] + + def to_c(self): + return ICDRegistrationParameters.CStruct(self.symmetricKey, len(self.symmetricKey), self.checkInNodeId, self.monitoredSubject, self.stayActiveMs) + + @_DeviceAvailableCallbackFunct def _DeviceAvailableCallback(closure, device, err): closure.deviceAvailable(device, err) @@ -123,6 +139,77 @@ def _IssueNOCChainCallbackPythonCallback(devCtrl, status: PyChipError, noc: c_vo nocChain = NOCChain(nocBytes, icacBytes, rcacBytes, ipkBytes, adminSubject) devCtrl.NOCChainCallback(nocChain) + +# Methods for ICD +class ScopedNodeId(Structure): + _fields_ = [("nodeId", c_uint64), ("fabricIndex", c_uint8)] + + def __hash__(self): + return self.nodeId << 8 | self.fabricIndex + + def __str__(self): + return f"({self.fabricIndex}:{self.nodeId:16x})" + + def __eq__(self, other): + return self.nodeId == other.nodeId and self.fabricIndex == other.fabricIndex + + +_OnCheckInCompleteFunct = CFUNCTYPE(None, ScopedNodeId) + +_OnCheckInCompleteWaitListLock = threading.Lock() +_OnCheckInCompleteWaitList = dict() + + +@_OnCheckInCompleteFunct +def _OnCheckInComplete(scopedNodeId: ScopedNodeId): + callbacks = [] + with _OnCheckInCompleteWaitListLock: + callbacks = list(_OnCheckInCompleteWaitList.get(scopedNodeId, set())) + + for callback in callbacks: + callback(scopedNodeId) + + +def RegisterOnActiveCallback(scopedNodeId: ScopedNodeId, callback: typing.Callable[None, [ScopedNodeId]]): + ''' Registers a callback when the device with given (fabric index, node id) becomes active. + + Does nothing if the callback is already registered. + ''' + with _OnCheckInCompleteWaitListLock: + waitList = _OnCheckInCompleteWaitList.get(scopedNodeId, set()) + waitList.add(callback) + _OnCheckInCompleteWaitList[scopedNodeId] = waitList + + +def UnregisterOnActiveCallback(scopedNodeId: ScopedNodeId, callback: typing.Callable[None, [ScopedNodeId]]): + ''' Unregisters a callback when the device with given (fabric index, node id) becomes active. + + Does nothing if the callback has not been registered. + ''' + with _OnCheckInCompleteWaitListLock: + _OnCheckInCompleteWaitList.get(scopedNodeId, set()).remove(callback) + + +async def WaitForCheckIn(scopedNodeId: ScopedNodeId, timeoutSeconds: float): + ''' Waits for a device becomes active. + + Returns: + - A future, completes when the device becomes active. + ''' + eventLoop = asyncio.get_running_loop() + future = eventLoop.create_future() + + def OnCheckInCallback(nodeid): + eventLoop.call_soon_threadsafe(lambda: future.done() or future.set_result(None)) + + RegisterOnActiveCallback(scopedNodeId, OnCheckInCallback) + + try: + async with asyncio.timeout(timeoutSeconds): + await future + finally: + UnregisterOnActiveCallback(scopedNodeId, OnCheckInCallback) + # This is a fix for WEAV-429. Jay Logue recommends revisiting this at a later # date to allow for truly multiple instances so this is temporary. @@ -269,6 +356,7 @@ def HandleCommissioningComplete(nodeid, err): else: logging.warning("Failed to commission: {}".format(err)) + self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters(False, None) self.state = DCState.IDLE self._ChipStack.callbackRes = err self._ChipStack.commissioningEventRes = err @@ -347,6 +435,7 @@ def HandlePASEEstablishmentComplete(err: PyChipError): self._isActive = True # Validate FabricID/NodeID followed from NOC Chain self._fabricId = self.GetFabricIdInternal() + self._fabricIndex = self.GetFabricIndexInternal() self._nodeId = self.GetNodeIdInternal() def _finish_init(self): @@ -766,6 +855,19 @@ def GetFabricIdInternal(self): return fabricid.value + def GetFabricIndexInternal(self): + """Get the fabric index from the object. Only used to validate cached value from property.""" + self.CheckIsActive() + + fabricindex = c_uint8(0) + + self._ChipStack.Call( + lambda: self._dmLib.pychip_DeviceController_GetFabricIndex( + self.devCtrl, pointer(fabricindex)) + ).raise_on_error() + + return fabricindex.value + def GetNodeIdInternal(self) -> int: """Get the node ID from the object. Only used to validate cached value from property.""" self.CheckIsActive() @@ -841,6 +943,18 @@ def deviceAvailable(self, device, err): return DeviceProxyWrapper(returnDevice, self._dmLib) + async def WaitForActive(self, nodeid, *, timeoutSeconds=30.0, stayActiveDurationMs=30000): + ''' Waits a LIT ICD device to become active. Will send a StayActive command to the device on active to allow human operations. + + nodeId: Node ID of the LID ICD + stayActiveDurationMs: The duration in the StayActive command, in milliseconds + + Returns: + - StayActiveResponse on success + ''' + await WaitForCheckIn(ScopedNodeId(nodeid, self._fabricIndex), timeoutSeconds=timeoutSeconds) + return await self.SendCommand(nodeid, 0, Clusters.IcdManagement.Commands.StayActiveRequest(stayActiveDuration=stayActiveDurationMs)) + async def GetConnectedDevice(self, nodeid, allowPASE: bool = True, timeoutMs: int = None): ''' Gets an OperationalDeviceProxy or CommissioneeDeviceProxy for the specified Node. @@ -1536,6 +1650,11 @@ def _InitLib(self): self._dmLib.pychip_DeviceController_SetCheckMatchingFabric.restype = PyChipError self._dmLib.pychip_DeviceController_SetCheckMatchingFabric.argtypes = [c_bool] + self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters.restype = PyChipError + self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters.argtypes = [ + c_bool, c_void_p + ] + self._dmLib.pychip_DeviceController_ResetCommissioningParameters.restype = PyChipError self._dmLib.pychip_DeviceController_ResetCommissioningParameters.argtypes = [] @@ -1722,6 +1841,9 @@ def _InitLib(self): self._dmLib.pychip_DeviceController_GetFabricId.argtypes = [c_void_p, POINTER(c_uint64)] self._dmLib.pychip_DeviceController_GetFabricId.restype = PyChipError + self._dmLib.pychip_DeviceController_GetFabricIndex.argtypes = [c_void_p, POINTER(c_uint8)] + self._dmLib.pychip_DeviceController_GetFabricIndex.restype = PyChipError + self._dmLib.pychip_DeviceController_GetLogFilter = [None] self._dmLib.pychip_DeviceController_GetLogFilter = c_uint8 @@ -1736,6 +1858,11 @@ def _InitLib(self): self._dmLib.pychip_DeviceController_SetIpk.argtypes = [c_void_p, POINTER(c_char), c_size_t] self._dmLib.pychip_DeviceController_SetIpk.restype = PyChipError + self._dmLib.pychip_CheckInDelegate_SetOnCheckInCompleteCallback.restype = None + self._dmLib.pychip_CheckInDelegate_SetOnCheckInCompleteCallback.argtypes = [_OnCheckInCompleteFunct] + + self._dmLib.pychip_CheckInDelegate_SetOnCheckInCompleteCallback(_OnCheckInComplete) + class ChipDeviceController(ChipDeviceControllerBase): ''' The ChipDeviceCommissioner binding, named as ChipDeviceController @@ -1884,6 +2011,38 @@ def SetCheckMatchingFabric(self, check: bool): lambda: self._dmLib.pychip_DeviceController_SetCheckMatchingFabric(check) ).raise_on_error() + def GenerateICDRegistrationParameters(self): + ''' Generates ICD registration parameters for this controller. ''' + return ICDRegistrationParameters( + secrets.token_bytes(16), + self._nodeId, + self._nodeId, + 30) + + def EnableICDRegistration(self, parameters: ICDRegistrationParameters): + ''' Enables ICD registration for the following commissioning session. + + Args: + parameters: A ICDRegistrationParameters for the parameters used for ICD registration, or None for default arguments. + ''' + if parameters is None: + raise ValueError("ICD registration parameter required.") + if len(parameters.symmetricKey) != 16: + raise ValueError("symmetricKey should be 16 bytes") + + self.CheckIsActive() + self._ChipStack.Call( + lambda: self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters( + True, pointer(parameters.to_c())) + ).raise_on_error() + + def DisableICDRegistration(self): + ''' Disables ICD registration. ''' + self.CheckIsActive() + self._ChipStack.Call( + lambda: self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters(False, None) + ).raise_on_error() + def GetFabricCheckResult(self) -> int: ''' Returns the fabric check result if SetCheckMatchingFabric was used.''' return self.fabricCheckNodeId diff --git a/src/controller/python/chip/ChipReplStartup.py b/src/controller/python/chip/ChipReplStartup.py index b75c77efcd5b2b..13a93a1efb453b 100644 --- a/src/controller/python/chip/ChipReplStartup.py +++ b/src/controller/python/chip/ChipReplStartup.py @@ -96,6 +96,8 @@ def main(): "-t", "--trust-store", help="Path to the PAA trust store.", action="store", default="./credentials/development/paa-root-certs") parser.add_argument( "-b", "--ble-adapter", help="Set the Bluetooth adapter index.", type=int, default=None) + parser.add_argument( + "-s", "--server-interactions", help="Enable server interactions.", action="store_true") args = parser.parse_args() if not os.path.exists(args.trust_store): @@ -139,7 +141,7 @@ def main(): ReplInit(args.debug) - chipStack = ChipStack(persistentStoragePath=args.storagepath, enableServerInteractions=False) + chipStack = ChipStack(persistentStoragePath=args.storagepath, enableServerInteractions=args.server_interactions) certificateAuthorityManager = chip.CertificateAuthority.CertificateAuthorityManager(chipStack, chipStack.GetStorageManager()) certificateAuthorityManager.LoadAuthoritiesFromStorage() diff --git a/src/controller/python/chip/icd/PyChipCheckInDelegate.cpp b/src/controller/python/chip/icd/PyChipCheckInDelegate.cpp new file mode 100644 index 00000000000000..03f6b7de1003e6 --- /dev/null +++ b/src/controller/python/chip/icd/PyChipCheckInDelegate.cpp @@ -0,0 +1,33 @@ +/* + * + * Copyright (c) 2024 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 "PyChipCheckInDelegate.h" + +using namespace ::chip; +using namespace ::chip::app; +using namespace ::chip::Controller; + +void PyChipCheckInDelegate::OnCheckInComplete(const ICDClientInfo & clientInfo) +{ + DefaultCheckInDelegate::OnCheckInComplete(clientInfo); + + if (mCallback != nullptr) + { + mCallback(clientInfo.peer_node); + } +} diff --git a/src/controller/python/chip/icd/PyChipCheckInDelegate.h b/src/controller/python/chip/icd/PyChipCheckInDelegate.h new file mode 100644 index 00000000000000..3e3a3d9871af24 --- /dev/null +++ b/src/controller/python/chip/icd/PyChipCheckInDelegate.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2024 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 + +namespace chip { +namespace Controller { + +class PyChipCheckInDelegate : public chip::app::DefaultCheckInDelegate +{ +public: + using OnCheckInCompleteCallback = void(chip::ScopedNodeId); + + virtual ~PyChipCheckInDelegate() = default; + + void OnCheckInComplete(const chip::app::ICDClientInfo & clientInfo) override; + + void SetOnCheckInCompleteCallback(OnCheckInCompleteCallback * callback) { mCallback = callback; } + +private: + OnCheckInCompleteCallback * mCallback; +}; + +} // namespace Controller +} // namespace chip diff --git a/src/controller/python/chip/internal/types.py b/src/controller/python/chip/internal/types.py index 190456969b2006..34c14737a47ff7 100644 --- a/src/controller/python/chip/internal/types.py +++ b/src/controller/python/chip/internal/types.py @@ -14,7 +14,7 @@ # limitations under the License. # -from ctypes import CFUNCTYPE, c_size_t, c_uint32, c_void_p +from ctypes import CFUNCTYPE, Structure, c_size_t, c_uint32, c_uint64, c_void_p # General callback of 'network credentials requested. No python-data # is available as the underlying callback is used internally @@ -26,3 +26,7 @@ # Notification that pairing has been coompleted PairingComplete = CFUNCTYPE(None, c_uint32) + + +class ScopedNodeId(Structure): + _fields_ = [("node_id", c_uint64), ("fabric_index", "c_uint8")] From 405a083d1235e84e033de269d4bddbcf0a472b9a Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 5 Jun 2024 04:36:01 +0900 Subject: [PATCH 046/162] Add Compare IPAddress in OndiscoveredNode (#33583) * Add Compare IPAddress in discoveredNode * Restyled by clang-format * Fix function name, pointer -> array * Restyled by clang-format * Modify from comment * Restyled by clang-format * Update from comments * Update src/controller/AbstractDnssdDiscoveryController.cpp Co-authored-by: Andrei Litvin --------- Co-authored-by: Restyled.io Co-authored-by: yunhanw-google Co-authored-by: Andrei Litvin --- .../AbstractDnssdDiscoveryController.cpp | 33 +++++- .../TestCommissionableNodeController.cpp | 101 ++++++++++++++++++ 2 files changed, 131 insertions(+), 3 deletions(-) diff --git a/src/controller/AbstractDnssdDiscoveryController.cpp b/src/controller/AbstractDnssdDiscoveryController.cpp index 3d3ca4c8097955..9d59e2dfdbca03 100644 --- a/src/controller/AbstractDnssdDiscoveryController.cpp +++ b/src/controller/AbstractDnssdDiscoveryController.cpp @@ -22,9 +22,36 @@ #include #include +#include + namespace chip { namespace Controller { +static bool SameExceptOrder(const chip::Span & v1, const chip::Span & v2) +{ + std::bitset addressUsed; + + VerifyOrDie(v1.size() <= Dnssd::CommissionNodeData::kMaxIPAddresses && v2.size() <= Dnssd::CommissionNodeData::kMaxIPAddresses); + if (v1.size() != v2.size()) + { + return false; + } + + for (size_t s = 0; s < v1.size(); s++) + { + for (size_t d = 0; d < v2.size(); d++) + { + if (!addressUsed[d] && v1[s] == v2[d]) + { + // Change the used flag so that the compared target is no longer used + addressUsed.set(d, true); + break; + } + } + } + return addressUsed.count() == v2.size(); +} + void AbstractDnssdDiscoveryController::OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & discNodeData) { VerifyOrReturn(discNodeData.Is()); @@ -38,10 +65,10 @@ void AbstractDnssdDiscoveryController::OnNodeDiscovered(const chip::Dnssd::Disco { continue; } - // TODO(#32576) Check if IP address are the same. Must account for `numIPs` in the list of `ipAddress`. - // Additionally, must NOT assume that the ordering is consistent. + chip::Span discoveredNodeIPAddressSpan(&discoveredNode.ipAddress[0], discoveredNode.numIPs); + chip::Span nodeDataIPAddressSpan(&nodeData.ipAddress[0], nodeData.numIPs); if (strcmp(discoveredNode.hostName, nodeData.hostName) == 0 && discoveredNode.port == nodeData.port && - discoveredNode.numIPs == nodeData.numIPs) + SameExceptOrder(discoveredNodeIPAddressSpan, nodeDataIPAddressSpan)) { discoveredNode = nodeData; if (mDeviceDiscoveryDelegate != nullptr) diff --git a/src/controller/tests/TestCommissionableNodeController.cpp b/src/controller/tests/TestCommissionableNodeController.cpp index b68d0748d62c42..6d9ef65db11e97 100644 --- a/src/controller/tests/TestCommissionableNodeController.cpp +++ b/src/controller/tests/TestCommissionableNodeController.cpp @@ -182,4 +182,105 @@ TEST_F(TestCommissionableNodeController, TestDiscoverCommissioners_DiscoverCommi EXPECT_NE(controller.DiscoverCommissioners(), CHIP_NO_ERROR); } +TEST_F(TestCommissionableNodeController, TestGetDiscoveredCommissioner_MultipleIPAddressDiscover) +{ + MockResolver resolver; + CommissionableNodeController controller(&resolver); + + // example 1 + chip::Dnssd::DiscoveredNodeData discNodeData1; + discNodeData1.Set(); + chip::Dnssd::CommissionNodeData & inNodeData1 = discNodeData1.Get(); + Platform::CopyString(inNodeData1.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData1.ipAddress[0]); + inNodeData1.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:5555", inNodeData1.ipAddress[1]); + inNodeData1.numIPs++; + inNodeData1.port = 5540; + + controller.OnNodeDiscovered(discNodeData1); + + // example 5 - exactly same as example 1 + chip::Dnssd::DiscoveredNodeData discNodeData5; + discNodeData5.Set(); + chip::Dnssd::CommissionNodeData & inNodeData5 = discNodeData5.Get(); + Platform::CopyString(inNodeData1.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData5.ipAddress[0]); + inNodeData5.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:5555", inNodeData5.ipAddress[1]); + inNodeData5.numIPs++; + inNodeData5.port = 5540; + + controller.OnNodeDiscovered(discNodeData5); + + // example 2 - same as example 1 (IPAdress sequence is only different.) + chip::Dnssd::DiscoveredNodeData discNodeData2; + discNodeData2.Set(); + chip::Dnssd::CommissionNodeData & inNodeData2 = discNodeData2.Get(); + Platform::CopyString(inNodeData2.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:5555", inNodeData2.ipAddress[0]); + inNodeData2.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData2.ipAddress[1]); + inNodeData2.numIPs++; + inNodeData2.port = 5540; + + controller.OnNodeDiscovered(discNodeData2); + + // example 3 - different example + chip::Dnssd::DiscoveredNodeData discNodeData3; + discNodeData3.Set(); + chip::Dnssd::CommissionNodeData & inNodeData3 = discNodeData3.Get(); + Platform::CopyString(inNodeData3.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData3.ipAddress[0]); + inNodeData3.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:6666", inNodeData3.ipAddress[1]); + inNodeData3.numIPs++; + inNodeData3.port = 5540; + + controller.OnNodeDiscovered(discNodeData3); + + // example 4 - different example (Different IP count) + chip::Dnssd::DiscoveredNodeData discNodeData4; + discNodeData4.Set(); + chip::Dnssd::CommissionNodeData & inNodeData4 = discNodeData4.Get(); + Platform::CopyString(inNodeData4.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData4.ipAddress[0]); + inNodeData4.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:6666", inNodeData4.ipAddress[1]); + inNodeData4.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:7777", inNodeData4.ipAddress[2]); + inNodeData4.numIPs++; + inNodeData4.port = 5540; + + controller.OnNodeDiscovered(discNodeData4); + + // Example 2 result - example 1 is removed. (reason : duplicate) + ASSERT_NE(controller.GetDiscoveredCommissioner(0), nullptr); + EXPECT_STREQ(inNodeData1.hostName, controller.GetDiscoveredCommissioner(0)->hostName); + EXPECT_EQ(inNodeData2.ipAddress[0], controller.GetDiscoveredCommissioner(0)->ipAddress[0]); + EXPECT_EQ(inNodeData2.ipAddress[1], controller.GetDiscoveredCommissioner(0)->ipAddress[1]); + EXPECT_EQ(controller.GetDiscoveredCommissioner(0)->port, 5540); + EXPECT_EQ(controller.GetDiscoveredCommissioner(0)->numIPs, 2u); + + // Example 3 result + ASSERT_NE(controller.GetDiscoveredCommissioner(1), nullptr); + EXPECT_STREQ(inNodeData3.hostName, controller.GetDiscoveredCommissioner(1)->hostName); + EXPECT_EQ(inNodeData3.ipAddress[0], controller.GetDiscoveredCommissioner(1)->ipAddress[0]); + EXPECT_EQ(inNodeData3.ipAddress[1], controller.GetDiscoveredCommissioner(1)->ipAddress[1]); + EXPECT_EQ(controller.GetDiscoveredCommissioner(1)->port, 5540); + EXPECT_EQ(controller.GetDiscoveredCommissioner(1)->numIPs, 2u); + + // Example 4 result + ASSERT_NE(controller.GetDiscoveredCommissioner(2), nullptr); + EXPECT_STREQ(inNodeData4.hostName, controller.GetDiscoveredCommissioner(2)->hostName); + EXPECT_EQ(inNodeData4.ipAddress[0], controller.GetDiscoveredCommissioner(2)->ipAddress[0]); + EXPECT_EQ(inNodeData4.ipAddress[1], controller.GetDiscoveredCommissioner(2)->ipAddress[1]); + EXPECT_EQ(inNodeData4.ipAddress[2], controller.GetDiscoveredCommissioner(2)->ipAddress[2]); + EXPECT_EQ(controller.GetDiscoveredCommissioner(2)->port, 5540); + EXPECT_EQ(controller.GetDiscoveredCommissioner(2)->numIPs, 3u); + + // Total is 3. (Not 4) + ASSERT_EQ(controller.GetDiscoveredCommissioner(3), nullptr); +} + } // namespace From ef280569ad8c60ee1a58acba4a090479cce3bd0b Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Tue, 4 Jun 2024 12:51:33 -0700 Subject: [PATCH 047/162] [chip-tool][ICD] Store ICDClientInfo when running icd registration independently (#33690) * Store ICDClientInfo when running icd registration independently * Restyled by clang-format * address comments --------- Co-authored-by: Restyled.io --- .../commands/clusters/ClusterCommand.h | 39 +++++++++++++++++-- .../commands/clusters/ModelCommand.cpp | 18 ++++++++- .../commands/clusters/ModelCommand.h | 4 +- .../commands/clusters/ModelCommand.cpp | 7 +++- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/examples/chip-tool/commands/clusters/ClusterCommand.h b/examples/chip-tool/commands/clusters/ClusterCommand.h index 171c664481c9dd..fe20f4f36b9f84 100644 --- a/examples/chip-tool/commands/clusters/ClusterCommand.h +++ b/examples/chip-tool/commands/clusters/ClusterCommand.h @@ -18,10 +18,9 @@ #pragma once -#include - #include "DataModelLogger.h" #include "ModelCommand.h" +#include class ClusterCommand : public InteractionModelCommands, public ModelCommand, public chip::app::CommandSender::Callback { @@ -64,6 +63,17 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub return CHIP_NO_ERROR; } + CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, + chip::CommandId commandId, + const chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type & value) + { + ReturnErrorOnFailure(InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value)); + mScopedNodeId = chip::ScopedNodeId(value.checkInNodeID, device->GetSecureSession().Value()->GetFabricIndex()); + mMonitoredSubject = value.monitoredSubject; + memcpy(mICDSymmetricKey, value.key.data(), value.key.size()); + return CHIP_NO_ERROR; + } + CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::CommandId commandId, const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type & value) @@ -117,11 +127,32 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub mError = error; return; } + if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) && + (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClient::Id)) + { + chip::TLV::TLVReader counterTlvReader; + counterTlvReader.Init(*data); + chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value; + CHIP_ERROR err = chip::app::DataModel::Decode(counterTlvReader, value); + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, "Failed to decode ICD counter: %" CHIP_ERROR_FORMAT, err.Format()); + return; + } + + chip::app::ICDClientInfo clientInfo; + clientInfo.peer_node = mScopedNodeId; + clientInfo.monitored_subject = mMonitoredSubject; + clientInfo.start_icd_counter = value.ICDCounter; + + StoreICDEntryWithKey(clientInfo, chip::ByteSpan(mICDSymmetricKey)); + } } + if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) && (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id)) { - ModelCommand::ClearICDEntry(mScopedNodeId); + ClearICDEntry(mScopedNodeId); } } @@ -223,6 +254,8 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub chip::ClusterId mClusterId; chip::CommandId mCommandId; chip::ScopedNodeId mScopedNodeId; + uint64_t mMonitoredSubject = static_cast(0); + uint8_t mICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length]; CHIP_ERROR mError = CHIP_NO_ERROR; CustomArgument mPayload; }; diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index 2a549e62d4668b..b2e3b5616703a4 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -76,7 +76,7 @@ void ModelCommand::Shutdown() CHIPCommand::Shutdown(); } -void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId) +void ModelCommand::ClearICDEntry(const ScopedNodeId & nodeId) { CHIP_ERROR deleteEntryError = CHIPCommand::sICDClientStorage.DeleteEntry(nodeId); if (deleteEntryError != CHIP_NO_ERROR) @@ -85,6 +85,22 @@ void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId) } } +void ModelCommand::StoreICDEntryWithKey(app::ICDClientInfo & clientInfo, ByteSpan key) +{ + CHIP_ERROR err = CHIPCommand::sICDClientStorage.SetKey(clientInfo, key); + if (err == CHIP_NO_ERROR) + { + err = CHIPCommand::sICDClientStorage.StoreEntry(clientInfo); + } + + if (err != CHIP_NO_ERROR) + { + CHIPCommand::sICDClientStorage.RemoveKey(clientInfo); + ChipLogError(chipTool, "Failed to persist symmetric key with error: %" CHIP_ERROR_FORMAT, err.Format()); + return; + } +} + void ModelCommand::CheckPeerICDType() { if (mIsPeerLIT.HasValue()) diff --git a/examples/chip-tool/commands/clusters/ModelCommand.h b/examples/chip-tool/commands/clusters/ModelCommand.h index 79c31cf865930d..635c03a2ebdf7c 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.h +++ b/examples/chip-tool/commands/clusters/ModelCommand.h @@ -67,8 +67,8 @@ class ModelCommand : public CHIPCommand virtual CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) { return CHIP_ERROR_BAD_REQUEST; }; - virtual void ClearICDEntry(const chip::ScopedNodeId & nodeId); - + void ClearICDEntry(const chip::ScopedNodeId & nodeId); + void StoreICDEntryWithKey(chip::app::ICDClientInfo & clientinfo, chip::ByteSpan key); void Shutdown() override; protected: diff --git a/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp b/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp index dafa11f2381fed..e2d01e55d80506 100644 --- a/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp +++ b/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp @@ -82,11 +82,16 @@ void ModelCommand::Shutdown() mOnDeviceConnectionFailureCallback.Cancel(); } -void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId) +void ModelCommand::ClearICDEntry(const ScopedNodeId & nodeId) { ChipLogError(chipTool, "ClearICDEntry is not implemented in tv-casting-app"); } +void ModelCommand::StoreICDEntryWithKey(app::ICDClientInfo & clientinfo, ByteSpan key) +{ + ChipLogError(chipTool, "StoreICDEntryWithKey is not implemented in tv-casting-app"); +} + bool ModelCommand::IsPeerLIT() { // Does not support tv-casting-app From a2dddd128c809ca692a69a79064b95a48bf7f559 Mon Sep 17 00:00:00 2001 From: paulr34 <64710345+paulr34@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:09:48 -0400 Subject: [PATCH 048/162] marking signed types as signed for ZAP to consume (#33719) --- .../zcl/data-model/chip/chip-types.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index cae3f4a87df8c0..77fcb4df6b4fe1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -37,14 +37,14 @@ limitations under the License. - - - - - - - - + + + + + + + + From 3a3b6edba6361014b3bf398f8ea99bb4b33fb930 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 4 Jun 2024 15:45:33 -0700 Subject: [PATCH 049/162] [Fabric-Sync] Add the IPC support between Fabric_Admin and Fabric_Bridge (#33603) * Add the RPC support between Fabric_Admin and Fabric_Bridge * Add bridge_enable_pw_rpc build flag * Address review comments * Add RpcClientProcessor * Update API comments --- examples/common/pigweed/BUILD.gn | 14 ++ .../pigweed/protos/fabric_admin_service.proto | 20 +++ .../protos/fabric_bridge_service.proto | 15 +++ .../common/pigweed/rpc_console/py/BUILD.gn | 2 + .../rpc_console/py/chip_rpc/console.py | 4 + .../common/pigweed/rpc_services/FabricAdmin.h | 44 +++++++ .../pigweed/rpc_services/FabricBridge.h | 44 +++++++ examples/fabric-admin/BUILD.gn | 47 +++++++ .../commands/fabric-sync/Commands.h | 33 +++++ .../fabric-sync/FabricSyncCommand.cpp | 45 +++++++ .../commands/fabric-sync/FabricSyncCommand.h | 40 ++++++ .../interactive/InteractiveCommands.cpp | 41 +++++- examples/fabric-admin/main.cpp | 18 +++ examples/fabric-admin/rpc/RpcClient.cpp | 89 +++++++++++++ examples/fabric-admin/rpc/RpcClient.h | 48 +++++++ examples/fabric-admin/rpc/RpcServer.cpp | 70 ++++++++++ examples/fabric-admin/rpc/RpcServer.h | 23 ++++ examples/fabric-admin/with_pw_rpc.gni | 42 ++++++ examples/fabric-bridge-app/linux/BUILD.gn | 51 +++++++ .../fabric-bridge-app/linux/RpcClient.cpp | 88 +++++++++++++ .../fabric-bridge-app/linux/RpcServer.cpp | 68 ++++++++++ .../linux/include/RpcClient.h | 44 +++++++ .../linux/include/RpcServer.h | 23 ++++ examples/fabric-bridge-app/linux/main.cpp | 41 +++++- .../fabric-bridge-app/linux/with_pw_rpc.gni | 42 ++++++ .../platform/linux/RpcClientProcessor.cpp | 124 ++++++++++++++++++ examples/platform/linux/RpcClientProcessor.h | 36 +++++ 27 files changed, 1149 insertions(+), 7 deletions(-) create mode 100644 examples/common/pigweed/protos/fabric_admin_service.proto create mode 100644 examples/common/pigweed/protos/fabric_bridge_service.proto create mode 100644 examples/common/pigweed/rpc_services/FabricAdmin.h create mode 100644 examples/common/pigweed/rpc_services/FabricBridge.h create mode 100644 examples/fabric-admin/commands/fabric-sync/Commands.h create mode 100644 examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp create mode 100644 examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h create mode 100644 examples/fabric-admin/rpc/RpcClient.cpp create mode 100644 examples/fabric-admin/rpc/RpcClient.h create mode 100644 examples/fabric-admin/rpc/RpcServer.cpp create mode 100644 examples/fabric-admin/rpc/RpcServer.h create mode 100644 examples/fabric-admin/with_pw_rpc.gni create mode 100644 examples/fabric-bridge-app/linux/RpcClient.cpp create mode 100644 examples/fabric-bridge-app/linux/RpcServer.cpp create mode 100644 examples/fabric-bridge-app/linux/include/RpcClient.h create mode 100644 examples/fabric-bridge-app/linux/include/RpcServer.h create mode 100644 examples/fabric-bridge-app/linux/with_pw_rpc.gni create mode 100644 examples/platform/linux/RpcClientProcessor.cpp create mode 100644 examples/platform/linux/RpcClientProcessor.h diff --git a/examples/common/pigweed/BUILD.gn b/examples/common/pigweed/BUILD.gn index c0178e419a1d5d..e523bea380c03f 100644 --- a/examples/common/pigweed/BUILD.gn +++ b/examples/common/pigweed/BUILD.gn @@ -80,6 +80,20 @@ pw_proto_library("button_service") { prefix = "button_service" } +pw_proto_library("fabric_admin_service") { + sources = [ "protos/fabric_admin_service.proto" ] + deps = [ "$dir_pw_protobuf:common_protos" ] + strip_prefix = "protos" + prefix = "fabric_admin_service" +} + +pw_proto_library("fabric_bridge_service") { + sources = [ "protos/fabric_bridge_service.proto" ] + deps = [ "$dir_pw_protobuf:common_protos" ] + strip_prefix = "protos" + prefix = "fabric_bridge_service" +} + pw_proto_library("lighting_service") { sources = [ "protos/lighting_service.proto" ] deps = [ "$dir_pw_protobuf:common_protos" ] diff --git a/examples/common/pigweed/protos/fabric_admin_service.proto b/examples/common/pigweed/protos/fabric_admin_service.proto new file mode 100644 index 00000000000000..e52fd2951ac0d7 --- /dev/null +++ b/examples/common/pigweed/protos/fabric_admin_service.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +import 'pw_protobuf_protos/common.proto'; + +package chip.rpc; + +// Define the message for a synchronized end device with necessary fields +message DeviceInfo { + uint64 node_id = 1; +} + +// Define the response message to convey the status of the operation +message OperationStatus { + bool success = 1; +} + +service FabricAdmin { + rpc OpenCommissioningWindow(DeviceInfo) returns (OperationStatus){} +} + diff --git a/examples/common/pigweed/protos/fabric_bridge_service.proto b/examples/common/pigweed/protos/fabric_bridge_service.proto new file mode 100644 index 00000000000000..5bd4f8efd779e7 --- /dev/null +++ b/examples/common/pigweed/protos/fabric_bridge_service.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +import 'pw_protobuf_protos/common.proto'; + +package chip.rpc; + +// Define the message for a synchronized end device with necessary fields +message SynchronizedDevice { + uint64 node_id = 1; +} + +service FabricBridge { + rpc AddSynchronizedDevice(SynchronizedDevice) returns (pw.protobuf.Empty){} +} + diff --git a/examples/common/pigweed/rpc_console/py/BUILD.gn b/examples/common/pigweed/rpc_console/py/BUILD.gn index a03dc980872739..db9f22fe45fff9 100644 --- a/examples/common/pigweed/rpc_console/py/BUILD.gn +++ b/examples/common/pigweed/rpc_console/py/BUILD.gn @@ -46,6 +46,8 @@ pw_python_package("chip_rpc") { "${chip_root}/examples/common/pigweed:descriptor_service.python", "${chip_root}/examples/common/pigweed:device_service.python", "${chip_root}/examples/common/pigweed:echo_service.python", + "${chip_root}/examples/common/pigweed:fabric_admin_service.python", + "${chip_root}/examples/common/pigweed:fabric_bridge_service.python", "${chip_root}/examples/common/pigweed:lighting_service.python", "${chip_root}/examples/common/pigweed:locking_service.python", "${chip_root}/examples/common/pigweed:ot_cli_service.python", diff --git a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py index 1591722bfdbeab..50f0b030f51725 100644 --- a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py +++ b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py @@ -53,6 +53,8 @@ from descriptor_service import descriptor_service_pb2 from device_service import device_service_pb2 from echo_service import echo_pb2 +from fabric_admin_service import fabric_admin_service_pb2 +from fabric_bridge_service import fabric_bridge_service_pb2 from lighting_service import lighting_service_pb2 from locking_service import locking_service_pb2 from ot_cli_service import ot_cli_service_pb2 @@ -136,6 +138,8 @@ def show_console(device: str, baudrate: int, descriptor_service_pb2, device_service_pb2, echo_pb2, + fabric_admin_service_pb2, + fabric_bridge_service_pb2, lighting_service_pb2, locking_service_pb2, ot_cli_service_pb2, diff --git a/examples/common/pigweed/rpc_services/FabricAdmin.h b/examples/common/pigweed/rpc_services/FabricAdmin.h new file mode 100644 index 00000000000000..5254b9e9054a0c --- /dev/null +++ b/examples/common/pigweed/rpc_services/FabricAdmin.h @@ -0,0 +1,44 @@ +/* + * + * Copyright (c) 2024 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 "app/util/attribute-storage.h" +#include "fabric_admin_service/fabric_admin_service.rpc.pb.h" +#include "pigweed/rpc_services/internal/StatusUtils.h" +#include +#include +#include +#include + +namespace chip { +namespace rpc { + +class FabricAdmin : public pw_rpc::nanopb::FabricAdmin::Service +{ +public: + virtual ~FabricAdmin() = default; + + virtual pw::Status OpenCommissioningWindow(const chip_rpc_DeviceInfo & request, chip_rpc_OperationStatus & response) + { + return pw::Status::Unimplemented(); + } +}; + +} // namespace rpc +} // namespace chip diff --git a/examples/common/pigweed/rpc_services/FabricBridge.h b/examples/common/pigweed/rpc_services/FabricBridge.h new file mode 100644 index 00000000000000..bce32ebd3d99b2 --- /dev/null +++ b/examples/common/pigweed/rpc_services/FabricBridge.h @@ -0,0 +1,44 @@ +/* + * + * Copyright (c) 2024 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 "app/util/attribute-storage.h" +#include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h" +#include "pigweed/rpc_services/internal/StatusUtils.h" +#include +#include +#include +#include + +namespace chip { +namespace rpc { + +class FabricBridge : public pw_rpc::nanopb::FabricBridge::Service +{ +public: + virtual ~FabricBridge() = default; + + virtual pw::Status AddSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) + { + return pw::Status::Unimplemented(); + } +}; + +} // namespace rpc +} // namespace chip diff --git a/examples/fabric-admin/BUILD.gn b/examples/fabric-admin/BUILD.gn index ddaa33483257b1..ad7eb217f9914c 100644 --- a/examples/fabric-admin/BUILD.gn +++ b/examples/fabric-admin/BUILD.gn @@ -22,10 +22,18 @@ import("${chip_root}/src/lib/core/core.gni") assert(chip_build_tools) +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") + +if (chip_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") +} + config("config") { include_dirs = [ ".", "${chip_root}/examples/common", + "${chip_root}/examples/platform/linux", "${chip_root}/zzz_generated/app-common/app-common", "${chip_root}/zzz_generated/chip-tool", "${chip_root}/src/lib", @@ -39,6 +47,10 @@ config("config") { } cflags = [ "-Wconversion" ] + + if (chip_enable_pw_rpc) { + defines += [ "PW_RPC_ENABLED" ] + } } static_library("fabric-admin-utils") { @@ -59,6 +71,7 @@ static_library("fabric-admin-utils") { "commands/common/HexConversion.h", "commands/common/RemoteDataModelLogger.cpp", "commands/common/RemoteDataModelLogger.h", + "commands/fabric-sync/FabricSyncCommand.cpp", "commands/pairing/OpenCommissioningWindowCommand.cpp", "commands/pairing/OpenCommissioningWindowCommand.h", "commands/pairing/PairingCommand.cpp", @@ -95,6 +108,40 @@ static_library("fabric-admin-utils") { public_configs = [ ":config" ] + if (chip_enable_pw_rpc) { + defines = [ + "PW_RPC_FABRIC_ADMIN_SERVICE=1", + "PW_RPC_FABRIC_BRIDGE_SERVICE=1", + ] + + sources += [ + "${chip_root}/examples/platform/linux/RpcClientProcessor.cpp", + "${chip_root}/examples/platform/linux/RpcClientProcessor.h", + "${chip_root}/examples/platform/linux/system_rpc_server.cc", + "rpc/RpcClient.cpp", + "rpc/RpcClient.h", + "rpc/RpcServer.cpp", + "rpc/RpcServer.h", + ] + + deps += [ + "$dir_pw_hdlc:default_addresses", + "$dir_pw_hdlc:rpc_channel_output", + "$dir_pw_log", + "$dir_pw_rpc:server", + "$dir_pw_rpc/system_server:facade", + "$dir_pw_rpc/system_server:socket", + "$dir_pw_stream:socket_stream", + "$dir_pw_sync:mutex", + "${chip_root}/config/linux/lib/pw_rpc:pw_rpc", + "${chip_root}/examples/common/pigweed:fabric_admin_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:fabric_bridge_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:rpc_services", + ] + + deps += pw_build_LINK_DEPS + } + if (chip_enable_transport_trace) { public_deps += [ "${chip_root}/examples/common/tracing:trace_handlers_decoder" ] diff --git a/examples/fabric-admin/commands/fabric-sync/Commands.h b/examples/fabric-admin/commands/fabric-sync/Commands.h new file mode 100644 index 00000000000000..f2be577065b617 --- /dev/null +++ b/examples/fabric-admin/commands/fabric-sync/Commands.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 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 + +void registerCommandsFabricSync(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + const char * clusterName = "FabricSync"; + + commands_list clusterCommands = { + make_unique(credsIssuerConfig), + }; + + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for fabric synchronization."); +} diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp new file mode 100644 index 00000000000000..c2a1b5df8fb80e --- /dev/null +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 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 "FabricSyncCommand.h" +#include +#include +#include + +#if defined(PW_RPC_ENABLED) +#include "pw_assert/check.h" +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" +#include "pw_hdlc/rpc_channel.h" +#include "pw_rpc/client.h" +#include "pw_stream/socket_stream.h" + +#include +#endif + +using namespace ::chip; + +CHIP_ERROR FabricSyncAddDeviceCommand::RunCommand(NodeId remoteId) +{ +#if defined(PW_RPC_ENABLED) + AddSynchronizedDevice(remoteId); + return CHIP_NO_ERROR; +#else + return CHIP_ERROR_NOT_IMPLEMENTED; +#endif +} diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h new file mode 100644 index 00000000000000..cf739ccfb3a520 --- /dev/null +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 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 FabricSyncAddDeviceCommand : public CHIPCommand +{ +public: + FabricSyncAddDeviceCommand(CredentialIssuerCommands * credIssuerCommands) : CHIPCommand("add-device", credIssuerCommands) + { + AddArgument("nodeid", 0, UINT64_MAX, &mNodeId); + } + + /////////// CHIPCommand Interface ///////// + CHIP_ERROR RunCommand() override { return RunCommand(mNodeId); } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(1); } + +private: + chip::NodeId mNodeId; + + CHIP_ERROR RunCommand(NodeId remoteId); +}; diff --git a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp index aaf3c36461cffb..c5c844256f5351 100644 --- a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp +++ b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp @@ -28,11 +28,18 @@ #include #include +#if defined(PW_RPC_ENABLED) +#include +#endif + +using namespace chip; + +namespace { + constexpr char kInteractiveModePrompt[] = ">>> "; constexpr char kInteractiveModeHistoryFileName[] = "chip_tool_history"; constexpr char kInteractiveModeStopCommand[] = "quit()"; - -namespace { +constexpr uint16_t kRetryIntervalS = 5; // File pointer for the log file FILE * sLogFile = nullptr; @@ -67,7 +74,7 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category, return; } - uint64_t timeMs = chip::System::SystemClock().GetMonotonicMilliseconds64().count(); + uint64_t timeMs = System::SystemClock().GetMonotonicMilliseconds64().count(); uint64_t seconds = timeMs / 1000; uint64_t milliseconds = timeMs % 1000; @@ -82,6 +89,26 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category, funlockfile(sLogFile); } +#if defined(PW_RPC_ENABLED) +void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) +{ + if (InitRpcClient(kFabricBridgeServerPort) == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Connected to Fabric-Bridge"); + } + else + { + ChipLogError(NotSpecified, "Failed to connect to Fabric-Bridge, retry in %d seconds....", kRetryIntervalS); + systemLayer->StartTimer(System::Clock::Seconds16(kRetryIntervalS), AttemptRpcClientConnect, nullptr); + } +} + +void ExecuteDeferredConnect(intptr_t ignored) +{ + AttemptRpcClientConnect(&DeviceLayer::SystemLayer(), nullptr); +} +#endif + } // namespace char * InteractiveStartCommand::GetCommand(char * command) @@ -134,9 +161,13 @@ CHIP_ERROR InteractiveStartCommand::RunCommand() OpenLogFile(mLogFilePath.Value()); // Redirect logs to the custom logging callback - chip::Logging::SetLogRedirectCallback(LoggingCallback); + Logging::SetLogRedirectCallback(LoggingCallback); } +#if defined(PW_RPC_ENABLED) + DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredConnect, 0); +#endif + char * command = nullptr; int status; while (true) @@ -167,7 +198,7 @@ bool InteractiveCommand::ParseCommand(char * command, int * status) // If scheduling the cleanup fails, there is not much we can do. // But if something went wrong while the application is leaving it could be because things have // not been cleaned up properly, so it is still useful to log the failure. - LogErrorOnFailure(chip::DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredCleanups, 0)); + LogErrorOnFailure(DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredCleanups, 0)); return false; } diff --git a/examples/fabric-admin/main.cpp b/examples/fabric-admin/main.cpp index a1002d83170d5b..f5f98cc0d960db 100644 --- a/examples/fabric-admin/main.cpp +++ b/examples/fabric-admin/main.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -26,6 +27,20 @@ #include #include +#if defined(PW_RPC_ENABLED) +#include +#endif + +using namespace chip; + +void ApplicationInit() +{ +#if defined(PW_RPC_ENABLED) + InitRpcServer(kFabricAdminServerPort); + ChipLogProgress(NotSpecified, "PW_RPC initialized."); +#endif +} + // ================================================================================ // Main Code // ================================================================================ @@ -45,6 +60,7 @@ int main(int argc, char * argv[]) ExampleCredentialIssuerCommands credIssuerCommands; Commands commands; + registerCommandsFabricSync(commands, &credIssuerCommands); registerCommandsInteractive(commands, &credIssuerCommands); registerCommandsPairing(commands, &credIssuerCommands); registerClusters(commands, &credIssuerCommands); @@ -56,5 +72,7 @@ int main(int argc, char * argv[]) c_args.push_back(const_cast(arg.c_str())); } + ApplicationInit(); + return commands.Run(static_cast(c_args.size()), c_args.data()); } diff --git a/examples/fabric-admin/rpc/RpcClient.cpp b/examples/fabric-admin/rpc/RpcClient.cpp new file mode 100644 index 00000000000000..a1a34d309ba17a --- /dev/null +++ b/examples/fabric-admin/rpc/RpcClient.cpp @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2024 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 "RpcClient.h" +#include "RpcClientProcessor.h" + +#include +#include +#include + +#include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h" +#include "pw_assert/check.h" +#include "pw_function/function.h" +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" +#include "pw_hdlc/rpc_channel.h" +#include "pw_rpc/client.h" +#include "pw_stream/socket_stream.h" + +using namespace chip; + +namespace { + +// Constants +constexpr uint32_t kDefaultChannelId = 1; + +// Fabric Bridge Client +rpc::pw_rpc::nanopb::FabricBridge::Client fabricBridgeClient(rpc::client::GetDefaultRpcClient(), kDefaultChannelId); +pw::rpc::NanopbUnaryReceiver<::pw_protobuf_Empty> addSynchronizedDeviceCall; + +// Callback function to be called when the RPC response is received +void OnAddDeviceResponseCompleted(const pw_protobuf_Empty & response, pw::Status status) +{ + if (status.ok()) + { + ChipLogProgress(NotSpecified, "AddSynchronizedDevice RPC call succeeded!"); + } + else + { + ChipLogProgress(NotSpecified, "AddSynchronizedDevice RPC call failed with status: %d\n", status.code()); + } +} + +} // namespace + +CHIP_ERROR InitRpcClient(uint16_t rpcServerPort) +{ + rpc::client::SetRpcServerPort(rpcServerPort); + return rpc::client::StartPacketProcessing(); +} + +CHIP_ERROR AddSynchronizedDevice(chip::NodeId nodeId) +{ + ChipLogProgress(NotSpecified, "AddSynchronizedDevice"); + + if (addSynchronizedDeviceCall.active()) + { + ChipLogError(NotSpecified, "OpenCommissioningWindow is in progress\n"); + return CHIP_ERROR_BUSY; + } + + chip_rpc_SynchronizedDevice device; + device.node_id = nodeId; + + // The RPC will remain active as long as `addSynchronizedDeviceCall` is alive. + addSynchronizedDeviceCall = fabricBridgeClient.AddSynchronizedDevice(device, OnAddDeviceResponseCompleted); + + if (!addSynchronizedDeviceCall.active()) + { + return CHIP_ERROR_INTERNAL; + } + + return CHIP_NO_ERROR; +} diff --git a/examples/fabric-admin/rpc/RpcClient.h b/examples/fabric-admin/rpc/RpcClient.h new file mode 100644 index 00000000000000..efe3c24acc3b23 --- /dev/null +++ b/examples/fabric-admin/rpc/RpcClient.h @@ -0,0 +1,48 @@ +/* + * + * Copyright (c) 2024 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 + +constexpr uint16_t kFabricBridgeServerPort = 33002; + +/** + * @brief Initializes the RPC client with the specified server port. + * + * This function sets the RPC server port and starts packet processing for the RPC client. + * + * @param rpcServerPort The port number on which the RPC server is running. + * @return CHIP_NO_ERROR on successful initialization, or an appropriate CHIP_ERROR on failure. + */ +CHIP_ERROR InitRpcClient(uint16_t rpcServerPort); + +/** + * @brief Adds a synchronized device to the RPC client. + * + * This function attempts to add a device identified by its `nodeId` to the synchronized device list. + * It logs the progress and checks if an `OpenCommissioningWindow` operation is already in progress. + * If an operation is in progress, it returns `CHIP_ERROR_BUSY`. + * + * @param nodeId The Node ID of the device to be added. + * @return CHIP_ERROR An error code indicating the success or failure of the operation. + * - CHIP_NO_ERROR: The RPC command was successfully sent. + * - CHIP_ERROR_BUSY: Another operation is currently in progress. + * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call. + */ +CHIP_ERROR AddSynchronizedDevice(chip::NodeId nodeId); diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp new file mode 100644 index 00000000000000..b3cbdcea05409a --- /dev/null +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -0,0 +1,70 @@ +/* + * + * Copyright (c) 2024 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 "pw_rpc/server.h" +#include "pw_rpc_system_server/rpc_server.h" +#include "pw_rpc_system_server/socket.h" + +#include +#include + +#if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE +#include "pigweed/rpc_services/FabricAdmin.h" +#endif + +namespace { + +#if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE +class FabricAdmin final : public chip::rpc::FabricAdmin +{ +public: + pw::Status OpenCommissioningWindow(const chip_rpc_DeviceInfo & request, chip_rpc_OperationStatus & response) override + { + chip::NodeId nodeId = request.node_id; + ChipLogProgress(NotSpecified, "Received OpenCommissioningWindow request: 0x%lx", nodeId); + response.success = false; + + return pw::OkStatus(); + } +}; + +FabricAdmin fabric_admin_service; +#endif // defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE + +void RegisterServices(pw::rpc::Server & server) +{ +#if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE + server.RegisterService(fabric_admin_service); +#endif +} + +} // namespace + +void RunRpcService() +{ + pw::rpc::system_server::Init(); + RegisterServices(pw::rpc::system_server::Server()); + pw::rpc::system_server::Start(); +} + +void InitRpcServer(uint16_t rpcServerPort) +{ + pw::rpc::system_server::set_socket_port(rpcServerPort); + std::thread rpc_service(RunRpcService); + rpc_service.detach(); +} diff --git a/examples/fabric-admin/rpc/RpcServer.h b/examples/fabric-admin/rpc/RpcServer.h new file mode 100644 index 00000000000000..bc03bc0ac4abd3 --- /dev/null +++ b/examples/fabric-admin/rpc/RpcServer.h @@ -0,0 +1,23 @@ +/* + * + * Copyright (c) 2024 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 + +constexpr uint16_t kFabricAdminServerPort = 33001; + +void InitRpcServer(uint16_t rpcServerPort); diff --git a/examples/fabric-admin/with_pw_rpc.gni b/examples/fabric-admin/with_pw_rpc.gni new file mode 100644 index 00000000000000..abb9ac65f27e78 --- /dev/null +++ b/examples/fabric-admin/with_pw_rpc.gni @@ -0,0 +1,42 @@ +# Copyright (c) 2024 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +import("//build_overrides/pigweed.gni") + +pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" +pw_trace_BACKEND = "$dir_pw_trace_tokenized" +pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" +pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" +dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" +pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock" +pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend" +pw_thread_YIELD_BACKEND = "$dir_pw_thread_stl:yield" +pw_thread_SLEEP_BACKEND = "$dir_pw_thread_stl:sleep" + +pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", +] + +chip_enable_pw_rpc = true +chip_use_pw_logging = true diff --git a/examples/fabric-bridge-app/linux/BUILD.gn b/examples/fabric-bridge-app/linux/BUILD.gn index ea7e6e0b31b331..3e82f044c047f9 100644 --- a/examples/fabric-bridge-app/linux/BUILD.gn +++ b/examples/fabric-bridge-app/linux/BUILD.gn @@ -16,8 +16,20 @@ import("//build_overrides/chip.gni") import("${chip_root}/build/chip/tools.gni") +import("//with_pw_rpc.gni") + assert(chip_build_tools) +declare_args() { + bridge_enable_pw_rpc = false +} + +if (bridge_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") + import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") +} + executable("fabric-bridge-app") { sources = [ "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h", @@ -38,6 +50,45 @@ executable("fabric-bridge-app") { include_dirs = [ "include" ] + if (bridge_enable_pw_rpc) { + defines = [ + "PW_RPC_FABRIC_ADMIN_SERVICE=1", + "PW_RPC_FABRIC_BRIDGE_SERVICE=1", + ] + + sources += [ + "${chip_root}/examples/platform/linux/RpcClientProcessor.cpp", + "${chip_root}/examples/platform/linux/RpcClientProcessor.h", + "${chip_root}/examples/platform/linux/system_rpc_server.cc", + "RpcClient.cpp", + "RpcServer.cpp", + "include/RpcClient.h", + "include/RpcServer.h", + ] + + deps += [ + "$dir_pw_hdlc:default_addresses", + "$dir_pw_hdlc:rpc_channel_output", + "$dir_pw_log", + "$dir_pw_rpc:server", + "$dir_pw_rpc/system_server:facade", + "$dir_pw_rpc/system_server:socket", + "$dir_pw_stream:socket_stream", + "$dir_pw_sync:mutex", + "${chip_root}/config/linux/lib/pw_rpc:pw_rpc", + "${chip_root}/examples/common/pigweed:fabric_admin_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:fabric_bridge_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:rpc_services", + ] + + deps += pw_build_LINK_DEPS + + include_dirs += [ + "${chip_root}/examples/common", + "${chip_root}/examples/platform/linux", + ] + } + output_dir = root_out_dir } diff --git a/examples/fabric-bridge-app/linux/RpcClient.cpp b/examples/fabric-bridge-app/linux/RpcClient.cpp new file mode 100644 index 00000000000000..c09a447cff28c9 --- /dev/null +++ b/examples/fabric-bridge-app/linux/RpcClient.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2024 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 "RpcClient.h" +#include "RpcClientProcessor.h" + +#include +#include +#include + +#include "fabric_admin_service/fabric_admin_service.rpc.pb.h" +#include "pw_assert/check.h" +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" +#include "pw_hdlc/rpc_channel.h" +#include "pw_rpc/client.h" +#include "pw_stream/socket_stream.h" + +using namespace chip; + +namespace { + +// Constants +constexpr uint32_t kDefaultChannelId = 1; + +// Fabric Admin Client +rpc::pw_rpc::nanopb::FabricAdmin::Client fabricAdminClient(rpc::client::GetDefaultRpcClient(), kDefaultChannelId); +pw::rpc::NanopbUnaryReceiver<::chip_rpc_OperationStatus> openCommissioningWindowCall; + +// Callback function to be called when the RPC response is received +void OnOpenCommissioningWindowCompleted(const chip_rpc_OperationStatus & response, pw::Status status) +{ + if (status.ok()) + { + ChipLogProgress(NotSpecified, "OpenCommissioningWindow received operation status: %d", response.success); + } + else + { + ChipLogProgress(NotSpecified, "OpenCommissioningWindow RPC call failed with status: %d\n", status.code()); + } +} + +} // namespace + +CHIP_ERROR InitRpcClient(uint16_t rpcServerPort) +{ + rpc::client::SetRpcServerPort(rpcServerPort); + return rpc::client::StartPacketProcessing(); +} + +CHIP_ERROR OpenCommissioningWindow(NodeId nodeId) +{ + ChipLogProgress(NotSpecified, "OpenCommissioningWindow\n"); + + if (openCommissioningWindowCall.active()) + { + ChipLogError(NotSpecified, "OpenCommissioningWindow is in progress\n"); + return CHIP_ERROR_BUSY; + } + + chip_rpc_DeviceInfo device; + device.node_id = nodeId; + + // The RPC will remain active as long as `openCommissioningWindowCall` is alive. + openCommissioningWindowCall = fabricAdminClient.OpenCommissioningWindow(device, OnOpenCommissioningWindowCompleted); + + if (!openCommissioningWindowCall.active()) + { + return CHIP_ERROR_INTERNAL; + } + + return CHIP_NO_ERROR; +} diff --git a/examples/fabric-bridge-app/linux/RpcServer.cpp b/examples/fabric-bridge-app/linux/RpcServer.cpp new file mode 100644 index 00000000000000..c971811b193016 --- /dev/null +++ b/examples/fabric-bridge-app/linux/RpcServer.cpp @@ -0,0 +1,68 @@ +/* + * + * Copyright (c) 2024 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 "pw_rpc/server.h" +#include "pw_rpc_system_server/rpc_server.h" +#include "pw_rpc_system_server/socket.h" + +#include +#include + +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +#include "pigweed/rpc_services/FabricBridge.h" +#endif + +namespace { + +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +class FabricBridge final : public chip::rpc::FabricBridge +{ +public: + pw::Status AddSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) override + { + chip::NodeId nodeId = request.node_id; + ChipLogProgress(NotSpecified, "Received AddSynchronizedDevice: " ChipLogFormatX64, ChipLogValueX64(nodeId)); + return pw::OkStatus(); + } +}; + +FabricBridge fabric_bridge_service; +#endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + +void RegisterServices(pw::rpc::Server & server) +{ +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + server.RegisterService(fabric_bridge_service); +#endif +} + +} // namespace + +void RunRpcService() +{ + pw::rpc::system_server::Init(); + RegisterServices(pw::rpc::system_server::Server()); + pw::rpc::system_server::Start(); +} + +void InitRpcServer(uint16_t rpcServerPort) +{ + pw::rpc::system_server::set_socket_port(rpcServerPort); + std::thread rpc_service(RunRpcService); + rpc_service.detach(); +} diff --git a/examples/fabric-bridge-app/linux/include/RpcClient.h b/examples/fabric-bridge-app/linux/include/RpcClient.h new file mode 100644 index 00000000000000..bd424e9d275910 --- /dev/null +++ b/examples/fabric-bridge-app/linux/include/RpcClient.h @@ -0,0 +1,44 @@ +/* + * + * Copyright (c) 2024 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 + +constexpr uint16_t kFabricAdminServerPort = 33001; + +/** + * Initializes the RPC client by setting the server port and starting packet processing. + * + * @param rpcServerPort The port number of the RPC server. + * @return CHIP_ERROR An error code indicating the success or failure of the initialization process. + * - CHIP_NO_ERROR: Initialization was successful. + * - Other error codes indicating specific failure reasons. + */ +CHIP_ERROR InitRpcClient(uint16_t rpcServerPort); + +/** + * Opens a commissioning window for a specified node. + * + * @param nodeId The identifier of the node for which the commissioning window should be opened. + * @return CHIP_ERROR An error code indicating the success or failure of the operation. + * - CHIP_NO_ERROR: The RPC command was successfully sent. + * - CHIP_ERROR_BUSY: Another commissioning window is currently in progress. + * - CHIP_ERROR_INTERNAL: An internal error occurred. + */ +CHIP_ERROR OpenCommissioningWindow(chip::NodeId nodeId); diff --git a/examples/fabric-bridge-app/linux/include/RpcServer.h b/examples/fabric-bridge-app/linux/include/RpcServer.h new file mode 100644 index 00000000000000..f86858b19bdfe3 --- /dev/null +++ b/examples/fabric-bridge-app/linux/include/RpcServer.h @@ -0,0 +1,23 @@ +/* + * + * Copyright (c) 2024 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 + +constexpr uint16_t kFabricBridgeServerPort = 33002; + +void InitRpcServer(uint16_t rpcServerPort); diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index 600d4a2a376d55..47670561430c90 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -25,19 +25,26 @@ #include #include +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +#include "RpcClient.h" +#include "RpcServer.h" +#endif + #include #include #include using namespace chip; -#define POLL_INTERVAL_MS (100) #define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u) #define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u) #define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u) namespace { +constexpr uint16_t kPollIntervalMs = 100; +constexpr uint16_t kRetryIntervalS = 3; + bool KeyboardHit() { int bytesWaiting; @@ -57,13 +64,38 @@ void BridgePollingThread() ChipLogProgress(NotSpecified, "Exiting....."); exit(0); } +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + else if (ch == 'o') + { + CHIP_ERROR err = OpenCommissioningWindow(0x1234); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to call OpenCommissioningWindow RPC: %" CHIP_ERROR_FORMAT, err.Format()); + } + } +#endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE continue; } // Sleep to avoid tight loop reading commands - usleep(POLL_INTERVAL_MS * 1000); + usleep(kPollIntervalMs * 1000); + } +} + +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) +{ + if (InitRpcClient(kFabricAdminServerPort) == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Connected to Fabric-Admin"); + } + else + { + ChipLogError(NotSpecified, "Failed to connect to Fabric-Admin, retry in %d seconds....", kRetryIntervalS); + systemLayer->StartTimer(System::Clock::Seconds16(kRetryIntervalS), AttemptRpcClientConnect, nullptr); } } +#endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE DeviceManager gDeviceManager; @@ -71,6 +103,11 @@ DeviceManager gDeviceManager; void ApplicationInit() { +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + InitRpcServer(kFabricBridgeServerPort); + AttemptRpcClientConnect(&DeviceLayer::SystemLayer(), nullptr); +#endif + // Start a thread for bridge polling std::thread pollingThread(BridgePollingThread); pollingThread.detach(); diff --git a/examples/fabric-bridge-app/linux/with_pw_rpc.gni b/examples/fabric-bridge-app/linux/with_pw_rpc.gni new file mode 100644 index 00000000000000..e1bd567cf22db2 --- /dev/null +++ b/examples/fabric-bridge-app/linux/with_pw_rpc.gni @@ -0,0 +1,42 @@ +# Copyright (c) 2024 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +import("//build_overrides/pigweed.gni") + +pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" +pw_trace_BACKEND = "$dir_pw_trace_tokenized" +pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" +pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" +dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" +pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock" +pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend" +pw_thread_YIELD_BACKEND = "$dir_pw_thread_stl:yield" +pw_thread_SLEEP_BACKEND = "$dir_pw_thread_stl:sleep" + +pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", +] + +chip_use_pw_logging = true +bridge_enable_pw_rpc = true diff --git a/examples/platform/linux/RpcClientProcessor.cpp b/examples/platform/linux/RpcClientProcessor.cpp new file mode 100644 index 00000000000000..a2cbe5694f531d --- /dev/null +++ b/examples/platform/linux/RpcClientProcessor.cpp @@ -0,0 +1,124 @@ +/* + * + * Copyright (c) 2024 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 "RpcClientProcessor.h" + +#include +#include + +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" +#include "pw_hdlc/rpc_channel.h" +#include "pw_stream/socket_stream.h" + +namespace chip { +namespace rpc { +namespace client { +namespace { + +// Constants +constexpr size_t kMaxTransmissionUnit = 256; +constexpr uint32_t kDefaultChannelId = 1; +const char * kDefaultRpcServerAddress = "127.0.0.1"; + +// RPC Stream and Channel Setup +pw::stream::SocketStream rpcSocketStream; +pw::hdlc::RpcChannelOutput hdlcChannelOutput(rpcSocketStream, pw::hdlc::kDefaultRpcAddress, "HDLC channel"); +pw::rpc::Channel channels[] = { pw::rpc::Channel::Create<1>(&hdlcChannelOutput) }; +pw::rpc::Client rpcClient(channels); + +// RPC Stream and Channel Setup +uint16_t rpcServerPort = 0; +const char * rpcServerAddress = kDefaultRpcServerAddress; + +// Function to process incoming packets +void ProcessPackets() +{ + std::array inputBuf; + pw::hdlc::Decoder decoder(inputBuf); + + while (true) + { + std::array data; + auto ret = rpcSocketStream.Read(data); + if (!ret.ok()) + { + if (ret.status() == pw::Status::OutOfRange()) + { + // Handle remote disconnect + rpcSocketStream.Close(); + return; + } + continue; + } + + for (std::byte byte : ret.value()) + { + auto result = decoder.Process(byte); + if (!result.ok()) + { + // Wait for more bytes that form a complete packet + continue; + } + pw::hdlc::Frame & frame = result.value(); + if (frame.address() != pw::hdlc::kDefaultRpcAddress) + { + // Wrong address; ignore the packet + continue; + } + + rpcClient.ProcessPacket(frame.data()).IgnoreError(); + } + } +} + +} // namespace + +void SetRpcServerAddress(const char * address) +{ + rpcServerAddress = address; +} + +void SetRpcServerPort(uint16_t port) +{ + rpcServerPort = port; +} + +pw::rpc::Client & GetDefaultRpcClient() +{ + return rpcClient; +} + +CHIP_ERROR StartPacketProcessing() +{ + if (rpcSocketStream.Connect(rpcServerAddress, rpcServerPort) != PW_STATUS_OK) + { + // Handle connection error + return CHIP_ERROR_NOT_CONNECTED; + } + + // Start a thread to process incoming packets + std::thread packet_processor(ProcessPackets); + packet_processor.detach(); + + return CHIP_NO_ERROR; +} + +} // namespace client +} // namespace rpc +} // namespace chip diff --git a/examples/platform/linux/RpcClientProcessor.h b/examples/platform/linux/RpcClientProcessor.h new file mode 100644 index 00000000000000..f2305df7aa046c --- /dev/null +++ b/examples/platform/linux/RpcClientProcessor.h @@ -0,0 +1,36 @@ +/* + * + * Copyright (c) 2024 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 "pw_rpc/client.h" +#include +#include + +namespace chip { +namespace rpc { +namespace client { + +void SetRpcServerAddress(const char * address); +void SetRpcServerPort(uint16_t port); +pw::rpc::Client & GetDefaultRpcClient(); +CHIP_ERROR StartPacketProcessing(); + +} // namespace client +} // namespace rpc +} // namespace chip From 994a98d5f8568b68b29ccd0e8bfedc54fcee70d2 Mon Sep 17 00:00:00 2001 From: Kiel Oleson Date: Tue, 4 Jun 2024 16:12:06 -0700 Subject: [PATCH 050/162] Darwin: add helpers for essential attributes for logging; log unexpected C-quality attributes (#33560) * add metric keys for additional metrics * add metric collection for unexpected C Quality attribute update * unwind premature optimization placeholders/comments * rename to indicate the attributes are for logging / informational use * simplify - pull attributes from cache without intermediate object, should be fast enough * revert accidental whitespace change * Restyled by whitespace * Restyled by clang-format * make `nil` case possibility more obvious --------- Co-authored-by: Restyled.io --- src/darwin/Framework/CHIP/MTRDevice.mm | 55 ++++++++++++++++++++++- src/darwin/Framework/CHIP/MTRMetricKeys.h | 6 +++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 4014bd5f6924bf..dcb6a9acd8da64 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -35,6 +35,8 @@ #import "MTRError_Internal.h" #import "MTREventTLVValueDecoder_Internal.h" #import "MTRLogging_Internal.h" +#import "MTRMetricKeys.h" +#import "MTRMetricsCollector.h" #import "MTRTimeUtils.h" #import "MTRUnfairLock.h" #import "zap-generated/MTRCommandPayloads_Internal.h" @@ -1886,9 +1888,16 @@ - (void)_setCachedAttributeValue:(MTRDeviceDataValueDictionary _Nullable)value f && isFromSubscription && !_receivingPrimingReport && AttributeHasChangesOmittedQuality(path)) { - // Do not persist new values for Changes Omitted Quality attributes unless - // they're part of a Priming Report or from a read response. + // Do not persist new values for Changes Omitted Quality (aka C Quality) + // attributes unless they're part of a Priming Report or from a read response. // (removals are OK) + + // log when a device violates expectations for Changes Omitted Quality attributes. + using namespace chip::Tracing::DarwinFramework; + MATTER_LOG_METRIC_BEGIN(kMetricUnexpectedCQualityUpdate); + [self _addInformationalAttributesToCurrentMetricScope]; + MATTER_LOG_METRIC_END(kMetricUnexpectedCQualityUpdate); + return; } @@ -3642,6 +3651,48 @@ - (void)removeClientDataForKey:(NSString *)key endpointID:(NSNumber *)endpointID [self.temporaryMetaDataCache removeObjectForKey:[NSString stringWithFormat:@"%@:%@", key, endpointID]]; } +#pragma mark Log Help + +- (nullable NSNumber *)_informationalNumberAtAttributePath:(MTRAttributePath *)attributePath +{ + auto * cachedData = [self _cachedAttributeValueForPath:attributePath]; + + auto * attrReport = [[MTRAttributeReport alloc] initWithResponseValue:@{ + MTRAttributePathKey : attributePath, + MTRDataKey : cachedData, + } + error:nil]; + + return attrReport.value; +} + +- (nullable NSNumber *)_informationalVendorID +{ + auto * vendorIDPath = [MTRAttributePath attributePathWithEndpointID:@(kRootEndpointId) + clusterID:@(MTRClusterIDTypeBasicInformationID) + attributeID:@(MTRClusterBasicAttributeVendorIDID)]; + + return [self _informationalNumberAtAttributePath:vendorIDPath]; +} + +- (nullable NSNumber *)_informationalProductID +{ + auto * productIDPath = [MTRAttributePath attributePathWithEndpointID:@(kRootEndpointId) + clusterID:@(MTRClusterIDTypeBasicInformationID) + attributeID:@(MTRClusterBasicAttributeProductIDID)]; + + return [self _informationalNumberAtAttributePath:productIDPath]; +} + +- (void)_addInformationalAttributesToCurrentMetricScope +{ + using namespace chip::Tracing::DarwinFramework; + MATTER_LOG_METRIC(kMetricDeviceVendorID, [self _informationalVendorID].unsignedShortValue); + MATTER_LOG_METRIC(kMetricDeviceProductID, [self _informationalProductID].unsignedShortValue); + BOOL usesThread = [self _deviceUsesThread]; + MATTER_LOG_METRIC(kMetricDeviceUsesThread, usesThread); +} + @end /* BEGIN DRAGONS: Note methods here cannot be renamed, and are used by private callers, do not rename, remove or modify behavior here */ diff --git a/src/darwin/Framework/CHIP/MTRMetricKeys.h b/src/darwin/Framework/CHIP/MTRMetricKeys.h index 5ea03da70d9752..536da36b582053 100644 --- a/src/darwin/Framework/CHIP/MTRMetricKeys.h +++ b/src/darwin/Framework/CHIP/MTRMetricKeys.h @@ -69,6 +69,9 @@ constexpr Tracing::MetricKey kMetricDeviceVendorID = "dwnfw_device_vendor_id"; // Device Product ID constexpr Tracing::MetricKey kMetricDeviceProductID = "dwnfw_device_product_id"; +// Device Uses Thread +constexpr Tracing::MetricKey kMetricDeviceUsesThread = "dwnfw_device_uses_thread_bool"; + // Counter of number of devices discovered on the network during setup constexpr Tracing::MetricKey kMetricOnNetworkDevicesAdded = "dwnfw_onnet_devices_added"; @@ -81,6 +84,9 @@ constexpr Tracing::MetricKey kMetricBLEDevicesAdded = "dwnfw_ble_devices_added"; // Counter of number of BLE devices removed during setup constexpr Tracing::MetricKey kMetricBLEDevicesRemoved = "dwnfw_ble_devices_removed"; +// Unexpected C quality attribute update outside of priming +constexpr Tracing::MetricKey kMetricUnexpectedCQualityUpdate = "dwnpm_bad_c_attr_update"; + } // namespace DarwinFramework } // namespace Tracing } // namespace chip From ca33a408fb42f6199be57aee423eacaea464de37 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 4 Jun 2024 23:26:51 -0400 Subject: [PATCH 051/162] Increase the poll rate for BDX diagnostic log downloads. (#33741) The default rate used by bdx::Responder is once every 500ms, which means you maybe manage to get 1kB/s of log through the network. We should allow this process to go faster. Switch to once every 50ms, to match all the other BDX transfers we have around that poll like this. --- src/protocols/bdx/BdxTransferDiagnosticLog.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/protocols/bdx/BdxTransferDiagnosticLog.cpp b/src/protocols/bdx/BdxTransferDiagnosticLog.cpp index 8b349fed31e8f5..51e56fba9ac254 100644 --- a/src/protocols/bdx/BdxTransferDiagnosticLog.cpp +++ b/src/protocols/bdx/BdxTransferDiagnosticLog.cpp @@ -25,6 +25,12 @@ namespace { // Max block size for the BDX transfer. constexpr uint32_t kMaxBdxBlockSize = 1024; +// How often we poll our transfer session. Sadly, we get allocated on +// unsolicited message, which makes it hard for our clients to configure this. +// But the default poll interval is 500ms, which makes log downloads extremely +// slow. +constexpr System::Clock::Timeout kBdxPollInterval = System::Clock::Milliseconds32(50); + // Timeout for the BDX transfer session.. constexpr System::Clock::Timeout kBdxTimeout = System::Clock::Seconds16(5 * 60); constexpr TransferRole kBdxRole = TransferRole::kReceiver; @@ -95,7 +101,8 @@ CHIP_ERROR BdxTransferDiagnosticLog::OnMessageReceived(Messaging::ExchangeContex mTransferProxy.SetFabricIndex(fabricIndex); mTransferProxy.SetPeerNodeId(peerNodeId); auto flags(TransferControlFlags::kSenderDrive); - ReturnLogErrorOnFailure(Responder::PrepareForTransfer(mSystemLayer, kBdxRole, flags, kMaxBdxBlockSize, kBdxTimeout)); + ReturnLogErrorOnFailure( + Responder::PrepareForTransfer(mSystemLayer, kBdxRole, flags, kMaxBdxBlockSize, kBdxTimeout, kBdxPollInterval)); } return TransferFacilitator::OnMessageReceived(ec, payloadHeader, std::move(payload)); From 24bbdf431afcec27a90f793e1c99eb65e9cadea8 Mon Sep 17 00:00:00 2001 From: cdj <45139296+DejinChen@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:29:08 +0800 Subject: [PATCH 052/162] Added secondary network interface device type (#33682) --- .../all-clusters-app.matter | 2 +- .../all-clusters-common/all-clusters-app.zap | 20 +++++++++---------- .../all-clusters-minimal-app.matter | 2 +- .../all-clusters-minimal-app.zap | 20 +++++++++---------- .../ota-requestor-app.matter | 2 +- .../ota-requestor-app.zap | 20 +++++++++---------- .../zap/tests/inputs/all-clusters-app.zap | 20 +++++++++---------- .../app-templates/endpoint_config.h | 2 +- .../zcl/data-model/chip/matter-devices.xml | 11 +++++++--- .../zap-generated/MTRDeviceTypeMetadata.mm | 2 +- 10 files changed, 53 insertions(+), 48 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 804d1eae5fbd32..8c5f9766970adc 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 @@ -9211,7 +9211,7 @@ endpoint 2 { } } endpoint 65534 { - device type ma_secondary_network_commissioning = 4293984258, version 1; + device type ma_secondary_network_interface = 25, version 1; server cluster Descriptor { 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 683f2dd75658ba..14c5f68d26e89c 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 @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -24779,27 +24779,27 @@ "id": 4, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" }, "deviceTypes": [ { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" } ], "deviceVersions": [ 1 ], "deviceIdentifiers": [ - 4293984258 + 25 ], - "deviceTypeName": "MA-secondary-network-commissioning", - "deviceTypeCode": 4293984258, + "deviceTypeName": "MA-secondary-network-interface", + "deviceTypeCode": 25, "deviceTypeProfileId": 259, "clusters": [ { diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 0c9569504c7846..58e57000bae2eb 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -6920,7 +6920,7 @@ endpoint 2 { } } endpoint 65534 { - device type ma_secondary_network_commissioning = 4293984258, version 1; + device type ma_secondary_network_interface = 25, version 1; server cluster Descriptor { diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index 3294f430a3e337..a4d3b3858ef160 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -11837,27 +11837,27 @@ "id": 4, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" }, "deviceTypes": [ { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" } ], "deviceVersions": [ 1 ], "deviceIdentifiers": [ - 4293984258 + 25 ], - "deviceTypeName": "MA-secondary-network-commissioning", - "deviceTypeCode": 4293984258, + "deviceTypeName": "MA-secondary-network-interface", + "deviceTypeCode": 25, "deviceTypeProfileId": 259, "clusters": [ { diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index da7faa284f9927..3e49c28226637a 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -1560,7 +1560,7 @@ endpoint 1 { } } endpoint 65534 { - device type ma_secondary_network_commissioning = 4293984258, version 1; + device type ma_secondary_network_interface = 25, version 1; server cluster Descriptor { diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap index 686335a5b3c3b7..e4133c02918306 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -2946,27 +2946,27 @@ "id": 3, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" }, "deviceTypes": [ { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" } ], "deviceVersions": [ 1 ], "deviceIdentifiers": [ - 4293984258 + 25 ], - "deviceTypeName": "MA-secondary-network-commissioning", - "deviceTypeCode": 4293984258, + "deviceTypeName": "MA-secondary-network-interface", + "deviceTypeCode": 25, "deviceTypeProfileId": 259, "clusters": [ { diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index 04f2c793285f9f..784c8dfddb7664 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -16043,27 +16043,27 @@ "id": 4, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" }, "deviceTypes": [ { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" } ], "deviceVersions": [ 1 ], "deviceIdentifiers": [ - 4293984258 + 25 ], - "deviceTypeName": "MA-secondary-network-commissioning", - "deviceTypeCode": 4293984258, + "deviceTypeName": "MA-secondary-network-interface", + "deviceTypeCode": 25, "deviceTypeProfileId": 259, "clusters": [ { diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index ca2e15eedf5683..55da8ec3f3f136 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -3047,7 +3047,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, { \ { 0x00000011, 1 }, { 0x00000016, 1 }, { 0x00000100, 1 }, { 0x00000011, 1 }, { 0x00000100, 1 }, { 0x00000011, 1 }, \ { \ - 0xFFF10002, 1 \ + 0x00000019, 1 \ } \ } diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 83a462c4a64a4a..2aad342ea71311 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -2590,11 +2590,13 @@ limitations under the License. - MA-secondary-network-commissioning + MA-secondary-network-interface CHIP - Matter Secondary Network Commissioning Device Type + Matter Secondary Network Interface Device Type 0x0103 - 0xFFF10002 + 0x0019 + Utility + Endpoint @@ -2603,6 +2605,9 @@ limitations under the License. CLIENT_LIST PARTS_LIST + + + diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm index 06042f32f9f1d8..1dcb80d7fd1e99 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm @@ -44,6 +44,7 @@ { 0x00000014, DeviceTypeClass::Utility, "Matter OTA Provider" }, { 0x00000015, DeviceTypeClass::Simple, "Matter Contact Sensor" }, { 0x00000016, DeviceTypeClass::Node, "Matter Root Node" }, + { 0x00000019, DeviceTypeClass::Utility, "Matter Secondary Network Interface Device Type" }, { 0x00000022, DeviceTypeClass::Simple, "Matter Speaker" }, { 0x00000023, DeviceTypeClass::Simple, "Matter Casting Video Player" }, { 0x00000024, DeviceTypeClass::Simple, "Matter Content App" }, @@ -100,7 +101,6 @@ }; static_assert(ExtractVendorFromMEI(0xFFF10001) != 0, "Must have class defined for \"Matter Orphan Clusters\" if it's a standard device type"); -static_assert(ExtractVendorFromMEI(0xFFF10002) != 0, "Must have class defined for \"Matter Secondary Network Commissioning Device Type\" if it's a standard device type"); static_assert(ExtractVendorFromMEI(0xFFF10003) != 0, "Must have class defined for \"Matter All-clusters-app Server Example\" if it's a standard device type"); } // anonymous namespace From 0050994833d1402c055fea85b4c3cfbb74f8e1b0 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 Jun 2024 01:36:58 -0400 Subject: [PATCH 053/162] Fix advertised device type for all-clusters-app to match data model. (#33715) * Fix advertised device type for all-clusters-app to match data model. We were claiming a device type of 0x0101 in the Descriptor DeviceTypeList on endpoint 1, but claiming a device type of 0xFFFF (not even a valid value) via DNS-SD advertising. Align our advertising behavior with the data model values. Fixes https://github.com/project-chip/connectedhomeip/issues/33697 * Address review comment. --- .../all-clusters-app/linux/include/CHIPProjectAppConfig.h | 4 ++++ .../all-clusters-app/tizen/include/CHIPProjectAppConfig.h | 4 ++++ src/app/tests/suites/TestDiscovery.yaml | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h b/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h index 440ba53f4ee3ba..0285563216e706 100644 --- a/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h +++ b/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h @@ -47,3 +47,7 @@ #define CHIP_CONFIG_MAX_PATHS_PER_INVOKE 5 #define CHIP_CONFIG_ENABLE_BDX_LOG_TRANSFER 1 + +// Claim a device type while advertising that matches the device type on our +// endpoint 1. 0x0101 is the "Dimmable Light" device type. +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x0101 diff --git a/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h b/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h index 38f322eecaab66..3d67773217a22a 100644 --- a/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h +++ b/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h @@ -33,3 +33,7 @@ // All clusters app has 3 group endpoints. This needs to defined here so that // CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured. #define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3 + +// Claim a device type while advertising that matches the device type on our +// endpoint 1. 0x0101 is the "Dimmable Light" device type. +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x0101 diff --git a/src/app/tests/suites/TestDiscovery.yaml b/src/app/tests/suites/TestDiscovery.yaml index 77c0615a27bc8d..0cb6a033cc50ae 100644 --- a/src/app/tests/suites/TestDiscovery.yaml +++ b/src/app/tests/suites/TestDiscovery.yaml @@ -17,6 +17,9 @@ name: Test Discovery config: nodeId: 0x12344321 endpoint: 0 + # These defaults correspond to the behavior of all-clusters-app, and + # different values should be passed on the command line when testing + # against any other server. discriminator: type: int16u defaultValue: 3840 @@ -31,7 +34,7 @@ config: defaultValue: 32769 deviceType: type: int16u - defaultValue: 65535 + defaultValue: 0x0101 tests: - label: "Stop target device" From 4a8dc7371ec95e4a9c8e1210fd5757a8b8aaeeac Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Wed, 5 Jun 2024 14:35:44 +0200 Subject: [PATCH 054/162] Replace ChipBleUUID local variables for all platform (#33713) * Replace uuid for rest platform * Restyle * Update define for webos * Fix typo --- src/platform/ASR/BLEManagerImpl.cpp | 19 +++------- src/platform/Ameba/BLEManagerImpl.cpp | 13 +++---- src/platform/Beken/BLEManagerImpl.cpp | 14 +++----- .../ESP32/bluedroid/BLEManagerImpl.cpp | 20 +++++------ src/platform/ESP32/nimble/BLEManagerImpl.cpp | 22 +++++------- .../Infineon/CYW30739/BLEManagerImpl.cpp | 18 +++------- .../Infineon/PSOC6/BLEManagerImpl.cpp | 17 +++------ src/platform/Linux/BLEManagerImpl.cpp | 27 ++++++-------- src/platform/NuttX/BLEManagerImpl.cpp | 27 ++++++-------- src/platform/Zephyr/BLEManagerImpl.cpp | 14 +++----- .../bouffalolab/common/BLEManagerImpl.cpp | 13 +++---- src/platform/cc13xx_26xx/BLEManagerImpl.cpp | 8 ++--- .../cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h | 5 --- src/platform/mbed/BLEManagerImpl.cpp | 16 ++++----- src/platform/mt793x/BLEManagerImpl.cpp | 16 +++------ .../nxp/k32w/common/BLEManagerCommon.cpp | 16 ++++----- src/platform/qpg/BLEManagerImpl.cpp | 27 +++++--------- src/platform/silabs/efr32/BLEManagerImpl.cpp | 20 +++++------ src/platform/silabs/rs911x/BLEManagerImpl.cpp | 18 ++++------ src/platform/stm32/BLEManagerImpl.cpp | 14 +++----- src/platform/telink/BLEManagerImpl.cpp | 14 +++----- src/platform/webos/BLEManagerImpl.cpp | 36 ++++++++----------- 22 files changed, 136 insertions(+), 258 deletions(-) diff --git a/src/platform/ASR/BLEManagerImpl.cpp b/src/platform/ASR/BLEManagerImpl.cpp index 88f7460a962a3a..681639dda50a4a 100644 --- a/src/platform/ASR/BLEManagerImpl.cpp +++ b/src/platform/ASR/BLEManagerImpl.cpp @@ -62,15 +62,6 @@ namespace { const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING -const ChipBleUUID ChipUUID_CHIPoBLEChar_C3 = { { 0x64, 0x63, 0x02, 0x38, 0x87, 0x72, 0x45, 0xF2, 0xB8, 0x7D, 0x74, 0x8A, 0x83, 0x21, - 0x8F, 0x04 } }; -#endif static constexpr System::Clock::Timeout kFastAdvertiseTimeout = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_INTERVAL_CHANGE_TIME); System::Clock::Timestamp mAdvertiseStartTime; @@ -254,7 +245,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -263,20 +254,20 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLENotifyConfirm: - HandleIndicationConfirmation(event->CHIPoBLENotifyConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLENotifyConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: diff --git a/src/platform/Ameba/BLEManagerImpl.cpp b/src/platform/Ameba/BLEManagerImpl.cpp index 2d0a6d99515367..e4e881357d95fa 100644 --- a/src/platform/Ameba/BLEManagerImpl.cpp +++ b/src/platform/Ameba/BLEManagerImpl.cpp @@ -127,11 +127,6 @@ typedef struct const ble_uuid16_t ShortUUID_CHIPoBLEService = { BLE_UUID_TYPE_16, 0xFFF6 }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - static constexpr System::Clock::Timeout kFastAdvertiseTimeout = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_INTERVAL_CHANGE_TIME); System::Clock::Timestamp mAdvertiseStartTime; @@ -469,7 +464,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) { // Platform specific events case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connEstEvent; connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -479,13 +474,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -498,7 +493,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; diff --git a/src/platform/Beken/BLEManagerImpl.cpp b/src/platform/Beken/BLEManagerImpl.cpp index 37f9fea9b9106e..4cd53bd5cd2d89 100644 --- a/src/platform/Beken/BLEManagerImpl.cpp +++ b/src/platform/Beken/BLEManagerImpl.cpp @@ -73,11 +73,7 @@ enum DriveBLEExtPerfEvt_DISCONNECT = 0, }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; -static const uint8_t _svc_uuid[16] = { 0xF6, 0xFF, 0, 0, 0x0, 0x0, 0, 0, 0, 0, 0x0, 0x0, 0, 0, 0, 0 }; +static const uint8_t _svc_uuid[16] = { 0xF6, 0xFF, 0, 0, 0x0, 0x0, 0, 0, 0, 0, 0x0, 0x0, 0, 0, 0, 0 }; #define UUID_CHIPoBLECharact_RX \ { \ @@ -498,7 +494,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) { // Platform specific events case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connEstEvent; connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -508,13 +504,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -527,7 +523,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; diff --git a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp index 3e5cc6091e9314..e2fe1627812e82 100644 --- a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp +++ b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp @@ -99,10 +99,6 @@ const uint8_t UUID_CHIPoBLEChar_TX[] = { 0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER const uint8_t ShortUUID_CHIPoBLE_CharTx_Desc[] = { 0x02, 0x29 }; #endif -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; const uint8_t CharProps_ReadNotify = ESP_GATT_CHAR_PROP_BIT_READ | ESP_GATT_CHAR_PROP_BIT_NOTIFY; const uint8_t CharProps_Write = ESP_GATT_CHAR_PROP_BIT_WRITE; @@ -324,7 +320,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -333,16 +329,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -393,20 +389,20 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv break; case DeviceEventType::kPlatformESP32BLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformESP32BLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformESP32BLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index c153e4b592c8ea..cff25239fc6c8d 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -103,12 +103,8 @@ const ble_uuid16_t ShortUUID_CHIPoBLE_CharTx_Desc = { BLE_UUID_TYPE_16, 0x2902 } const ble_uuid128_t UUID128_CHIPoBLEChar_RX = { BLE_UUID_TYPE_128, { 0x11, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18 } }; -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; -const ble_uuid128_t UUID_CHIPoBLEChar_TX = { +const ble_uuid128_t UUID_CHIPoBLEChar_TX = { { BLE_UUID_TYPE_128 }, { 0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18 } }; @@ -374,7 +370,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -383,16 +379,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -443,20 +439,20 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv break; case DeviceEventType::kPlatformESP32BLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformESP32BLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &chipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &chipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformESP32BLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; diff --git a/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp b/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp index ab4deef1f91924..cc381e131154dc 100644 --- a/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp +++ b/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp @@ -49,16 +49,6 @@ namespace chip { namespace DeviceLayer { namespace Internal { -namespace { - -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - -} // unnamed namespace - BLEManagerImpl BLEManagerImpl::sInstance; wiced_bt_gatt_status_t app_gatts_callback(wiced_bt_gatt_evt_t event, wiced_bt_gatt_event_data_t * p_data); @@ -198,7 +188,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent _event; _event.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -207,17 +197,17 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: diff --git a/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp b/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp index cb2b01197669e7..cfe49953676d65 100644 --- a/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp +++ b/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp @@ -60,14 +60,7 @@ namespace chip { namespace DeviceLayer { namespace Internal { -namespace { -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - -} // unnamed namespace +namespace {} // unnamed namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -240,7 +233,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent _event; _event.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -249,16 +242,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index a61c6e2403de02..251f4f0d9261dd 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -72,11 +72,6 @@ static_assert(CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_CHANGE_TIME_MS >= "The extended advertising interval change time must be greater than the fast advertising interval change time"); #endif -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - } // namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -202,7 +197,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent{ .Type = DeviceEventType::kCHIPoBLEConnectionEstablished }; PlatformMgr().PostEventOrDie(&connectionEvent); @@ -210,16 +205,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -290,18 +285,18 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv } break; case DeviceEventType::kPlatformLinuxBLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformLinuxBLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformLinuxBLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete: @@ -368,7 +363,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->SubscribeCharacteristic() == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SubscribeCharacteristic() failed")); @@ -386,7 +381,7 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->UnsubscribeCharacteristic() == CHIP_NO_ERROR, @@ -435,7 +430,7 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_RX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid characteristic ID")); VerifyOrExit(conId->SendWriteRequest(std::move(pBuf)) == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SendWriteRequest() failed")); diff --git a/src/platform/NuttX/BLEManagerImpl.cpp b/src/platform/NuttX/BLEManagerImpl.cpp index e472e805a1154e..980a07983018c6 100644 --- a/src/platform/NuttX/BLEManagerImpl.cpp +++ b/src/platform/NuttX/BLEManagerImpl.cpp @@ -71,11 +71,6 @@ static_assert(CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_CHANGE_TIME_MS >= "The extended advertising interval change time must be greater than the fast advertising interval change time"); #endif -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - void HandleConnectTimeout(chip::System::Layer *, void * apEndpoint) { VerifyOrDie(apEndpoint != nullptr); @@ -213,7 +208,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -222,16 +217,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -272,18 +267,18 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv } break; case DeviceEventType::kPlatformLinuxBLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformLinuxBLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformLinuxBLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete: @@ -358,7 +353,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->SubscribeCharacteristic() == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SubscribeCharacteristic() failed")); @@ -376,7 +371,7 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->UnsubscribeCharacteristic() == CHIP_NO_ERROR, @@ -425,7 +420,7 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_RX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid characteristic ID")); VerifyOrExit(conId->SendWriteRequest(std::move(pBuf)) == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SendWriteRequest() failed")); diff --git a/src/platform/Zephyr/BLEManagerImpl.cpp b/src/platform/Zephyr/BLEManagerImpl.cpp index 09bb9c0c8d71cb..03341b59dd903e 100644 --- a/src/platform/Zephyr/BLEManagerImpl.cpp +++ b/src/platform/Zephyr/BLEManagerImpl.cpp @@ -75,12 +75,6 @@ const bt_uuid_128 UUID128_CHIPoBLEChar_C3 = bt_uuid_16 UUID16_CHIPoBLEService = BT_UUID_INIT_16(0xFFF6); -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - _bt_gatt_ccc CHIPoBLEChar_TX_CCC = BT_GATT_CCC_INITIALIZER(nullptr, BLEManagerImpl::HandleTXCCCWrite, nullptr); // clang-format off @@ -606,7 +600,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) if (writeEvent->Value == BT_GATT_CCC_INDICATE && SetSubscribed(writeEvent->BtConn)) { // Alert the BLE layer that CHIPoBLE "subscribe" has been received and increment the bt_conn reference counter. - HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); ChipLogProgress(DeviceLayer, "CHIPoBLE connection established (ConnId: 0x%02x, GATT MTU: %u)", bt_conn_index(writeEvent->BtConn), GetMTU(writeEvent->BtConn)); @@ -622,7 +616,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) { if (UnsetSubscribed(writeEvent->BtConn)) { - HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } } @@ -638,7 +632,7 @@ CHIP_ERROR BLEManagerImpl::HandleRXCharWrite(const ChipDeviceEvent * event) ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02x)", bt_conn_index(c1WriteEvent->BtConn)); - HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(c1WriteEvent->Data)); bt_conn_unref(c1WriteEvent->BtConn); @@ -653,7 +647,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharComplete(const ChipDeviceEvent * event) bt_conn_index(c2IndDoneEvent->BtConn), c2IndDoneEvent->Result); // Signal the BLE Layer that the outstanding indication is complete. - HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); bt_conn_unref(c2IndDoneEvent->BtConn); return CHIP_NO_ERROR; diff --git a/src/platform/bouffalolab/common/BLEManagerImpl.cpp b/src/platform/bouffalolab/common/BLEManagerImpl.cpp index 0b1679ef2aeb09..f3655fa2bf5bf5 100644 --- a/src/platform/bouffalolab/common/BLEManagerImpl.cpp +++ b/src/platform/bouffalolab/common/BLEManagerImpl.cpp @@ -57,11 +57,6 @@ const bt_uuid_128 UUID128_CHIPoBLEChar_TX = BT_UUID_INIT_128(0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18); bt_uuid_16 UUID16_CHIPoBLEService = BT_UUID_INIT_16(0xFFF6); -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING const bt_uuid_128 UUID128_CHIPoBLEChar_C3 = BT_UUID_INIT_128(0x04, 0x8F, 0x21, 0x83, 0x8A, 0x74, 0x7D, 0xB8, 0xF2, 0x45, 0x72, 0x87, 0x38, 0x02, 0x63, 0x64); @@ -496,7 +491,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) if (writeEvent->Value == BT_GATT_CCC_INDICATE && SetSubscribed(writeEvent->BtConn)) { // Alert the BLE layer that CHIPoBLE "subscribe" has been received and increment the bt_conn reference counter. - HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); ChipLogProgress(DeviceLayer, "CHIPoBLE connection established (ConnId: 0x%02x, GATT MTU: %u)", bt_conn_index(writeEvent->BtConn), GetMTU(writeEvent->BtConn)); @@ -512,7 +507,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) { if (UnsetSubscribed(writeEvent->BtConn)) { - HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } } @@ -528,7 +523,7 @@ CHIP_ERROR BLEManagerImpl::HandleRXCharWrite(const ChipDeviceEvent * event) ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02x)", bt_conn_index(c1WriteEvent->BtConn)); - HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(c1WriteEvent->Data)); bt_conn_unref(c1WriteEvent->BtConn); @@ -543,7 +538,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharComplete(const ChipDeviceEvent * event) bt_conn_index(c2IndDoneEvent->BtConn), c2IndDoneEvent->Result); // Signal the BLE Layer that the outstanding indication is complete. - HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); bt_conn_unref(c2IndDoneEvent->BtConn); return CHIP_NO_ERROR; diff --git a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp index e8bb817a5ad48c..6d2b1c2f1523ed 100644 --- a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp +++ b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp @@ -223,7 +223,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; BLEMGR_LOG("BLEMGR: OnPlatformEvent, kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -233,19 +233,19 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { BLEMGR_LOG("BLEMGR: OnPlatformEvent, kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { BLEMGR_LOG("BLEMGR: OnPlatformEvent, kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: { diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h index 16512930e9fa88..a5e2d31abaa6c7 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h @@ -240,11 +240,6 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla void NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) override; - const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, - 0x9F, 0x9D, 0x11 } }; - const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, - 0x9F, 0x9D, 0x12 } }; - friend BLEManager & BLEMgr(void); friend BLEManagerImpl & BLEMgrImpl(void); diff --git a/src/platform/mbed/BLEManagerImpl.cpp b/src/platform/mbed/BLEManagerImpl.cpp index 5048a92b1c48f3..79033dc37c6b07 100644 --- a/src/platform/mbed/BLEManagerImpl.cpp +++ b/src/platform/mbed/BLEManagerImpl.cpp @@ -63,12 +63,8 @@ namespace { const UUID ShortUUID_CHIPoBLEService(0xFFF6); // RX = BleLayer::CHIP_BLE_CHAR_1_ID const UUID LongUUID_CHIPoBLEChar_RX("18EE2EF5-263D-4559-959F-4F9C429F9D11"); -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; // TX = BleLayer::CHIP_BLE_CHAR_2_ID const UUID LongUUID_CHIPoBLEChar_TX("18EE2EF5-263D-4559-959F-4F9C429F9D12"); -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; } // namespace #if _BLEMGRIMPL_USE_LEDS @@ -905,7 +901,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgrImpl().PostEventOrDie(&connEstEvent); } @@ -913,13 +909,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -932,7 +928,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -989,11 +985,11 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU VerifyOrExit(CanCastTo(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG); // No need to do anything fancy here. Only 3 handles are used in this impl. - if (UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX)) + if (UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID)) { att_handle = sCHIPService.getTxHandle(); } - else if (UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_RX)) + else if (UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID)) { // TODO does this make sense? att_handle = sCHIPService.getRxHandle(); diff --git a/src/platform/mt793x/BLEManagerImpl.cpp b/src/platform/mt793x/BLEManagerImpl.cpp index 0a90f2e2a733ba..bc222c607833a5 100644 --- a/src/platform/mt793x/BLEManagerImpl.cpp +++ b/src/platform/mt793x/BLEManagerImpl.cpp @@ -79,11 +79,6 @@ const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer. EventGroupHandle_t xBleEventGroup; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - } // namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -249,7 +244,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogProgress(DeviceLayer, "_OnBlePlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } @@ -257,13 +252,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnBlePlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnBlePlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -277,7 +272,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnBlePlatformEvent kCHIPoBLEIndicateConfirm, ConId %04x", event->CHIPoBLEIndicateConfirm.ConId); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -346,8 +341,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU ChipDeviceEvent event; bt_status_t ret; - VerifyOrExit(UUIDsMatch(&ChipUUID_CHIPoBLEChar_TX, charId), err = CHIP_ERROR_INVALID_MESSAGE_TYPE); - VerifyOrExit(UUIDsMatch(&ChipUUID_CHIPoBLEChar_TX, charId), err = CHIP_ERROR_INVALID_MESSAGE_TYPE); + VerifyOrExit(UUIDsMatch(&Ble::CHIP_BLE_CHAR_2_UUID, charId), err = CHIP_ERROR_INVALID_MESSAGE_TYPE); ChipLogProgress(DeviceLayer, "SendIndication(): conId %d, len %d", conId, data->DataLength()); diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp index 4c9048a3f68192..0f70d5bb851e5b 100644 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp +++ b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp @@ -125,11 +125,7 @@ EventGroupHandle_t sEventGroup; TimerHandle_t connectionTimeout; -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; +const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; #if defined(chip_with_low_power) && (chip_with_low_power == 1) static bool bleAppStopInProgress; @@ -319,17 +315,17 @@ void BLEManagerCommon::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLESubscribe: ChipDeviceEvent connEstEvent; - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; @@ -338,7 +334,7 @@ void BLEManagerCommon::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; default: @@ -401,7 +397,7 @@ bool BLEManagerCommon::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBle PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t cId = (UUIDsMatch(&ChipUUID_CHIPoBLEChar_TX, charId) ? value_chipoble_tx : 0); + uint16_t cId = (UUIDsMatch(&Ble::CHIP_BLE_CHAR_2_UUID, charId) ? value_chipoble_tx : 0); ChipDeviceEvent event; if (cId != 0) diff --git a/src/platform/qpg/BLEManagerImpl.cpp b/src/platform/qpg/BLEManagerImpl.cpp index 45d291e651146d..73b18e7046bd7f 100644 --- a/src/platform/qpg/BLEManagerImpl.cpp +++ b/src/platform/qpg/BLEManagerImpl.cpp @@ -65,17 +65,6 @@ StaticTimer_t sbleAdvTimeoutTimerBuffer; // Full service UUID - CHIP_BLE_SVC_ID - taken from BleUUID.h header const uint8_t chipUUID_CHIPoBLE_Service[CHIP_ADV_SHORT_UUID_LEN] = { 0xFF, 0xF6 }; -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING -const ChipBleUUID chipUUID_CHIPoBLEChar_C3 = { { 0x64, 0x63, 0x02, 0x38, 0x87, 0x72, 0x45, 0xF2, 0xB8, 0x7D, 0x74, 0x8A, 0x83, 0x21, - 0x8F, 0x04 } }; -#endif /* CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING */ - } // unnamed namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -104,10 +93,10 @@ CHIP_ERROR BLEManagerImpl::_Init() appCbacks.cccCallback = _handleTXCharCCCDWrite; #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - qvCHIP_BleSetUUIDs(chipUUID_CHIPoBLE_Service, chipUUID_CHIPoBLEChar_TX.bytes, chipUUID_CHIPoBLEChar_RX.bytes, - chipUUID_CHIPoBLEChar_C3.bytes); + qvCHIP_BleSetUUIDs(chipUUID_CHIPoBLE_Service, Ble::CHIP_BLE_CHAR_2_UUID.bytes, Ble::CHIP_BLE_CHAR_1_UUID.bytes, + Ble::CHIP_BLE_CHAR_3_UUID.bytes); #else - qvCHIP_BleSetUUIDs(chipUUID_CHIPoBLE_Service, chipUUID_CHIPoBLEChar_TX.bytes, chipUUID_CHIPoBLEChar_RX.bytes, nullptr); + qvCHIP_BleSetUUIDs(chipUUID_CHIPoBLE_Service, Ble::CHIP_BLE_CHAR_2_UUID.bytes, Ble::CHIP_BLE_CHAR_1_UUID.bytes, nullptr); #endif /* CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING */ qvCHIP_BleInit(&appCbacks); @@ -211,7 +200,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } @@ -221,7 +210,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connClosedEvent; ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connClosedEvent.Type = DeviceEventType::kCHIPoBLEConnectionClosed; PlatformMgr().PostEventOrDie(&connClosedEvent); } @@ -229,7 +218,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -251,7 +240,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -311,7 +300,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU VerifyOrExit(IsSubscribed(conId), err = CHIP_ERROR_INVALID_ARGUMENT); ChipLogDetail(DeviceLayer, "Sending indication for CHIPoBLE Client TX (con %u, len %u)", conId, dataLen); - isRxHandle = UUIDsMatch(&chipUUID_CHIPoBLEChar_RX, charId); + isRxHandle = UUIDsMatch(&Ble::CHIP_BLE_CHAR_1_UUID, charId); cId = qvCHIP_BleGetHandle(isRxHandle); qvCHIP_BleSendIndication(conId, cId, dataLen, data->Start()); diff --git a/src/platform/silabs/efr32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp index 4a6d78574005c1..18d7578f8f0f76 100644 --- a/src/platform/silabs/efr32/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/BLEManagerImpl.cpp @@ -100,13 +100,9 @@ namespace { TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer. -const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; +const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; +const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; bd_addr randomizedAddr = { 0 }; @@ -243,7 +239,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } @@ -251,13 +247,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -270,7 +266,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -322,7 +318,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU CHIP_ERROR err = CHIP_NO_ERROR; CHIPoBLEConState * conState = GetConnectionState(conId); sl_status_t ret; - uint16_t cId = (UUIDsMatch(&ChipUUID_CHIPoBLEChar_RX, charId) ? gattdb_CHIPoBLEChar_Rx : gattdb_CHIPoBLEChar_Tx); + uint16_t cId = (UUIDsMatch(&Ble::CHIP_BLE_CHAR_1_UUID, charId) ? gattdb_CHIPoBLEChar_Rx : gattdb_CHIPoBLEChar_Tx); uint8_t timerHandle = GetTimerHandle(conId, true); VerifyOrExit(((conState != NULL) && (conState->subscribed != 0)), err = CHIP_ERROR_INVALID_ARGUMENT); diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index e7495322018170..3794eaef395318 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -255,13 +255,9 @@ namespace { TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer. -const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; +const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; +const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; } // namespace @@ -413,7 +409,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } @@ -421,13 +417,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -441,7 +437,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); DeviceLayer::SystemLayer().CancelTimer(OnSendIndicationTimeout, this); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; diff --git a/src/platform/stm32/BLEManagerImpl.cpp b/src/platform/stm32/BLEManagerImpl.cpp index 7a040a5fb93ba3..60b888d5ebc99b 100644 --- a/src/platform/stm32/BLEManagerImpl.cpp +++ b/src/platform/stm32/BLEManagerImpl.cpp @@ -63,12 +63,6 @@ TimerHandle_t sbleAdvTimeoutTimer; // Full service UUID - CHIP_BLE_SVC_ID - taken from BleUUID.h header const uint8_t chipUUID_CHIPoBLE_Service[CHIP_ADV_SHORT_UUID_LEN] = { 0xFF, 0xF6 }; -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - } // unnamed namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -198,19 +192,19 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) // Platform specific events case DeviceEventType::kCHIPoBLESubscribe: { ChipDeviceEvent connEstEvent; - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } break; case DeviceEventType::kCHIPoBLEUnsubscribe: { - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -230,7 +224,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEIndicateConfirm: { - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; diff --git a/src/platform/telink/BLEManagerImpl.cpp b/src/platform/telink/BLEManagerImpl.cpp index 69252b66a0ecef..c33de4264e1edd 100644 --- a/src/platform/telink/BLEManagerImpl.cpp +++ b/src/platform/telink/BLEManagerImpl.cpp @@ -79,12 +79,6 @@ const bt_uuid_128 UUID128_CHIPoBLEChar_C3 = bt_uuid_16 UUID16_CHIPoBLEService = BT_UUID_INIT_16(0xFFF6); -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - _bt_gatt_ccc CHIPoBLEChar_TX_CCC = BT_GATT_CCC_INITIALIZER(nullptr, BLEManagerImpl::HandleTXCCCWrite, nullptr); // clang-format off @@ -544,7 +538,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) if (writeEvent->Value == BT_GATT_CCC_INDICATE && SetSubscribed(writeEvent->BtConn)) { // Alert the BLE layer that CHIPoBLE "subscribe" has been received and increment the bt_conn reference counter. - HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); ChipLogProgress(DeviceLayer, "CHIPoBLE connection established (ConnId: 0x%02x, GATT MTU: %u)", bt_conn_index(writeEvent->BtConn), GetMTU(writeEvent->BtConn)); @@ -560,7 +554,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) { if (UnsetSubscribed(writeEvent->BtConn)) { - HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } } @@ -576,7 +570,7 @@ CHIP_ERROR BLEManagerImpl::HandleRXCharWrite(const ChipDeviceEvent * event) ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02x)", bt_conn_index(c1WriteEvent->BtConn)); - HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(c1WriteEvent->Data)); bt_conn_unref(c1WriteEvent->BtConn); @@ -591,7 +585,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharComplete(const ChipDeviceEvent * event) bt_conn_index(c2IndDoneEvent->BtConn), c2IndDoneEvent->Result); // Signal the BLE Layer that the outstanding indication is complete. - HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); bt_conn_unref(c2IndDoneEvent->BtConn); return CHIP_NO_ERROR; diff --git a/src/platform/webos/BLEManagerImpl.cpp b/src/platform/webos/BLEManagerImpl.cpp index 786ded0d3f4029..c488c1cf85e28a 100644 --- a/src/platform/webos/BLEManagerImpl.cpp +++ b/src/platform/webos/BLEManagerImpl.cpp @@ -56,14 +56,6 @@ namespace { static constexpr unsigned kNewConnectionScanTimeoutMs = 10000; static constexpr System::Clock::Timeout kConnectTimeout = System::Clock::Seconds16(10); -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; -#define CHIP_BLE_GATT_SERVICE "0000fff6-0000-1000-8000-00805f9b34fb" -#define CHIP_BLE_GATT_CHAR_WRITE "18ee2ef5-263d-4559-959f-4f9c429f9d11" -#define CHIP_BLE_GATT_CHAR_READ "18ee2ef5-263d-4559-959f-4f9c429f9d12" - } // namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -225,7 +217,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -234,16 +226,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -284,18 +276,18 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv } break; case DeviceEventType::kPlatformWebOSBLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformWebOSBLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformWebOSBLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; case DeviceEventType::kPlatformWebOSBLEPeripheralAdvConfiguredComplete: @@ -434,9 +426,9 @@ bool BLEManagerImpl::SubscribeCharacteristicToWebOS(void * bleConnObj, const uin pbnjson::JValue valueForMonitor = pbnjson::JObject(); valueForMonitor.put("clientId", std::string(mClientId)); - valueForMonitor.put("service", std::string(CHIP_BLE_GATT_SERVICE)); + valueForMonitor.put("service", std::string(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR)); pbnjson::JValue bytesJArray = pbnjson::JArray(); - bytesJArray.append(std::string(CHIP_BLE_GATT_CHAR_READ)); + bytesJArray.append(std::string(Ble::CHIP_BLE_CHAR_2_UUID_STR)); valueForMonitor.put("characteristics", bytesJArray); valueForMonitor.put("subscribe", true); @@ -456,8 +448,8 @@ bool BLEManagerImpl::SubscribeCharacteristicToWebOS(void * bleConnObj, const uin pbnjson::JValue valueForDescriptor = pbnjson::JObject(); valueForDescriptor.put("clientId", std::string(mClientId)); - valueForDescriptor.put("service", std::string(CHIP_BLE_GATT_SERVICE)); - valueForDescriptor.put("characteristic", std::string(CHIP_BLE_GATT_CHAR_READ)); + valueForDescriptor.put("service", std::string(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR)); + valueForDescriptor.put("characteristic", std::string(Ble::CHIP_BLE_CHAR_2_UUID_STR)); valueForDescriptor.put("descriptor", std::string("00002902-0000-1000-8000-00805f9b34fb")); @@ -568,8 +560,8 @@ bool BLEManagerImpl::SendWriteRequestToWebOS(void * bleConnObj, const uint8_t * pbnjson::JValue param = pbnjson::JObject(); pbnjson::JValue valueParam = pbnjson::JObject(); param.put("clientId", clientId); - param.put("service", std::string(CHIP_BLE_GATT_SERVICE)); - param.put("characteristic", std::string(CHIP_BLE_GATT_CHAR_WRITE)); + param.put("service", std::string(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR)); + param.put("characteristic", std::string(Ble::CHIP_BLE_CHAR_1_UUID_STR)); if (valueType == "byte") { From e445e8a214250a297c699953c5da62d68380b190 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Wed, 5 Jun 2024 15:19:14 +0200 Subject: [PATCH 055/162] [Tizen] Allow to pass CHIP error to device event (#33744) * Create GATT service with short Bluetooth SIG UUID * Do not initialize characteristics with dummy values * Do not keep non-Matter UUIDs in BleUUID.h * Pass CHIP_ERROR to device event * Simplify ChipDeviceEvent initialization * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/ble/BleUUID.h | 1 - src/platform/Linux/CHIPDevicePlatformEvent.h | 1 + src/platform/Tizen/BLEManagerImpl.cpp | 139 +++++++++---------- src/platform/Tizen/BLEManagerImpl.h | 14 +- src/platform/Tizen/CHIPDevicePlatformEvent.h | 13 +- 5 files changed, 75 insertions(+), 93 deletions(-) diff --git a/src/ble/BleUUID.h b/src/ble/BleUUID.h index 37e2fdc1180f5e..1c0eefd514100a 100644 --- a/src/ble/BleUUID.h +++ b/src/ble/BleUUID.h @@ -101,7 +101,6 @@ constexpr std::pair StringToUUID(const char (&str)[N]) // BlueZ API https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.Device.rst // describes ServiceData as "Keys are the UUIDs in string format" however no description // on actual case required -inline constexpr char CHIP_BLE_DESC_SHORT_UUID_STR[] = "2902"; inline constexpr char CHIP_BLE_SERVICE_SHORT_UUID_STR[] = "fff6"; inline constexpr char CHIP_BLE_SERVICE_LONG_UUID_STR[] = "0000fff6-0000-1000-8000-00805f9b34fb"; inline constexpr char CHIP_BLE_CHAR_1_UUID_STR[] = "18ee2ef5-263d-4559-959f-4f9c429f9d11"; diff --git a/src/platform/Linux/CHIPDevicePlatformEvent.h b/src/platform/Linux/CHIPDevicePlatformEvent.h index 18ed55a1ef28d4..a70411888413c1 100644 --- a/src/platform/Linux/CHIPDevicePlatformEvent.h +++ b/src/platform/Linux/CHIPDevicePlatformEvent.h @@ -23,6 +23,7 @@ #pragma once +#include #include #include diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index 209c5fb2337356..247719a9199b76 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -74,6 +74,9 @@ namespace Internal { namespace { +// Bluetooth SIG defined UUID for Client Characteristic Configuration Descriptor +constexpr const char * kClientCharacteristicConfigurationUUID = "2902"; + constexpr System::Clock::Timeout kNewConnectionScanTimeout = System::Clock::Seconds16(20); constexpr System::Clock::Timeout kConnectTimeout = System::Clock::Seconds16(20); constexpr System::Clock::Timeout kFastAdvertiseTimeout = @@ -208,7 +211,10 @@ void BLEManagerImpl::ReadValueRequestedCb(const char * remoteAddress, int reques ChipLogByteSpan(DeviceLayer, ByteSpan(Uint8::from_const_char(value.get()), len)); - ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_READ, offset, 0x00, value.get(), len); + char dummyValue[] = ""; + // Tizen API does not like NULLs even for zero-length values. + char * valuePtr = value ? value.get() : dummyValue; + ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_READ, offset, BT_ATT_ERROR_NONE, valuePtr, len); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_send_response() failed: %s", get_error_message(ret))); } @@ -233,7 +239,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque ret = bt_gatt_set_value(gattHandle, value, len); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_set_value() failed: %s", get_error_message(ret))); - ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_WRITE, offset, 0x00, nullptr, 0); + ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_WRITE, offset, BT_ATT_ERROR_NONE, nullptr, 0); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_send_response() failed: %s", get_error_message(ret))); @@ -265,7 +271,7 @@ void BLEManagerImpl::NotificationStateChangedCb(bool notify, bt_gatt_server_h se ChipLogProgress(DeviceLayer, "Notification State Changed %d on %s: %s", notify, __ConvertAttTypeToStr(type), StringOrNullMarker(uuid.get())); - NotifyBLESubscribed(notify ? true : false, conn); + NotifyBLESubscribed(conn, notify ? true : false); } void BLEManagerImpl::WriteCompletedCb(int result, bt_gatt_h gattHandle, void * userData) @@ -314,7 +320,7 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver if (advState == BT_ADAPTER_LE_ADVERTISING_STARTED) { mFlags.Set(Flags::kAdvertising); - NotifyBLEPeripheralAdvStartComplete(true, nullptr); + NotifyBLEPeripheralAdvStartComplete(CHIP_NO_ERROR); DeviceLayer::SystemLayer().ScheduleLambda([this] { // Start a timer to make sure that the fast advertising is stopped after specified timeout. DeviceLayer::SystemLayer().StartTimer(kFastAdvertiseTimeout, HandleAdvertisingTimeout, this); @@ -323,7 +329,7 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver else { mFlags.Clear(Flags::kAdvertising); - NotifyBLEPeripheralAdvStopComplete(true, nullptr); + NotifyBLEPeripheralAdvStopComplete(CHIP_NO_ERROR); DeviceLayer::SystemLayer().ScheduleLambda( [this] { DeviceLayer::SystemLayer().CancelTimer(HandleAdvertisingTimeout, this); }); } @@ -338,89 +344,73 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver } // ====== Private Functions. -void BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(bool aIsSuccess, void * apAppstate) + +void BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEPeripheralGATTServerRegisterComplete; - event.Platform.BLEPeripheralGATTServerRegisterComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralGATTServerRegisterComplete.mpAppstate = apAppstate; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralGATTServerRegisterComplete, + .Platform = { .BLEPeripheralGATTServerRegisterComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvConfiguredComplete; - event.Platform.BLEPeripheralAdvConfiguredComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralAdvConfiguredComplete.mpAppstate = apAppstate; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvConfiguredComplete, + .Platform = { .BLEPeripheralAdvConfiguredComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStartComplete; - event.Platform.BLEPeripheralAdvStartComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralAdvStartComplete.mpAppstate = apAppstate; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStartComplete, + .Platform = { .BLEPeripheralAdvStartComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStopComplete; - event.Platform.BLEPeripheralAdvStopComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralAdvStopComplete.mpAppstate = apAppstate; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStopComplete, + .Platform = { .BLEPeripheralAdvStopComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEWriteReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId) +void BLEManagerImpl::NotifyBLEWriteReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEWriteReceived; - event.CHIPoBLEWriteReceived.ConId = conId; - event.CHIPoBLEWriteReceived.Data = std::move(buf).UnsafeRelease(); + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEWriteReceived, + .CHIPoBLEWriteReceived = { .ConId = conId, .Data = std::move(buf).UnsafeRelease() } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLENotificationReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId) +void BLEManagerImpl::NotifyBLENotificationReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEIndicationReceived; - event.Platform.BLEIndicationReceived.mConnection = conId; - event.Platform.BLEIndicationReceived.mData = std::move(buf).UnsafeRelease(); + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEIndicationReceived, + .Platform = { + .BLEIndicationReceived = { .mConnection = conId, .mData = std::move(buf).UnsafeRelease() } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLESubscribed(bool indicationsEnabled, BLE_CONNECTION_OBJECT conId) +void BLEManagerImpl::NotifyBLESubscribed(BLE_CONNECTION_OBJECT conId, bool indicationsEnabled) { - ChipDeviceEvent event; - event.Type = (indicationsEnabled) ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe; - event.CHIPoBLESubscribe.ConId = conId; + ChipDeviceEvent event{ .Type = indicationsEnabled ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe, + .CHIPoBLESubscribe = { .ConId = conId } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEIndicationConfirmation(BLE_CONNECTION_OBJECT conId) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; - event.CHIPoBLEIndicateConfirm.ConId = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEIndicateConfirm, .CHIPoBLEIndicateConfirm = { .ConId = conId } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionEstablished }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEConnectionError; - event.CHIPoBLEConnectionError.ConId = conId; - event.CHIPoBLEConnectionError.Reason = error; + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionError, + .CHIPoBLEConnectionError = { .ConId = conId, .Reason = error } }; PlatformMgr().PostEventOrDie(&event); } @@ -429,9 +419,8 @@ void BLEManagerImpl::NotifyHandleConnectFailed(CHIP_ERROR error) ChipLogProgress(DeviceLayer, "Connection failed: %" CHIP_ERROR_FORMAT, error.Format()); if (mIsCentral) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLECentralConnectFailed; - event.Platform.BLECentralConnectFailed.mError = error; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLECentralConnectFailed, + .Platform = { .BLECentralConnectFailed = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } } @@ -440,27 +429,23 @@ void BLEManagerImpl::NotifyHandleNewConnection(BLE_CONNECTION_OBJECT conId) { if (mIsCentral) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLECentralConnected; - event.Platform.BLECentralConnected.mConnection = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLECentralConnected, + .Platform = { .BLECentralConnected = { .mConnection = conId } } }; PlatformMgr().PostEventOrDie(&event); } } void BLEManagerImpl::NotifyHandleWriteComplete(BLE_CONNECTION_OBJECT conId) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEWriteComplete; - event.Platform.BLEWriteComplete.mConnection = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEWriteComplete, + .Platform = { .BLEWriteComplete = { .mConnection = conId } } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifySubscribeOpComplete(BLE_CONNECTION_OBJECT conId, bool isSubscribed) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLESubscribeOpComplete; - event.Platform.BLESubscribeOpComplete.mConnection = conId; - event.Platform.BLESubscribeOpComplete.mIsSubscribed = isSubscribed; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLESubscribeOpComplete, + .Platform = { .BLESubscribeOpComplete = { .mConnection = conId, .mIsSubscribed = isSubscribed } } }; PlatformMgr().PostEventOrDie(&event); } @@ -574,7 +559,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_create() failed: %s", get_error_message(ret))); // Create Service (BTP Service) - ret = bt_gatt_service_create(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR, BT_GATT_SERVICE_TYPE_PRIMARY, &service); + ret = bt_gatt_service_create(Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR, BT_GATT_SERVICE_TYPE_PRIMARY, &service); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_service_create() failed: %s", get_error_message(ret))); // Create 1st Characteristic (Client TX Buffer) @@ -583,7 +568,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() BT_GATT_PROPERTY_WRITE, // Write Request is not coming if we use WITHOUT_RESPONSE property. Let's use WRITE property and // consider to use WITHOUT_RESPONSE property in the future according to the CHIP Spec 4.16.3.2. BTP // GATT Service - "CHIPoBLE_C1", strlen("CHIPoBLE_C1"), &char1); + nullptr, 0, &char1); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed: %s", get_error_message(ret))); @@ -604,8 +589,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() // Create 2nd Characteristic (Client RX Buffer) ret = bt_gatt_characteristic_create(Ble::CHIP_BLE_CHAR_2_UUID_STR, BT_GATT_PERMISSION_READ, - BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_INDICATE, "CHIPoBLE_C2", strlen("CHIPoBLE_C2"), - &char2); + BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_INDICATE, nullptr, 0, &char2); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed: %s", get_error_message(ret))); @@ -618,6 +602,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() this); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_set_read_value_requested_cb() failed: %s", get_error_message(ret))); + ret = bt_gatt_server_set_characteristic_notification_state_change_cb( char2, +[](bool notify, bt_gatt_server_h gattServer, bt_gatt_h charHandle, void * self) { @@ -628,13 +613,14 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() ChipLogError(DeviceLayer, "bt_gatt_server_set_characteristic_notification_state_change_cb() failed: %s", get_error_message(ret))); - // Create CCC Descriptor - ret = bt_gatt_descriptor_create(Ble::CHIP_BLE_DESC_SHORT_UUID_STR, BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE, + ret = bt_gatt_descriptor_create(kClientCharacteristicConfigurationUUID, BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE, desc_value, sizeof(desc_value), &desc); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_descriptor_create() failed: %s", get_error_message(ret))); + ret = bt_gatt_characteristic_add_descriptor(char2, desc); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_characteristic_add_descriptor() failed: %s", get_error_message(ret))); + ret = bt_gatt_service_add_characteristic(service, char2); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_service_add_characteristic() failed: %s", get_error_message(ret))); @@ -648,8 +634,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() ret = bt_gatt_server_start(); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_start() failed: %s", get_error_message(ret))); - ChipLogDetail(DeviceLayer, "NotifyBLEPeripheralGATTServerRegisterComplete Success"); - BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(true, nullptr); + BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_NO_ERROR); // Save the Local Peripheral char1 & char2 handles mGattCharC1Handle = char1; @@ -657,8 +642,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() return CHIP_NO_ERROR; exit: - ChipLogDetail(DeviceLayer, "NotifyBLEPeripheralGATTServerRegisterComplete Failed"); - BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(false, nullptr); + BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(TizenToChipError(ret)); return TizenToChipError(ret); } @@ -727,7 +711,7 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising() VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_adapter_le_set_advertising_device_name() failed: %s", get_error_message(ret))); - BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(true, nullptr); + BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(CHIP_NO_ERROR); ret = bt_adapter_le_start_advertising_new( mAdvertiser, @@ -742,8 +726,9 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising() return CHIP_NO_ERROR; exit: - BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(false, nullptr); - return ret != BT_ERROR_NONE ? TizenToChipError(ret) : err; + err = ret != BT_ERROR_NONE ? TizenToChipError(ret) : err; + BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(err); + return err; } CHIP_ERROR BLEManagerImpl::StopBLEAdvertising() @@ -758,7 +743,7 @@ CHIP_ERROR BLEManagerImpl::StopBLEAdvertising() return CHIP_NO_ERROR; exit: - BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(false, nullptr); + BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(TizenToChipError(ret)); return TizenToChipError(ret); } @@ -896,7 +881,7 @@ void BLEManagerImpl::HandleC1CharWriteEvent(BLE_CONNECTION_OBJECT conId, const u // Copy the data to a packet buffer. buf = System::PacketBufferHandle::NewWithData(value, len); VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY); - NotifyBLEWriteReceived(buf, conId); + NotifyBLEWriteReceived(conId, buf); return; exit: if (err != CHIP_NO_ERROR) @@ -915,7 +900,7 @@ void BLEManagerImpl::HandleRXCharChanged(BLE_CONNECTION_OBJECT conId, const uint // Copy the data to a packet buffer. buf = System::PacketBufferHandle::NewWithData(value, len); VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY); - NotifyBLENotificationReceived(buf, conId); + NotifyBLENotificationReceived(conId, buf); return; exit: if (err != CHIP_NO_ERROR) diff --git a/src/platform/Tizen/BLEManagerImpl.h b/src/platform/Tizen/BLEManagerImpl.h index ed30b92aa958b7..5dfee7fba75c83 100644 --- a/src/platform/Tizen/BLEManagerImpl.h +++ b/src/platform/Tizen/BLEManagerImpl.h @@ -196,13 +196,13 @@ class BLEManagerImpl final : public BLEManager, bool IsDeviceChipPeripheral(BLE_CONNECTION_OBJECT conId); // ==== BLE Adv & GATT Server. - void NotifyBLEPeripheralGATTServerRegisterComplete(bool aIsSuccess, void * apAppstate); - void NotifyBLEPeripheralAdvConfiguredComplete(bool aIsSuccess, void * apAppstate); - void NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate); - void NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate); - void NotifyBLESubscribed(bool indicationsEnabled, BLE_CONNECTION_OBJECT conId); + void NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_ERROR error); + void NotifyBLEPeripheralAdvConfiguredComplete(CHIP_ERROR error); + void NotifyBLEPeripheralAdvStartComplete(CHIP_ERROR error); + void NotifyBLEPeripheralAdvStopComplete(CHIP_ERROR error); + void NotifyBLESubscribed(BLE_CONNECTION_OBJECT conId, bool indicationsEnabled); void NotifyBLEIndicationConfirmation(BLE_CONNECTION_OBJECT conId); - void NotifyBLEWriteReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId); + void NotifyBLEWriteReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf); static void HandleAdvertisingTimeout(chip::System::Layer *, void * appState); AdvertisingIntervals GetAdvertisingIntervals() const; @@ -214,7 +214,7 @@ class BLEManagerImpl final : public BLEManager, void NotifyHandleConnectFailed(CHIP_ERROR error); void NotifyHandleWriteComplete(BLE_CONNECTION_OBJECT conId); void NotifySubscribeOpComplete(BLE_CONNECTION_OBJECT conId, bool isSubscribed); - void NotifyBLENotificationReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId); + void NotifyBLENotificationReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf); CHIP_ERROR RegisterGATTServer(); CHIP_ERROR StartBLEAdvertising(); diff --git a/src/platform/Tizen/CHIPDevicePlatformEvent.h b/src/platform/Tizen/CHIPDevicePlatformEvent.h index 2145b18b448c8f..ce606fd7f576fd 100644 --- a/src/platform/Tizen/CHIPDevicePlatformEvent.h +++ b/src/platform/Tizen/CHIPDevicePlatformEvent.h @@ -23,6 +23,7 @@ #pragma once +#include #include #include @@ -67,23 +68,19 @@ struct ChipDevicePlatformEvent { struct { - bool mIsSuccess; - void * mpAppstate; + CHIP_ERROR mError; } BLEPeripheralGATTServerRegisterComplete; struct { - bool mIsSuccess; - void * mpAppstate; + CHIP_ERROR mError; } BLEPeripheralAdvConfiguredComplete; struct { - bool mIsSuccess; - void * mpAppstate; + CHIP_ERROR mError; } BLEPeripheralAdvStartComplete; struct { - bool mIsSuccess; - void * mpAppstate; + CHIP_ERROR mError; } BLEPeripheralAdvStopComplete; struct { From 4ec2035f2cb5f20eec8d3623d765924db050e6c9 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 5 Jun 2024 09:20:39 -0400 Subject: [PATCH 056/162] Python wheels: move template into its own gni (#33739) This will let us re-use the template later for wheels not in src/controller/python. Nothing within the template has been changed - this is just a move. Test: ran build_python.sh, it's fine still. --- build/chip/python_wheel.gni | 88 ++++++++++++++++++++++++++++++++++ src/controller/python/BUILD.gn | 70 +-------------------------- 2 files changed, 89 insertions(+), 69 deletions(-) create mode 100644 build/chip/python_wheel.gni diff --git a/build/chip/python_wheel.gni b/build/chip/python_wheel.gni new file mode 100644 index 00000000000000..ac00fe140456cc --- /dev/null +++ b/build/chip/python_wheel.gni @@ -0,0 +1,88 @@ +# Copyright (c) 2024 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/chip.gni") +import("//build_overrides/pigweed.gni") + +import("$dir_pw_build/python.gni") +import("${chip_root}/src/system/system.gni") + +declare_args() { + chip_python_version = "0.0" + chip_python_package_prefix = "chip" + chip_python_supports_stack_locking = chip_system_config_locking != "none" +} + +template("chip_python_wheel_action") { + _dist_dir = "${root_out_dir}/controller/python" + + _py_manifest_file = "${target_gen_dir}/${target_name}.py_manifest.json" + + pw_python_action(target_name) { + script = "build-chip-wheel.py" + forward_variables_from(invoker, "*") + + _py_manifest_files_rebased = [] + foreach(_manifest_entry, py_manifest_files) { + inputs += _manifest_entry.sources + _py_manifest_files_rebased += [ + { + src_dir = rebase_path(_manifest_entry.src_dir, + get_path_info(_py_manifest_file, "dir")) + sources = + rebase_path(_manifest_entry.sources, _manifest_entry.src_dir) + }, + ] + } + + if (defined(invoker.py_scripts)) { + _py_scripts = invoker.py_scripts + } else { + _py_scripts = [] + } + + _py_manifest = { + files = _py_manifest_files_rebased + packages = py_packages + scripts = _py_scripts + package_reqs = py_package_reqs + } + + write_file(_py_manifest_file, _py_manifest, "json") + + args = [ + "--package_name", + py_package_name, + "--build_number", + chip_python_version, + "--build_dir", + rebase_path("${target_gen_dir}/${target_name}.py_build", root_build_dir), + "--dist_dir", + rebase_path(_dist_dir, root_build_dir), + "--manifest", + rebase_path(_py_manifest_file, root_build_dir), + "--plat-name", + py_platform_tag, + ] + + if (defined(invoker.lib_name)) { + args += [ + "--lib-name", + lib_name, + ] + } + + outputs = [ "${_dist_dir}/$output_name" ] + } +} diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index 9adda770125317..747aa522504ca6 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -18,6 +18,7 @@ import("//build_overrides/pigweed.gni") import("$dir_pw_build/python.gni") +import("${chip_root}/build/chip/python_wheel.gni") import("${chip_root}/build/chip/tools.gni") import("${chip_root}/src/platform/python.gni") import("${chip_root}/src/system/system.gni") @@ -31,12 +32,6 @@ config("controller_wno_deprecate") { cflags = [ "-Wno-deprecated-declarations" ] } -declare_args() { - chip_python_version = "0.0" - chip_python_package_prefix = "chip" - chip_python_supports_stack_locking = chip_system_config_locking != "none" -} - shared_library("ChipDeviceCtrl") { if (chip_controller) { output_name = "_ChipDeviceCtrl" @@ -157,69 +152,6 @@ shared_library("ChipDeviceCtrl") { configs += [ ":controller_wno_deprecate" ] } -template("chip_python_wheel_action") { - _dist_dir = "${root_out_dir}/controller/python" - - _py_manifest_file = "${target_gen_dir}/${target_name}.py_manifest.json" - - pw_python_action(target_name) { - script = "build-chip-wheel.py" - forward_variables_from(invoker, "*") - - _py_manifest_files_rebased = [] - foreach(_manifest_entry, py_manifest_files) { - inputs += _manifest_entry.sources - _py_manifest_files_rebased += [ - { - src_dir = rebase_path(_manifest_entry.src_dir, - get_path_info(_py_manifest_file, "dir")) - sources = - rebase_path(_manifest_entry.sources, _manifest_entry.src_dir) - }, - ] - } - - if (defined(invoker.py_scripts)) { - _py_scripts = invoker.py_scripts - } else { - _py_scripts = [] - } - - _py_manifest = { - files = _py_manifest_files_rebased - packages = py_packages - scripts = _py_scripts - package_reqs = py_package_reqs - } - - write_file(_py_manifest_file, _py_manifest, "json") - - args = [ - "--package_name", - py_package_name, - "--build_number", - chip_python_version, - "--build_dir", - rebase_path("${target_gen_dir}/${target_name}.py_build", root_build_dir), - "--dist_dir", - rebase_path(_dist_dir, root_build_dir), - "--manifest", - rebase_path(_py_manifest_file, root_build_dir), - "--plat-name", - py_platform_tag, - ] - - if (defined(invoker.lib_name)) { - args += [ - "--lib-name", - lib_name, - ] - } - - outputs = [ "${_dist_dir}/$output_name" ] - } -} - chip_python_wheel_action("chip-core") { py_manifest_files = [ { From 6092e8a764f45371d8c48da9b254fe83f917d388 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 5 Jun 2024 16:06:15 +0200 Subject: [PATCH 057/162] [Python] Drop network lock (#33720) The network lock is not needed in the Python controller, as all calls to the SDK are made by posting to the Matter SDK event loop through ScheduleWork(), hence are guaranteed to be serialized. From how I understand ScheduleWork() works, it pushes the work to the event loop through PostEvent() which at least on POSIX is using the thread safe device queue (see GenericPlatformManagerImpl_POSIX.cpp). --- src/controller/python/chip/ChipStack.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index 06afff3ef3c380..b47c4639825da8 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -144,8 +144,6 @@ class ChipStack(object): def __init__(self, persistentStoragePath: str, enableServerInteractions=True): builtins.enableDebugMode = False - # TODO: Probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. - self.networkLock = Lock() self.completeEvent = Event() self.commissioningCompleteEvent = Event() self._ChipStackLib = None @@ -212,7 +210,6 @@ def Shutdown(self): # #20437 tracks consolidating these. # self._ChipStackLib.pychip_CommonStackShutdown() - self.networkLock = None self.completeEvent = None self._ChipStackLib = None self._chipDLLPath = None @@ -226,10 +223,7 @@ def Call(self, callFunct, timeoutMs: int = None): This function is a wrapper of PostTaskOnChipThread, which includes some handling of application specific logics. Calling this function on CHIP on CHIP mainloop thread will cause deadlock. ''' - # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. - with self.networkLock: - res = self.PostTaskOnChipThread(callFunct).Wait(timeoutMs) - return res + return self.PostTaskOnChipThread(callFunct).Wait(timeoutMs) async def CallAsync(self, callFunct, timeoutMs: int = None): '''Run a Python function on CHIP stack, and wait for the response. @@ -256,9 +250,7 @@ def CallAsyncWithCompleteCallback(self, callFunct): # throw error if op in progress self.callbackRes = None self.completeEvent.clear() - # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. - with self.networkLock: - res = self.PostTaskOnChipThread(callFunct).Wait() + res = self.PostTaskOnChipThread(callFunct).Wait() if not res.is_success: self.completeEvent.set() From 92a322d391511a9fda840a72cbe571c7c6ad7c0e Mon Sep 17 00:00:00 2001 From: shripad621git <79364691+shripad621git@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:32:05 +0530 Subject: [PATCH 058/162] Adding few logs related to event ids for ESP32 platform specific events (#33751) --- src/platform/ESP32/PlatformManagerImpl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/ESP32/PlatformManagerImpl.cpp b/src/platform/ESP32/PlatformManagerImpl.cpp index ed9f6aca7128c9..d5ad12352dbf3a 100644 --- a/src/platform/ESP32/PlatformManagerImpl.cpp +++ b/src/platform/ESP32/PlatformManagerImpl.cpp @@ -119,6 +119,7 @@ void PlatformManagerImpl::HandleESPSystemEvent(void * arg, esp_event_base_t even event.Platform.ESPSystemEvent.Id = eventId; if (eventBase == IP_EVENT) { + ChipLogProgress(DeviceLayer, "Posting ESPSystemEvent: IP Event with eventId : %ld", eventId); switch (eventId) { case IP_EVENT_STA_GOT_IP: @@ -138,6 +139,7 @@ void PlatformManagerImpl::HandleESPSystemEvent(void * arg, esp_event_base_t even #if CHIP_DEVICE_CONFIG_ENABLE_WIFI else if (eventBase == WIFI_EVENT) { + ChipLogProgress(DeviceLayer, "Posting ESPSystemEvent: Wifi Event with eventId : %ld", eventId); switch (eventId) { case WIFI_EVENT_SCAN_DONE: @@ -181,7 +183,10 @@ void PlatformManagerImpl::HandleESPSystemEvent(void * arg, esp_event_base_t even } } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI - + else + { + ChipLogProgress(DeviceLayer, "Posting ESPSystemEvent with eventId : %ld", eventId); + } sInstance.PostEventOrDie(&event); } From 4c39f7e7ffdeea15c746df4e4284185d7edc7e7f Mon Sep 17 00:00:00 2001 From: Gibran Vargas <131407127+gvargas-csa@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:53:19 -0700 Subject: [PATCH 059/162] TC-OPCREDS-3.2: Add (#32182) * chore(TC_OPCREDS-3.2): skeleton base class * chore(TC_OPCREDS_3.2): NOCResponse command * chore(TC_OPCREDS_3.2): get currentFabric * chore(TC_OPCREDS_3.2): print some status values * TC-OPCREDS-3.2: Re-work test This test was difficult to automate and included a factory reset. This automation start is used to generate the test plans. The intent of this test is to confirm that the returned fabric index matches the fabric index returned from the AddNOC command, and that the read of fabric-filtered attributes matches to the calling fabric. The rest of the test is covered by OPCREDS-3.1 so was removed to simplify. NOTE: test not yet implemented, uploaded for test plan generation purposes only. - Properly use Test Step and Expected outcome columns - Remove checks for NOCs matching - this is checked in OPCREDS-3.1 - Remove factory reset and commission two new fabrics - Use commissioning over CASE so we can more easily return the fabric index * chore(TC_OPCREDS_3.2): included new steps (1-6) Just need to add validation for CR3 and remove all fabrics. Also it need clean up (remove prints, unused variables, etc) * chore(TC_OPCREDS_3.2): all steps are implemtented * chore(TC_OPCREDS_3.2): restyled by isort * chore(TC_OPCREDS_3_2): fix error from python linter (code-lints) * chore(TC_OPCREDS_3.2): import restyled by isort * chore(TC_OPCREDS_3.2): fixed the vendorID for prevent fail * chore(TC_OPCREDS_3.2): add test to CI Workflow * chore(TC_OPCREDS_3.2): off auto-format and change the return values label * chore(TC_OPCREDS_3.2): remove if-else validation instead used assert_equal * chore(TC_OPCREDS_3.2): spacing adjustment for better readability * chore(TC_OPCREDS_3.2): identation adjustment for better readability * chore(TC_OPCREDS_3.2): restyled patch identation adjustment * chore(TC_OPCREDS_3.2): reverted addition of test --------- Co-authored-by: cecille --- .github/workflows/tests.yaml | 1 + .../chip/utils/CommissioningBuildingBlocks.py | 36 ++-- src/python_testing/TC_OPCREDS_3_2.py | 190 ++++++++++++++++++ src/python_testing/test_plan_support.py | 78 +++++++ 4 files changed, 290 insertions(+), 15 deletions(-) create mode 100644 src/python_testing/TC_OPCREDS_3_2.py create mode 100644 src/python_testing/test_plan_support.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 678b7b18195aa0..24895bf5f07e01 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -536,6 +536,7 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPCREDS_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' diff --git a/src/controller/python/chip/utils/CommissioningBuildingBlocks.py b/src/controller/python/chip/utils/CommissioningBuildingBlocks.py index 8fa80223b14316..4c3826fd6914ee 100644 --- a/src/controller/python/chip/utils/CommissioningBuildingBlocks.py +++ b/src/controller/python/chip/utils/CommissioningBuildingBlocks.py @@ -156,12 +156,14 @@ async def AddNOCForNewFabricFromExisting(commissionerDevCtrl, newFabricDevCtrl, newNodeId (int): Node ID to use for the target node on the new fabric. Return: - bool: True if successful, False otherwise. + tuple: (bool, Optional[nocResp], Optional[rcacResp]: True if successful, False otherwise, along with nocResp, rcacResp value. ''' + nocResp = None + resp = await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(60)) if resp.errorCode is not generalCommissioning.Enums.CommissioningErrorEnum.kOk: - return False + return False, nocResp csrForAddNOC = await commissionerDevCtrl.SendCommand(existingNodeId, 0, opCreds.Commands.CSRRequest(CSRNonce=os.urandom(32))) @@ -171,31 +173,35 @@ async def AddNOCForNewFabricFromExisting(commissionerDevCtrl, newFabricDevCtrl, chainForAddNOC.nocBytes is None or chainForAddNOC.ipkBytes is None): # Expiring the failsafe timer in an attempt to clean up. await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(0)) - return False + return False, nocResp await commissionerDevCtrl.SendCommand(existingNodeId, 0, opCreds.Commands.AddTrustedRootCertificate(chainForAddNOC.rcacBytes)) - resp = await commissionerDevCtrl.SendCommand(existingNodeId, - 0, - opCreds.Commands.AddNOC(chainForAddNOC.nocBytes, - chainForAddNOC.icacBytes, - chainForAddNOC.ipkBytes, - newFabricDevCtrl.nodeId, - newFabricDevCtrl.fabricAdmin.vendorId)) - if resp.statusCode is not opCreds.Enums.NodeOperationalCertStatusEnum.kOk: + nocResp = await commissionerDevCtrl.SendCommand(existingNodeId, + 0, + opCreds.Commands.AddNOC(chainForAddNOC.nocBytes, + chainForAddNOC.icacBytes, + chainForAddNOC.ipkBytes, + newFabricDevCtrl.nodeId, + newFabricDevCtrl.fabricAdmin.vendorId)) + + rcacResp = chainForAddNOC.rcacBytes + + if nocResp.statusCode is not opCreds.Enums.NodeOperationalCertStatusEnum.kOk: # Expiring the failsafe timer in an attempt to clean up. await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(0)) - return False + return False, nocResp resp = await newFabricDevCtrl.SendCommand(newNodeId, 0, generalCommissioning.Commands.CommissioningComplete()) + if resp.errorCode is not generalCommissioning.Enums.CommissioningErrorEnum.kOk: # Expiring the failsafe timer in an attempt to clean up. await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(0)) - return False + return False, nocResp if not await _IsNodeInFabricList(newFabricDevCtrl, newNodeId): - return False + return False, nocResp - return True + return True, nocResp, rcacResp async def UpdateNOC(devCtrl, existingNodeId, newNodeId): diff --git a/src/python_testing/TC_OPCREDS_3_2.py b/src/python_testing/TC_OPCREDS_3_2.py new file mode 100644 index 00000000000000..5b7cd5bd59480e --- /dev/null +++ b/src/python_testing/TC_OPCREDS_3_2.py @@ -0,0 +1,190 @@ +# +# Copyright (c) 2024 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. +# + +import chip.clusters as Clusters +from chip.tlv import TLVReader +from chip.utils import CommissioningBuildingBlocks +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from test_plan_support import (commission_from_existing, commission_if_required, read_attribute, remove_fabric, + verify_commissioning_successful, verify_success) + + +def verify_fabric(controller: str) -> str: + return (f"- Verify there is one entry returned. Verify FabricIndex matches `fabric_index_{controller}`.\n" + f"- Verify the RootPublicKey matches the public key for rcac_{controller}.\n" + f"- Verify the VendorID matches the vendor ID for {controller}.\n" + f"- Verify the FabricID matches the fabricID for {controller}") + + +class TC_OPCREDS_3_2(MatterBaseTest): + def desc_TC_OPCREDS_3_2(self): + return " Attribute-CurrentFabricIndex validation [DUTServer]" + + def steps_TC_OPCREDS_3_2(self): + return [TestStep(0, commission_if_required('CR1'), is_commissioning=True), + TestStep(1, f"{commission_from_existing('CR1', 'CR2')}\n. Save the FabricIndex from the NOCResponse as `fabric_index_CR2`.", + verify_commissioning_successful()), + TestStep(2, f"{commission_from_existing('CR1', 'CR3')}\n. Save the FabricIndex from the NOCResponse as `fabric_index_CR3`.", + verify_commissioning_successful()), + TestStep(3, f"CR2 {read_attribute('CurrentFabricIndex')}", + "Verify the returned value is `fabric_index_CR2`"), + TestStep(4, f"CR3 {read_attribute('CurrentFabricIndex')}", + "Verify the returned value is `fabric_index_CR3`"), + TestStep( + 5, f"CR2 {read_attribute('Fabrics')} using a fabric-filtered read", verify_fabric('CR2')), + TestStep( + 6, f"CR3 {read_attribute('Fabrics')} using a fabric-filtered read", verify_fabric('CR3')), + TestStep(7, remove_fabric( + 'fabric_index_CR2', 'CR1'), verify_success()), + TestStep(8, remove_fabric( + 'fabric_index_CR3', 'CR1'), verify_success()), + ] + + @async_test_body + async def test_TC_OPCREDS_3_2(self): + opcreds = Clusters.OperationalCredentials + + self.step(0) + + self.step(1) + dev_ctrl = self.default_controller + + new_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority() + cr2_vid = 0xFFF2 + cr2_fabricId = 2222 + cr2_new_fabric_admin = new_certificate_authority.NewFabricAdmin( + vendorId=cr2_vid, fabricId=cr2_fabricId) + cr2_nodeid = self.default_controller.nodeId+1 + cr2_dut_node_id = self.dut_node_id+1 + + cr2_new_admin_ctrl = cr2_new_fabric_admin.NewController( + nodeId=cr2_nodeid) + success, nocResp, rcacResp = await CommissioningBuildingBlocks.AddNOCForNewFabricFromExisting( + commissionerDevCtrl=dev_ctrl, newFabricDevCtrl=cr2_new_admin_ctrl, + existingNodeId=self.dut_node_id, newNodeId=cr2_dut_node_id + ) + + fabric_index_CR2 = nocResp.fabricIndex + tlvReaderRCAC_CR2 = TLVReader(rcacResp).get()["Any"] + rcac_CR2 = tlvReaderRCAC_CR2[9] # public key is field 9 + + self.step(2) + new_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority() + cr3_vid = 0xFFF3 + cr3_fabricId = 3333 + cr3_new_fabric_admin = new_certificate_authority.NewFabricAdmin( + vendorId=cr3_vid, fabricId=cr3_fabricId) + cr3_nodeid = self.default_controller.nodeId+2 + cr3_dut_node_id = self.dut_node_id+2 + + cr3_new_admin_ctrl = cr3_new_fabric_admin.NewController( + nodeId=cr3_nodeid) + success, nocResp, rcacResp = await CommissioningBuildingBlocks.AddNOCForNewFabricFromExisting( + commissionerDevCtrl=dev_ctrl, newFabricDevCtrl=cr3_new_admin_ctrl, + existingNodeId=self.dut_node_id, newNodeId=cr3_dut_node_id + ) + + fabric_index_CR3 = nocResp.fabricIndex + tlvReaderRCAC_CR3 = TLVReader(rcacResp).get()["Any"] + rcac_CR3 = tlvReaderRCAC_CR3[9] + + self.step(3) + cr2_read_fabricIndex = await self.read_single_attribute_check_success( + dev_ctrl=cr2_new_admin_ctrl, + node_id=cr2_dut_node_id, + cluster=opcreds, + attribute=opcreds.Attributes.CurrentFabricIndex + ) + + asserts.assert_equal(fabric_index_CR2, cr2_read_fabricIndex, + "Fail fabric_index_CR2 is not equal to read fabricIndex from CR2") + + self.step(4) + cr3_read_fabricIndex = await self.read_single_attribute_check_success( + dev_ctrl=cr3_new_admin_ctrl, + node_id=cr3_dut_node_id, + cluster=opcreds, + attribute=opcreds.Attributes.CurrentFabricIndex + ) + + asserts.assert_equal(fabric_index_CR3, cr3_read_fabricIndex, + "Fail fabric_index_CR3 is not equal to read fabricIndex from CR3") + + self.step(5) + cr2_fabric = await self.read_single_attribute_check_success( + dev_ctrl=cr2_new_admin_ctrl, + node_id=cr2_dut_node_id, + cluster=opcreds, + attribute=opcreds.Attributes.Fabrics, + fabric_filtered=True + ) + + for fabric in cr2_fabric: + cr2_fabric_fabricIndex = fabric.fabricIndex + cr2_fabric_rootPublicKey = fabric.rootPublicKey + cr2_fabric_vendorId = fabric.vendorID + cr2_fabric_fabricId = fabric.fabricID + + asserts.assert_equal(cr2_fabric_fabricIndex, + fabric_index_CR2, "Unexpected CR2 fabric index") + asserts.assert_equal(cr2_fabric_rootPublicKey, rcac_CR2, + "Unexpected RootPublicKey does not match with rcac_CR2") + asserts.assert_equal(cr2_fabric_vendorId, cr2_vid, + "Unexpected vendorId does not match with CR2 VendorID") + asserts.assert_equal(cr2_fabric_fabricId, cr2_fabricId, + "Unexpected fabricId does not match with CR2 fabricID") + + self.step(6) + cr3_fabric = await self.read_single_attribute_check_success( + dev_ctrl=cr3_new_admin_ctrl, + node_id=cr3_dut_node_id, + cluster=opcreds, + attribute=opcreds.Attributes.Fabrics, + fabric_filtered=True + ) + + for fabric in cr3_fabric: + cr3_fabric_fabricIndex = fabric.fabricIndex + cr3_fabric_rootPublicKey = fabric.rootPublicKey + cr3_fabric_vendorId = fabric.vendorID + cr3_fabric_fabricId = fabric.fabricID + + asserts.assert_equal(cr3_fabric_fabricIndex, + fabric_index_CR3, "Unexpected CR3 fabric index") + asserts.assert_equal(cr3_fabric_rootPublicKey, rcac_CR3, + "Unexpected RootPublicKey does not match with rcac_CR3") + asserts.assert_equal(cr3_fabric_vendorId, cr3_vid, + "Unexpected vendorId does not match with CR3 VendorID") + asserts.assert_equal(cr3_fabric_fabricId, cr3_fabricId, + "Unexpected fabricId does not match with CR3 fabricID") + + self.step(7) + cmd = opcreds.Commands.RemoveFabric(fabric_index_CR2) + resp = await self.send_single_cmd(cmd=cmd) + asserts.assert_equal( + resp.statusCode, opcreds.Enums.NodeOperationalCertStatusEnum.kOk) + + self.step(8) + cmd = opcreds.Commands.RemoveFabric(fabric_index_CR3) + resp = await self.send_single_cmd(cmd=cmd) + asserts.assert_equal( + resp.statusCode, opcreds.Enums.NodeOperationalCertStatusEnum.kOk) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/test_plan_support.py b/src/python_testing/test_plan_support.py new file mode 100644 index 00000000000000..1acb8576bdb15c --- /dev/null +++ b/src/python_testing/test_plan_support.py @@ -0,0 +1,78 @@ +# +# Copyright (c) 2024 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. +# +import typing + + +def read_attribute(attribute: str, cluster: typing.Optional[str] = None): + attr = f'reads the {attribute} attribute' + if cluster: + return f'{attr} from {cluster}' + else: + return attr + + +def save_as(val: str) -> str: + return f' and saves the value as {val}' + + +def verify_status(status: str) -> str: + return f'Verify DUT responds w/ status {status}' + + +def verify_success() -> str: + return verify_status('SUCCESS') + +# ----------------------- +# Commissioning strings +# ----------------------- + + +def commission_if_required(controller: typing.Optional[str] = None) -> str: + controller_str = f'to {controller} ' if controller is not None else '' + return f'Commission DUT {controller_str}if not already done' + + +def commission_from_existing(existing_controller_name: str, new_controller_name: str) -> str: + # NOTE to implementers: This text corresponds to the actions taken by CommissioningBuildingBlocks.AddNOCForNewFabricFromExisting. + # This function should be used in the TestSteps description when you use that function. + # AddNOCForNewFabricFromExisting is used when the generated certificates are required for use in the test. + # It written one step so we can just use the function directly without needing to annotate the sub-steps for the TH. + return (f'Create a new controller on a new fabric called {new_controller_name}.\n' + f'Commission the new controller from {existing_controller_name} as follows:\n\n' + f'- {existing_controller_name} sends an ArmFailsafe command, followed by a CSRRequest command.\n' + f'- Generate credentials on {new_controller_name} using the returned CSR.\n' + f'- Save the RCAC as `rcac_{new_controller_name}. Save the ICAC as `icac_{new_controller_name}`. Save the NOC as `noc_{new_controller_name}`. Save the IPK as ipk_{new_controller_name}.\n' + f'- {existing_controller_name} sends the AddTrustedRootCertificate command with `rcac_{new_controller_name}`' + f'- {existing_controller_name} sends the AddNOC command with the fields set as follows:\n' + f' * NOCValue: `noc_{new_controller_name}`\n' + f' * ICACValue: `icac_{new_controller_name}`\n' + f' * IPKValue: `ipk_{new_controller_name}`\n' + f' * CaseAdminSubject: {new_controller_name} node ID\n' + f' * AdminVendorId: {new_controller_name} vendor ID\n' + f'- {new_controller_name} connects over CASE and sends the commissioning complete command') + + +def open_commissioning_window(controller: str = 'TH') -> str: + return f'{controller} opens a commissioning window on the DUT' + + +def remove_fabric(index_var: str, controller: str): + return f'{controller} sends the RemoveFabric command to the Node Operational Credentials cluster with the FabricIndex set to {index_var}.' + + +def verify_commissioning_successful() -> str: + return 'Verify the commissioning is successful.' From f91b25669cc3ab53e48d0b3ef602505b8ea5cc1b Mon Sep 17 00:00:00 2001 From: Pradip De Date: Wed, 5 Jun 2024 12:05:25 -0700 Subject: [PATCH 060/162] Changes for large Packetbuffer allocation to support TCP payloads (#33308) * Changes for large Packetbuffer allocation to support TCP payloads Changes to internal checks in SystemPacketBuffer. Update the length encoding for TCP payloads during send and receive. Max size config for large packetbuffer size limit in SystemPacketBuffer.h. Define Max application payload size for large buffers Test modifications for chainedbuffer receives for TCP. - Add test for Buffer length greater than MRP max size. - Disable TCP on nrfconnect platform because of resource requirements. Stack allocations for large buffer with default size is exceeding limits. Disabling the Test file altogether for this platform would prevent all tests from running. Instead, only disabling TCP on nrfConnect for now, since it is unused. Fixes #31779. * Update src/system/SystemPacketBuffer.cpp Co-authored-by: Boris Zbarsky * Update src/transport/raw/TCP.cpp Co-authored-by: Boris Zbarsky * Restyle fix --------- Co-authored-by: Boris Zbarsky --- config/nrfconnect/chip-module/CMakeLists.txt | 2 +- src/inet/TCPEndPoint.h | 2 +- src/inet/TCPEndPointImplSockets.cpp | 5 +-- src/system/SystemConfig.h | 18 ++++++++ src/system/SystemPacketBuffer.cpp | 41 +++++++++++++----- src/system/SystemPacketBuffer.h | 24 ++++++++++- src/system/tests/TestSystemPacketBuffer.cpp | 18 ++++---- src/transport/SecureMessageCodec.cpp | 1 - src/transport/SessionManager.cpp | 9 ++++ src/transport/raw/MessageHeader.h | 11 ++++- src/transport/raw/TCP.cpp | 27 ++++++------ src/transport/raw/TCP.h | 6 +-- src/transport/raw/TCPConfig.h | 9 ---- src/transport/raw/tests/TestTCP.cpp | 44 ++++++++++++-------- 14 files changed, 145 insertions(+), 72 deletions(-) diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 51ca4689de1ca1..29560db74f38cc 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -129,7 +129,7 @@ matter_add_gn_arg_bool ("chip_enable_nfc" CONFIG_CHIP_NF matter_add_gn_arg_bool ("chip_enable_ota_requestor" CONFIG_CHIP_OTA_REQUESTOR) matter_add_gn_arg_bool ("chip_persist_subscriptions" CONFIG_CHIP_PERSISTENT_SUBSCRIPTIONS) matter_add_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) -matter_add_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS) +matter_add_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" FALSE) matter_add_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 1) matter_add_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3) matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4) diff --git a/src/inet/TCPEndPoint.h b/src/inet/TCPEndPoint.h index 8fc6a6338d4140..57652349cfa83a 100644 --- a/src/inet/TCPEndPoint.h +++ b/src/inet/TCPEndPoint.h @@ -522,7 +522,7 @@ class DLL_EXPORT TCPEndPoint : public EndPointBasis /** * Size of the largest TCP packet that can be received. */ - constexpr static size_t kMaxReceiveMessageSize = System::PacketBuffer::kMaxSizeWithoutReserve; + constexpr static size_t kMaxReceiveMessageSize = System::PacketBuffer::kMaxAllocSize; protected: friend class TCPTest; diff --git a/src/inet/TCPEndPointImplSockets.cpp b/src/inet/TCPEndPointImplSockets.cpp index d21c11b6a42865..6b8965b19d2b4b 100644 --- a/src/inet/TCPEndPointImplSockets.cpp +++ b/src/inet/TCPEndPointImplSockets.cpp @@ -947,10 +947,9 @@ void TCPEndPointImplSockets::ReceiveData() { VerifyOrDie(rcvLen > 0); size_t newDataLength = rcvBuf->DataLength() + static_cast(rcvLen); - VerifyOrDie(CanCastTo(newDataLength)); if (isNewBuf) { - rcvBuf->SetDataLength(static_cast(newDataLength)); + rcvBuf->SetDataLength(newDataLength); rcvBuf.RightSize(); if (mRcvQueue.IsNull()) { @@ -963,7 +962,7 @@ void TCPEndPointImplSockets::ReceiveData() } else { - rcvBuf->SetDataLength(static_cast(newDataLength), mRcvQueue); + rcvBuf->SetDataLength(newDataLength, mRcvQueue); } } } diff --git a/src/system/SystemConfig.h b/src/system/SystemConfig.h index e91f59298f683e..b37cfe555278dd 100644 --- a/src/system/SystemConfig.h +++ b/src/system/SystemConfig.h @@ -788,3 +788,21 @@ struct LwIPEvent; #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD 0 #endif #endif // CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD + +/** + * @def CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES + * + * @brief Maximum buffer allocation size of a 'Large' message + * + * This is the default maximum capacity (including both data and reserve + * space) of a large PacketBuffer(exceeding the IPv6 MTU of 1280 bytes). + * This shall be used over transports, such as TCP, that support large + * payload transfers. Fetching of large command responses or wildcard + * subscription responses may leverage this increased bandwidth transfer. + * Individual systems may override this size based on their requirements. + * Data transfers over MRP should not be using this size for allocating + * buffers as they are restricted by the IPv6 MTU. + */ +#ifndef CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES +#define CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES (64000) +#endif diff --git a/src/system/SystemPacketBuffer.cpp b/src/system/SystemPacketBuffer.cpp index f8dda8b01ab84e..9f29d2755908cd 100644 --- a/src/system/SystemPacketBuffer.cpp +++ b/src/system/SystemPacketBuffer.cpp @@ -515,6 +515,21 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese // Setting a static upper bound on the maximum buffer size allocation for regular sized messages (not large). static_assert(PacketBuffer::kMaxSizeWithoutReserve <= UINT16_MAX, "kMaxSizeWithoutReserve should not exceed UINT16_MAX."); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + // Setting a static upper bound on the maximum buffer size allocation for + // large messages. +#if CHIP_SYSTEM_CONFIG_USE_LWIP + // LwIP based systems are internally limited to using a u16_t type as the size of a buffer. + static_assert(PacketBuffer::kLargeBufMaxSizeWithoutReserve <= UINT16_MAX, + "In LwIP, max size for Large payload buffers cannot exceed UINT16_MAX!"); +#else + // Messages over TCP are framed using a length field that is 32 bits in + // length. + static_assert(PacketBuffer::kLargeBufMaxSizeWithoutReserve <= UINT32_MAX, + "Max size for Large payload buffers cannot exceed UINT32_MAX"); +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + // Ensure that aAvailableSize is bound within a max and is not big enough to cause overflow during // subsequent addition of all the sizes. if (aAvailableSize > UINT32_MAX) @@ -547,7 +562,14 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese #if CHIP_SYSTEM_CONFIG_USE_LWIP // LwIP based APIs have a maximum buffer size of UINT16_MAX. Ensure that // limit is met during allocation. - VerifyOrDieWithMsg(sumOfAvailAndReserved < UINT16_MAX, chipSystemLayer, "LwIP based systems can handle only up to UINT16_MAX!"); + if (sumOfAvailAndReserved > UINT16_MAX) + { + ChipLogError(chipSystemLayer, + "LwIP based systems require total buffer size to be less than UINT16_MAX!" + "Attempted allocation size = " ChipLogFormatX64, + ChipLogValueX64(sumOfAvailAndReserved)); + return PacketBufferHandle(); + } #endif // CHIP_SYSTEM_CONFIG_USE_LWIP // sumOfAvailAndReserved is no larger than sumOfSizes, which we checked can be cast to @@ -557,7 +579,7 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese CHIP_SYSTEM_FAULT_INJECT(FaultInjection::kFault_PacketBufferNew, return PacketBufferHandle()); - if (lAllocSize > PacketBuffer::kMaxSizeWithoutReserve) + if (lAllocSize > PacketBuffer::kMaxAllocSize) { ChipLogError(chipSystemLayer, "PacketBuffer: allocation exceeding buffer capacity limits."); return PacketBufferHandle(); @@ -621,11 +643,6 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese PacketBufferHandle PacketBufferHandle::NewWithData(const void * aData, size_t aDataSize, size_t aAdditionalSize, uint16_t aReservedSize) { - if (aDataSize > UINT16_MAX) - { - ChipLogError(chipSystemLayer, "PacketBuffer: allocation too large."); - return PacketBufferHandle(); - } // Since `aDataSize` fits in uint16_t, the sum `aDataSize + aAdditionalSize` will not overflow. // `New()` will only return a non-null buffer if the total allocation size does not overflow. PacketBufferHandle buffer = New(aDataSize + aAdditionalSize, aReservedSize); @@ -633,6 +650,8 @@ PacketBufferHandle PacketBufferHandle::NewWithData(const void * aData, size_t aD { memcpy(buffer.mBuffer->payload, aData, aDataSize); #if CHIP_SYSTEM_CONFIG_USE_LWIP + // Checks in the New() call catch buffer allocations greater + // than UINT16_MAX for LwIP based platforms. buffer.mBuffer->len = buffer.mBuffer->tot_len = static_cast(aDataSize); #else buffer.mBuffer->len = buffer.mBuffer->tot_len = aDataSize; @@ -755,18 +774,18 @@ PacketBufferHandle PacketBufferHandle::CloneData() const size_t originalDataSize = original->MaxDataLength(); uint16_t originalReservedSize = original->ReservedSize(); - if (originalDataSize + originalReservedSize > PacketBuffer::kMaxSizeWithoutReserve) + if (originalDataSize + originalReservedSize > PacketBuffer::kMaxAllocSize) { // The original memory allocation may have provided a larger block than requested (e.g. when using a shared pool), // and in particular may have provided a larger block than we are able to request from PackBufferHandle::New(). // It is a genuine error if that extra space has been used. - if (originalReservedSize + original->DataLength() > PacketBuffer::kMaxSizeWithoutReserve) + if (originalReservedSize + original->DataLength() > PacketBuffer::kMaxAllocSize) { return PacketBufferHandle(); } // Otherwise, reduce the requested data size. This subtraction can not underflow because the above test - // guarantees originalReservedSize <= PacketBuffer::kMaxSizeWithoutReserve. - originalDataSize = PacketBuffer::kMaxSizeWithoutReserve - originalReservedSize; + // guarantees originalReservedSize <= PacketBuffer::kMaxAllocSize. + originalDataSize = PacketBuffer::kMaxAllocSize - originalReservedSize; } PacketBufferHandle clone = PacketBufferHandle::New(originalDataSize, originalReservedSize); diff --git a/src/system/SystemPacketBuffer.h b/src/system/SystemPacketBuffer.h index 41eaef6d9e305c..5068822c7f22a4 100644 --- a/src/system/SystemPacketBuffer.h +++ b/src/system/SystemPacketBuffer.h @@ -119,7 +119,7 @@ class DLL_EXPORT PacketBuffer : private pbuf public: /** - * The maximum size buffer an application can allocate with no protocol header reserve. + * The maximum size of a regular buffer an application can allocate with no protocol header reserve. */ #if CHIP_SYSTEM_CONFIG_USE_LWIP static constexpr size_t kMaxSizeWithoutReserve = LWIP_MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE); @@ -134,10 +134,30 @@ class DLL_EXPORT PacketBuffer : private pbuf static constexpr uint16_t kDefaultHeaderReserve = CHIP_SYSTEM_CONFIG_HEADER_RESERVE_SIZE; /** - * The maximum size buffer an application can allocate with the default protocol header reserve. + * The maximum size of a regular buffer an application can allocate with the default protocol header reserve. */ static constexpr size_t kMaxSize = kMaxSizeWithoutReserve - kDefaultHeaderReserve; + /** + * The maximum size of a large buffer(> IPv6 MTU) that an application can allocate with no protocol header reserve. + */ + static constexpr size_t kLargeBufMaxSizeWithoutReserve = CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES; + + /** + * The maximum size of a large buffer(> IPv6 MTU) that an application can allocate with the default protocol header reserve. + */ + static constexpr size_t kLargeBufMaxSize = kLargeBufMaxSizeWithoutReserve - kDefaultHeaderReserve; + + /** + * Unified constant(both regular and large buffers) for the maximum size that an application can allocate with no + * protocol header reserve. + */ +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + static constexpr size_t kMaxAllocSize = kLargeBufMaxSizeWithoutReserve; +#else + static constexpr size_t kMaxAllocSize = kMaxSizeWithoutReserve; +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + /** * Return the size of the allocation including the reserved and payload data spaces but not including space * allocated for the PacketBuffer structure. diff --git a/src/system/tests/TestSystemPacketBuffer.cpp b/src/system/tests/TestSystemPacketBuffer.cpp index bf1456487307a3..e445eed17a38e9 100644 --- a/src/system/tests/TestSystemPacketBuffer.cpp +++ b/src/system/tests/TestSystemPacketBuffer.cpp @@ -300,7 +300,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckNew) { const PacketBufferHandle buffer = PacketBufferHandle::New(0, config.reserved_size); - if (config.reserved_size > PacketBuffer::kMaxSizeWithoutReserve) + if (config.reserved_size > PacketBuffer::kMaxAllocSize) { EXPECT_TRUE(buffer.IsNull()); continue; @@ -1596,7 +1596,8 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckHandleRightSize) TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckHandleCloneData) { - uint8_t lPayload[2 * PacketBuffer::kMaxSizeWithoutReserve]; + uint8_t lPayload[2 * PacketBuffer::kMaxAllocSize]; + for (uint8_t & payload : lPayload) { payload = static_cast(random()); @@ -1675,7 +1676,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckHandleCloneData) // This is only testable on heap allocation configurations, where pbuf records the allocation size and we can manually // construct an oversize buffer. - constexpr uint16_t kOversizeDataSize = PacketBuffer::kMaxSizeWithoutReserve + 99; + constexpr size_t kOversizeDataSize = PacketBuffer::kMaxAllocSize + 99; PacketBuffer * p = reinterpret_cast(chip::Platform::MemoryAlloc(kStructureSize + kOversizeDataSize)); ASSERT_NE(p, nullptr); @@ -1689,15 +1690,16 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckHandleCloneData) PacketBufferHandle handle = PacketBufferHandle::Adopt(p); // Fill the buffer to maximum and verify that it can be cloned. + size_t maxSize = PacketBuffer::kMaxAllocSize; - memset(handle->Start(), 1, PacketBuffer::kMaxSizeWithoutReserve); - handle->SetDataLength(PacketBuffer::kMaxSizeWithoutReserve); - EXPECT_EQ(handle->DataLength(), PacketBuffer::kMaxSizeWithoutReserve); + memset(handle->Start(), 1, maxSize); + handle->SetDataLength(maxSize); + EXPECT_EQ(handle->DataLength(), maxSize); PacketBufferHandle clone = handle.CloneData(); ASSERT_FALSE(clone.IsNull()); - EXPECT_EQ(clone->DataLength(), PacketBuffer::kMaxSizeWithoutReserve); - EXPECT_EQ(memcmp(handle->Start(), clone->Start(), PacketBuffer::kMaxSizeWithoutReserve), 0); + EXPECT_EQ(clone->DataLength(), maxSize); + EXPECT_EQ(memcmp(handle->Start(), clone->Start(), maxSize), 0); // Overfill the buffer and verify that it can not be cloned. memset(handle->Start(), 2, kOversizeDataSize); diff --git a/src/transport/SecureMessageCodec.cpp b/src/transport/SecureMessageCodec.cpp index 3b70026c5681d6..263b4e5e127a5a 100644 --- a/src/transport/SecureMessageCodec.cpp +++ b/src/transport/SecureMessageCodec.cpp @@ -41,7 +41,6 @@ CHIP_ERROR Encrypt(const CryptoContext & context, CryptoContext::ConstNonceView { VerifyOrReturnError(!msgBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(!msgBuf->HasChainedBuffer(), CHIP_ERROR_INVALID_MESSAGE_LENGTH); - VerifyOrReturnError(msgBuf->TotalLength() <= kMaxAppMessageLen, CHIP_ERROR_MESSAGE_TOO_LONG); ReturnErrorOnFailure(payloadHeader.EncodeBeforeData(msgBuf)); diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index d49e66fb6f5116..00acc485d47d23 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -201,6 +201,15 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P packetHeader.SetSecureSessionControlMsg(true); } + if (sessionHandle->AllowsLargePayload()) + { + VerifyOrReturnError(message->TotalLength() <= kMaxLargeAppMessageLen, CHIP_ERROR_MESSAGE_TOO_LONG); + } + else + { + VerifyOrReturnError(message->TotalLength() <= kMaxAppMessageLen, CHIP_ERROR_MESSAGE_TOO_LONG); + } + #if CHIP_PROGRESS_LOGGING NodeId destination; FabricIndex fabricIndex; diff --git a/src/transport/raw/MessageHeader.h b/src/transport/raw/MessageHeader.h index ef4f86d3993793..2752a5c86c82c2 100644 --- a/src/transport/raw/MessageHeader.h +++ b/src/transport/raw/MessageHeader.h @@ -60,7 +60,6 @@ static constexpr size_t kMaxPacketBufferApplicationPayloadAndMICSizeBytes = Syst static constexpr size_t kMaxApplicationPayloadAndMICSizeBytes = min(kMaxPerSpecApplicationPayloadAndMICSizeBytes, kMaxPacketBufferApplicationPayloadAndMICSizeBytes); - } // namespace detail static constexpr size_t kMaxTagLen = 16; @@ -74,6 +73,16 @@ static constexpr size_t kMaxAppMessageLen = detail::kMaxApplicationPayloadAndMIC static constexpr uint16_t kMsgUnicastSessionIdUnsecured = 0x0000; +// Minimum header size of TCP + IPv6 without options. +static constexpr size_t kMaxTCPAndIPHeaderSizeBytes = 60; + +// Max space for the Application Payload and MIC for large packet buffers +// This is the size _excluding_ the header reserve. +static constexpr size_t kMaxLargeApplicationPayloadAndMICSizeBytes = + System::PacketBuffer::kLargeBufMaxSize - kMaxTCPAndIPHeaderSizeBytes; + +static constexpr size_t kMaxLargeAppMessageLen = kMaxLargeApplicationPayloadAndMICSizeBytes - kMaxTagLen; + typedef int PacketHeaderFlags; namespace Header { diff --git a/src/transport/raw/TCP.cpp b/src/transport/raw/TCP.cpp index e33590a63a6fdf..b928c3e91cccae 100644 --- a/src/transport/raw/TCP.cpp +++ b/src/transport/raw/TCP.cpp @@ -39,11 +39,15 @@ namespace { using namespace chip::Encoding; -// Packets start with a 16-bit size -constexpr size_t kPacketSizeBytes = 2; +// Packets start with a 32-bit size field. +constexpr size_t kPacketSizeBytes = 4; -// TODO: Actual limit may be lower (spec issue #2119) -constexpr uint16_t kMaxMessageSize = static_cast(System::PacketBuffer::kMaxSizeWithoutReserve - kPacketSizeBytes); +static_assert(System::PacketBuffer::kLargeBufMaxSizeWithoutReserve <= UINT32_MAX, "Cast below could truncate the value"); +static_assert(System::PacketBuffer::kLargeBufMaxSizeWithoutReserve >= kPacketSizeBytes, + "Large buffer allocation should be large enough to hold the length field"); + +constexpr uint32_t kMaxTCPMessageSize = + static_cast(System::PacketBuffer::kLargeBufMaxSizeWithoutReserve - kPacketSizeBytes); constexpr int kListenBacklogSize = 2; @@ -197,21 +201,21 @@ ActiveTCPConnectionState * TCPBase::FindInUseConnection(const Inet::TCPEndPoint CHIP_ERROR TCPBase::SendMessage(const Transport::PeerAddress & address, System::PacketBufferHandle && msgBuf) { // Sent buffer data format is: - // - packet size as a uint16_t + // - packet size as a uint32_t // - actual data VerifyOrReturnError(address.GetTransportType() == Type::kTcp, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(mState == TCPState::kInitialized, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(kPacketSizeBytes + msgBuf->DataLength() <= std::numeric_limits::max(), + VerifyOrReturnError(kPacketSizeBytes + msgBuf->DataLength() <= System::PacketBuffer::kLargeBufMaxSizeWithoutReserve, CHIP_ERROR_INVALID_ARGUMENT); - // The check above about kPacketSizeBytes + msgBuf->DataLength() means it definitely fits in uint16_t. + static_assert(kPacketSizeBytes <= UINT16_MAX); VerifyOrReturnError(msgBuf->EnsureReservedSize(static_cast(kPacketSizeBytes)), CHIP_ERROR_NO_MEMORY); msgBuf->SetStart(msgBuf->Start() - kPacketSizeBytes); uint8_t * output = msgBuf->Start(); - LittleEndian::Write16(output, static_cast(msgBuf->DataLength() - kPacketSizeBytes)); + LittleEndian::Write32(output, static_cast(msgBuf->DataLength() - kPacketSizeBytes)); // Reuse existing connection if one exists, otherwise a new one // will be established @@ -324,10 +328,9 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe { return err; } - uint16_t messageSize = LittleEndian::Get16(messageSizeBuf); - if (messageSize >= kMaxMessageSize) + uint32_t messageSize = LittleEndian::Get32(messageSizeBuf); + if (messageSize >= kMaxTCPMessageSize) { - // This message is too long for upper layers. return CHIP_ERROR_MESSAGE_TOO_LONG; } @@ -344,7 +347,7 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe return CHIP_NO_ERROR; } -CHIP_ERROR TCPBase::ProcessSingleMessage(const PeerAddress & peerAddress, ActiveTCPConnectionState * state, uint16_t messageSize) +CHIP_ERROR TCPBase::ProcessSingleMessage(const PeerAddress & peerAddress, ActiveTCPConnectionState * state, size_t messageSize) { // We enter with `state->mReceived` containing at least one full message, perhaps in a chain. // `state->mReceived->Start()` currently points to the message data. diff --git a/src/transport/raw/TCP.h b/src/transport/raw/TCP.h index 783f3844d2d16d..1cb7aa9634ba16 100644 --- a/src/transport/raw/TCP.h +++ b/src/transport/raw/TCP.h @@ -258,7 +258,7 @@ class DLL_EXPORT TCPBase : public Base * is no other data). * @param[in] messageSize Size of the single message. */ - CHIP_ERROR ProcessSingleMessage(const PeerAddress & peerAddress, ActiveTCPConnectionState * state, uint16_t messageSize); + CHIP_ERROR ProcessSingleMessage(const PeerAddress & peerAddress, ActiveTCPConnectionState * state, size_t messageSize); /** * Initiate a connection to the given peer. On connection completion, @@ -306,10 +306,6 @@ class DLL_EXPORT TCPBase : public Base // giving up. uint32_t mConnectTimeout = CHIP_CONFIG_TCP_CONNECT_TIMEOUT_MSECS; - // The max payload size of data over a TCP connection that is transmissible - // at a time. - uint32_t mMaxTCPPayloadSize = CHIP_CONFIG_MAX_TCP_PAYLOAD_SIZE_BYTES; - // Number of active and 'pending connection' endpoints size_t mUsedEndPointCount = 0; diff --git a/src/transport/raw/TCPConfig.h b/src/transport/raw/TCPConfig.h index d54a9466b4d294..4f95978985fd63 100644 --- a/src/transport/raw/TCPConfig.h +++ b/src/transport/raw/TCPConfig.h @@ -63,15 +63,6 @@ namespace chip { #define CHIP_CONFIG_MAX_TCP_PENDING_PACKETS 4 #endif -/** - * @def CHIP_CONFIG_MAX_TCP_PAYLOAD_SIZE_BYTES - * - * @brief Maximum payload size of a message over a TCP connection - */ -#ifndef CHIP_CONFIG_MAX_TCP_PAYLOAD_SIZE_BYTES -#define CHIP_CONFIG_MAX_TCP_PAYLOAD_SIZE_BYTES 1000000 -#endif - /** * @def CHIP_CONFIG_TCP_CONNECT_TIMEOUT_MSECS * diff --git a/src/transport/raw/tests/TestTCP.cpp b/src/transport/raw/tests/TestTCP.cpp index f5e343f1a2ea79..dbce3b8ce5ef43 100644 --- a/src/transport/raw/tests/TestTCP.cpp +++ b/src/transport/raw/tests/TestTCP.cpp @@ -51,7 +51,7 @@ namespace { constexpr size_t kMaxTcpActiveConnectionCount = 4; constexpr size_t kMaxTcpPendingPackets = 4; -constexpr uint16_t kPacketSizeBytes = static_cast(sizeof(uint16_t)); +constexpr size_t kPacketSizeBytes = sizeof(uint32_t); uint16_t gChipTCPPort = static_cast(CHIP_PORT + chip::Crypto::GetRandU16() % 100); chip::Transport::AppTCPConnectionCallbackCtxt gAppTCPConnCbCtxt; chip::Transport::ActiveTCPConnectionState * gActiveTCPConnState = nullptr; @@ -298,7 +298,7 @@ struct TestData // the last buffer will be made larger. TestData() : mPayload(nullptr), mTotalLength(0), mMessageLength(0), mMessageOffset(0) {} ~TestData() { Free(); } - bool Init(const uint16_t sizes[]); + bool Init(const uint32_t sizes[]); void Free(); bool IsValid() { return !mHandle.IsNull() && (mPayload != nullptr); } @@ -309,7 +309,7 @@ struct TestData size_t mMessageOffset; }; -bool TestData::Init(const uint16_t sizes[]) +bool TestData::Init(const uint32_t sizes[]) { Free(); @@ -325,17 +325,17 @@ bool TestData::Init(const uint16_t sizes[]) mTotalLength += sizes[bufferCount]; } --bufferCount; - uint16_t additionalLength = 0; + uint32_t additionalLength = 0; if (headerLength + kPacketSizeBytes > mTotalLength) { - additionalLength = static_cast((headerLength + kPacketSizeBytes) - mTotalLength); + additionalLength = static_cast((headerLength + kPacketSizeBytes) - mTotalLength); mTotalLength += additionalLength; } - if (mTotalLength > UINT16_MAX) + if (mTotalLength > UINT32_MAX) { return false; } - uint16_t messageLength = static_cast(mTotalLength - kPacketSizeBytes); + uint32_t messageLength = static_cast(mTotalLength - kPacketSizeBytes); // Build the test payload. uint8_t * payload = static_cast(chip::Platform::MemoryCalloc(1, mTotalLength)); @@ -343,7 +343,7 @@ bool TestData::Init(const uint16_t sizes[]) { return false; } - chip::Encoding::LittleEndian::Put16(payload, messageLength); + chip::Encoding::LittleEndian::Put32(payload, messageLength); uint16_t headerSize; CHIP_ERROR err = header.Encode(payload + kPacketSizeBytes, messageLength, &headerSize); if (err != CHIP_NO_ERROR) @@ -363,10 +363,10 @@ bool TestData::Init(const uint16_t sizes[]) System::PacketBufferHandle head = chip::System::PacketBufferHandle::New(sizes[0], 0 /* reserve */); for (int i = 1; i <= bufferCount; ++i) { - uint16_t size = sizes[i]; + size_t size = sizes[i]; if (i == bufferCount) { - size = static_cast(size + additionalLength); + size = size + additionalLength; } chip::System::PacketBufferHandle buffer = chip::System::PacketBufferHandle::New(size, 0 /* reserve */); if (buffer.IsNull()) @@ -395,7 +395,7 @@ bool TestData::Init(const uint16_t sizes[]) if (lToWriteToCurrentBuf != 0) { memcpy(iterator->Start(), writePayload, lToWriteToCurrentBuf); - iterator->SetDataLength(static_cast(iterator->DataLength() + lToWriteToCurrentBuf), head); + iterator->SetDataLength(iterator->DataLength() + lToWriteToCurrentBuf, head); writePayload += lToWriteToCurrentBuf; writeLength -= lToWriteToCurrentBuf; } @@ -634,22 +634,22 @@ TEST_F(TestTCP, CheckProcessReceivedBuffer) // Test a single packet buffer. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 111, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 111, 0 })); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); EXPECT_EQ(err, CHIP_NO_ERROR); EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 1); // Test a message in a chain of three packet buffers. The message length is split across buffers. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 1, 122, 123, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 1, 122, 123, 0 })); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); EXPECT_EQ(err, CHIP_NO_ERROR); EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 1); // Test two messages in a chain. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 131, 0 })); - EXPECT_TRUE(testData[1].Init((const uint16_t[]){ 132, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 131, 0 })); + EXPECT_TRUE(testData[1].Init((const uint32_t[]){ 132, 0 })); testData[0].mHandle->AddToEnd(std::move(testData[1].mHandle)); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); EXPECT_EQ(err, CHIP_NO_ERROR); @@ -657,17 +657,25 @@ TEST_F(TestTCP, CheckProcessReceivedBuffer) // Test a chain of two messages, each a chain. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 141, 142, 0 })); - EXPECT_TRUE(testData[1].Init((const uint16_t[]){ 143, 144, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 141, 142, 0 })); + EXPECT_TRUE(testData[1].Init((const uint32_t[]){ 143, 144, 0 })); testData[0].mHandle->AddToEnd(std::move(testData[1].mHandle)); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); EXPECT_EQ(err, CHIP_NO_ERROR); EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 2); + // Test a single packet buffer that is larger than + // kMaxSizeWithoutReserve but less than CHIP_CONFIG_MAX_LARGE_PAYLOAD_SIZE_BYTES. + gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ System::PacketBuffer::kMaxSizeWithoutReserve + 1, 0 })); + err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 1); + // Test a message that is too large to coalesce into a single packet buffer. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; gMockTransportMgrDelegate.SetCallback(TestDataCallbackCheck, &testData[1]); - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 51, System::PacketBuffer::kMaxSizeWithoutReserve, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 51, CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES, 0 })); // Sending only the first buffer of the long chain. This should be enough to trigger the error. System::PacketBufferHandle head = testData[0].mHandle.PopHead(); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(head)); From 2005be9b4ad626ffd2aa8d30df82ef2f3ec24337 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 Jun 2024 15:30:09 -0400 Subject: [PATCH 061/162] Make subscription latency estimation in MTRDevice a bit less noisy. (#33717) Averages out the new latency with (lower weighted) previous ones. --- src/darwin/Framework/CHIP/MTRDevice.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index dcb6a9acd8da64..01f22543cde160 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -308,6 +308,13 @@ - (BOOL)isEqual:(id)object // happen more often than once every 10 minutes. #define MTRDEVICE_MIN_RESUBSCRIBE_DUE_TO_READ_INTERVAL_SECONDS (10 * 60) +// Weight of new data in determining subscription latencies. To avoid random +// outliers causing too much noise in the value, treat an existing value (if +// any) as having 2/3 weight and the new value as having 1/3 weight. These +// weights are subject to change, if it's determined that different ones give +// better behavior. +#define MTRDEVICE_SUBSCRIPTION_LATENCY_NEW_VALUE_WEIGHT (1.0 / 3.0) + @interface MTRDevice () @property (nonatomic, readonly) os_unfair_lock lock; // protects the caches and device state // protects against concurrent time updates by guarding timeUpdateScheduled flag which manages time updates scheduling, @@ -1014,7 +1021,12 @@ - (void)_handleSubscriptionEstablished // We want time interval from initialSubscribeStart to now, not the other // way around. NSTimeInterval subscriptionLatency = -[initialSubscribeStart timeIntervalSinceNow]; - _estimatedSubscriptionLatency = @(subscriptionLatency); + if (_estimatedSubscriptionLatency == nil) { + _estimatedSubscriptionLatency = @(subscriptionLatency); + } else { + NSTimeInterval newSubscriptionLatencyEstimate = MTRDEVICE_SUBSCRIPTION_LATENCY_NEW_VALUE_WEIGHT * subscriptionLatency + (1 - MTRDEVICE_SUBSCRIPTION_LATENCY_NEW_VALUE_WEIGHT) * _estimatedSubscriptionLatency.doubleValue; + _estimatedSubscriptionLatency = @(newSubscriptionLatencyEstimate); + } [self _storePersistedDeviceData]; } From d3cac0c8771ae2d7c0be89fa69e20dec0f3786e9 Mon Sep 17 00:00:00 2001 From: Philip Gregor <147669098+pgregorr-amazon@users.noreply.github.com> Date: Wed, 5 Jun 2024 13:27:44 -0700 Subject: [PATCH 062/162] Android tv-casting-app v1.3 Commissioner-Generated passcode flow (#33680) * Android tv-casting-app v1.3 Commissioner-Generated passcode flow * Fixing style issues * Fixing style issues 2 * Addressed comments by sharadb-amazon * Fixing style issue * Addressed comments by sharadb-amazon part 2 * Addressed comments by sharadb-amazon part3 * Addressed comments by sharadb-amazon and fix Darwin compile issue --- .../com/chip/casting/app/MainActivity.java | 40 ++- .../casting/ActionSelectorFragment.java | 30 +- ...ationBasicReadVendorIDExampleFragment.java | 25 +- .../casting/ConnectionExampleFragment.java | 258 ++++++++++++++++-- ...ntentLauncherLaunchURLExampleFragment.java | 25 +- .../casting/DiscoveryExampleFragment.java | 40 ++- .../casting/EndpointSelectorExample.java | 23 +- .../matter/casting/InitializationExample.java | 40 ++- ...ubscribeToCurrentStateExampleFragment.java | 24 +- .../com/matter/casting/core/CastingApp.java | 45 ++- .../matter/casting/core/CastingPlayer.java | 111 ++++++-- .../jni/com/matter/casting/core/Endpoint.java | 22 +- .../casting/core/MatterCastingPlayer.java | 132 ++++++--- .../casting/support/CommissionableData.java | 8 + .../support/CommissionerDeclaration.java | 172 ++++++++++++ .../casting/support/ConnectionCallbacks.java | 53 ++++ .../matter/casting/support/DataProvider.java | 8 +- .../IdentificationDeclarationOptions.java | 145 ++++++++++ .../matter/casting/support/TargetAppInfo.java | 25 ++ .../src/main/jni/cpp/core/CastingApp-JNI.cpp | 26 +- .../jni/cpp/core/MatterCastingPlayer-JNI.cpp | 210 +++++++++----- .../jni/cpp/core/MatterCastingPlayer-JNI.h | 20 +- .../main/jni/cpp/support/Converters-JNI.cpp | 176 ++++++++++++ .../src/main/jni/cpp/support/Converters-JNI.h | 25 ++ .../main/jni/cpp/support/MatterCallback-JNI.h | 2 + .../res/layout/custom_passcode_dialog.xml | 39 +++ .../App/app/src/main/res/values/strings.xml | 4 +- examples/tv-casting-app/android/BUILD.gn | 4 + .../linux/simple-app-helper.cpp | 23 +- .../tv-casting-common/core/CastingPlayer.cpp | 83 +++++- .../tv-casting-common/core/CastingPlayer.h | 52 ++-- .../core/ConnectionCallbacks.h | 6 +- .../core/IdentificationDeclarationOptions.h | 21 +- .../support/ChipDeviceEventHandler.cpp | 5 + .../support/ChipDeviceEventHandler.h | 5 + .../UserDirectedCommissioning.h | 1 + .../UserDirectedCommissioningClient.cpp | 12 +- 37 files changed, 1642 insertions(+), 298 deletions(-) create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/res/layout/custom_passcode_dialog.xml diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java index cb04518f5c6259..685dbf2fb6426e 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java @@ -66,9 +66,11 @@ public void handleCommissioningButtonClicked(DiscoveredNodeData commissioner) { } @Override - public void handleConnectionButtonClicked(CastingPlayer castingPlayer) { - Log.i(TAG, "MainActivity.handleConnectionButtonClicked() called"); - showFragment(ConnectionExampleFragment.newInstance(castingPlayer)); + public void handleConnectionButtonClicked( + CastingPlayer castingPlayer, boolean useCommissionerGeneratedPasscode) { + Log.i(TAG, "MainActivity.handleConnectionButtonClicked()"); + showFragment( + ConnectionExampleFragment.newInstance(castingPlayer, useCommissionerGeneratedPasscode)); } @Override @@ -77,26 +79,35 @@ public void handleCommissioningComplete() { } @Override - public void handleConnectionComplete(CastingPlayer castingPlayer) { - Log.i(TAG, "MainActivity.handleConnectionComplete() called "); - showFragment(ActionSelectorFragment.newInstance(castingPlayer)); + public void handleConnectionComplete( + CastingPlayer castingPlayer, boolean useCommissionerGeneratedPasscode) { + Log.i(TAG, "MainActivity.handleConnectionComplete()"); + showFragment( + ActionSelectorFragment.newInstance(castingPlayer, useCommissionerGeneratedPasscode)); } @Override - public void handleContentLauncherLaunchURLSelected(CastingPlayer selectedCastingPlayer) { - showFragment(ContentLauncherLaunchURLExampleFragment.newInstance(selectedCastingPlayer)); + public void handleContentLauncherLaunchURLSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + showFragment( + ContentLauncherLaunchURLExampleFragment.newInstance( + selectedCastingPlayer, useCommissionerGeneratedPasscode)); } @Override - public void handleApplicationBasicReadVendorIDSelected(CastingPlayer selectedCastingPlayer) { - showFragment(ApplicationBasicReadVendorIDExampleFragment.newInstance(selectedCastingPlayer)); + public void handleApplicationBasicReadVendorIDSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + showFragment( + ApplicationBasicReadVendorIDExampleFragment.newInstance( + selectedCastingPlayer, useCommissionerGeneratedPasscode)); } @Override public void handleMediaPlaybackSubscribeToCurrentStateSelected( - CastingPlayer selectedCastingPlayer) { + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { showFragment( - MediaPlaybackSubscribeToCurrentStateExampleFragment.newInstance(selectedCastingPlayer)); + MediaPlaybackSubscribeToCurrentStateExampleFragment.newInstance( + selectedCastingPlayer, useCommissionerGeneratedPasscode)); } @Override @@ -148,7 +159,10 @@ private boolean initJni() { private void showFragment(Fragment fragment, boolean showOnBack) { Log.d( TAG, - "showFragment() called with " + fragment.getClass().getSimpleName() + " and " + showOnBack); + "showFragment() called with: " + + fragment.getClass().getSimpleName() + + ", and showOnBack: " + + showOnBack); FragmentTransaction fragmentTransaction = getSupportFragmentManager() .beginTransaction() diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ActionSelectorFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ActionSelectorFragment.java index cb5d2170e96d6d..a931d1ff3baf44 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ActionSelectorFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ActionSelectorFragment.java @@ -31,14 +31,17 @@ public class ActionSelectorFragment extends Fragment { private static final String TAG = ActionSelectorFragment.class.getSimpleName(); private final CastingPlayer selectedCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private View.OnClickListener selectContentLauncherButtonClickListener; private View.OnClickListener selectApplicationBasicButtonClickListener; private View.OnClickListener selectMediaPlaybackButtonClickListener; private View.OnClickListener disconnectButtonClickListener; - public ActionSelectorFragment(CastingPlayer selectedCastingPlayer) { + public ActionSelectorFragment( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { this.selectedCastingPlayer = selectedCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** @@ -46,10 +49,13 @@ public ActionSelectorFragment(CastingPlayer selectedCastingPlayer) { * parameters. * * @param selectedCastingPlayer CastingPlayer that the casting app connected to + * @param useCommissionerGeneratedPasscode Boolean indicating whether this CastingPlayer was + * commissioned using the Commissioner-Generated passcode commissioning flow. * @return A new instance of fragment SelectActionFragment. */ - public static ActionSelectorFragment newInstance(CastingPlayer selectedCastingPlayer) { - return new ActionSelectorFragment(selectedCastingPlayer); + public static ActionSelectorFragment newInstance( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + return new ActionSelectorFragment(selectedCastingPlayer, useCommissionerGeneratedPasscode); } @Override @@ -64,17 +70,20 @@ public View onCreateView( this.selectContentLauncherButtonClickListener = v -> { Log.d(TAG, "handle() called on selectContentLauncherButtonClickListener"); - callback.handleContentLauncherLaunchURLSelected(selectedCastingPlayer); + callback.handleContentLauncherLaunchURLSelected( + selectedCastingPlayer, useCommissionerGeneratedPasscode); }; this.selectApplicationBasicButtonClickListener = v -> { Log.d(TAG, "handle() called on selectApplicationBasicButtonClickListener"); - callback.handleApplicationBasicReadVendorIDSelected(selectedCastingPlayer); + callback.handleApplicationBasicReadVendorIDSelected( + selectedCastingPlayer, useCommissionerGeneratedPasscode); }; this.selectMediaPlaybackButtonClickListener = v -> { Log.d(TAG, "handle() called on selectMediaPlaybackButtonClickListener"); - callback.handleMediaPlaybackSubscribeToCurrentStateSelected(selectedCastingPlayer); + callback.handleMediaPlaybackSubscribeToCurrentStateSelected( + selectedCastingPlayer, useCommissionerGeneratedPasscode); }; this.disconnectButtonClickListener = @@ -107,13 +116,16 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { /** Interface for notifying the host. */ public interface Callback { /** Notifies listener to trigger transition on selection of Content Launcher cluster */ - void handleContentLauncherLaunchURLSelected(CastingPlayer selectedCastingPlayer); + void handleContentLauncherLaunchURLSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode); /** Notifies listener to trigger transition on selection of Application Basic cluster */ - void handleApplicationBasicReadVendorIDSelected(CastingPlayer selectedCastingPlayer); + void handleApplicationBasicReadVendorIDSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode); /** Notifies listener to trigger transition on selection of Media PLayback cluster */ - void handleMediaPlaybackSubscribeToCurrentStateSelected(CastingPlayer selectedCastingPlayer); + void handleMediaPlaybackSubscribeToCurrentStateSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode); /** Notifies listener to trigger transition on click of the Disconnect button */ void handleDisconnect(); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java index 878c18019f4d09..b64d10ce811332 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java @@ -37,25 +37,32 @@ public class ApplicationBasicReadVendorIDExampleFragment extends Fragment { private static final String TAG = ApplicationBasicReadVendorIDExampleFragment.class.getSimpleName(); + private static final int DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1; private final CastingPlayer selectedCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private View.OnClickListener readButtonClickListener; - public ApplicationBasicReadVendorIDExampleFragment(CastingPlayer selectedCastingPlayer) { + public ApplicationBasicReadVendorIDExampleFragment( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { this.selectedCastingPlayer = selectedCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** * Use this factory method to create a new instance of this fragment using the provided * parameters. * - * @param selectedCastingPlayer CastingPlayer that the casting app connected to + * @param selectedCastingPlayer CastingPlayer that the casting app connected to. + * @param useCommissionerGeneratedPasscode Boolean indicating whether this CastingPlayer was + * commissioned using the Commissioner-Generated Passcode (CGP) commissioning flow. * @return A new instance of fragment ApplicationBasicReadVendorIDExampleFragment. */ public static ApplicationBasicReadVendorIDExampleFragment newInstance( - CastingPlayer selectedCastingPlayer) { - return new ApplicationBasicReadVendorIDExampleFragment(selectedCastingPlayer); + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + return new ApplicationBasicReadVendorIDExampleFragment( + selectedCastingPlayer, useCommissionerGeneratedPasscode); } @Override @@ -68,8 +75,14 @@ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.readButtonClickListener = v -> { - Endpoint endpoint = - EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + Endpoint endpoint; + if (useCommissionerGeneratedPasscode) { + endpoint = + EndpointSelectorExample.selectEndpointById( + selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); + } else { + endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + } if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java index 690a9b02e840bc..1bf95ef4a2d7eb 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java @@ -16,20 +16,27 @@ */ package com.matter.casting; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.EditText; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.R; import com.matter.casting.core.CastingPlayer; -import com.matter.casting.support.EndpointFilter; +import com.matter.casting.support.CommissionerDeclaration; +import com.matter.casting.support.ConnectionCallbacks; +import com.matter.casting.support.IdentificationDeclarationOptions; import com.matter.casting.support.MatterCallback; import com.matter.casting.support.MatterError; +import com.matter.casting.support.TargetAppInfo; import java.util.concurrent.Executors; /** A {@link Fragment} to Verify or establish a connection with a selected Casting Player. */ @@ -37,18 +44,28 @@ public class ConnectionExampleFragment extends Fragment { private static final String TAG = ConnectionExampleFragment.class.getSimpleName(); // Time (in sec) to keep the commissioning window open, if commissioning is required. // Must be >= 3 minutes. - private static final long MIN_CONNECTION_TIMEOUT_SEC = 3 * 60; - private static final Integer DESIRED_ENDPOINT_VENDOR_ID = 65521; + private static final short MIN_CONNECTION_TIMEOUT_SEC = 3 * 60; + private static final Integer DESIRED_TARGET_APP_VENDOR_ID = 65521; + // Use this Target Content Application Vendor ID, configured on the tv-app, to demonstrate the + // CastingPlayer/Commissioner-Generated passcode commissioning flow. + private static final Integer DESIRED_TARGET_APP_VENDOR_ID_FOR_CGP_FLOW = 1111; + private static final long DEFAULT_COMMISSIONER_GENERATED_PASSCODE = 12345678; + private static final int DEFAULT_DISCRIMINATOR_FOR_CGP_FLOW = 0; private final CastingPlayer targetCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private TextView connectionFragmentStatusTextView; private Button connectionFragmentNextButton; - public ConnectionExampleFragment(CastingPlayer targetCastingPlayer) { + public ConnectionExampleFragment( + CastingPlayer targetCastingPlayer, boolean useCommissionerGeneratedPasscode) { Log.i( TAG, - "ConnectionExampleFragment() called with target CastingPlayer ID: " - + targetCastingPlayer.getDeviceId()); + "ConnectionExampleFragment() Target CastingPlayer ID: " + + targetCastingPlayer.getDeviceId() + + ", useCommissionerGeneratedPasscode: " + + useCommissionerGeneratedPasscode); this.targetCastingPlayer = targetCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** @@ -57,21 +74,22 @@ public ConnectionExampleFragment(CastingPlayer targetCastingPlayer) { * * @return A new instance of fragment ConnectionExampleFragment. */ - public static ConnectionExampleFragment newInstance(CastingPlayer castingPlayer) { - Log.i(TAG, "newInstance() called"); - return new ConnectionExampleFragment(castingPlayer); + public static ConnectionExampleFragment newInstance( + CastingPlayer castingPlayer, Boolean useCommissionerGeneratedPasscode) { + Log.i(TAG, "newInstance()"); + return new ConnectionExampleFragment(castingPlayer, useCommissionerGeneratedPasscode); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Log.i(TAG, "onCreate() called"); + Log.i(TAG, "onCreate()"); } @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - Log.i(TAG, "onCreateView() called"); + Log.i(TAG, "onCreateView()"); // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_matter_connection_example, container, false); } @@ -79,23 +97,30 @@ public View onCreateView( @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - Log.i(TAG, "onViewCreated() called"); + Log.i(TAG, "onViewCreated()"); connectionFragmentStatusTextView = getView().findViewById(R.id.connectionFragmentStatusText); - connectionFragmentStatusTextView.setText( - "Verifying or establishing connection with Casting Player with device name: " - + targetCastingPlayer.getDeviceName() - + "\nSetup Passcode: " - + InitializationExample.commissionableDataProvider.get().getSetupPasscode() - + "\nDiscriminator: " - + InitializationExample.commissionableDataProvider.get().getDiscriminator()); + if (useCommissionerGeneratedPasscode) { + connectionFragmentStatusTextView.setText( + "Verifying or establishing connection with Casting Player with device name: " + + targetCastingPlayer.getDeviceName() + + "\n\nAttempting CastingPlayer/Commissioner-Generated passcode commissioning."); + } else { + connectionFragmentStatusTextView.setText( + "Verifying or establishing connection with Casting Player with device name: " + + targetCastingPlayer.getDeviceName() + + "\nClient/Commissionee-Generated Setup Passcode: " + + InitializationExample.commissionableDataProvider.get().getSetupPasscode() + + "\nDiscriminator: " + + InitializationExample.commissionableDataProvider.get().getDiscriminator()); + } connectionFragmentNextButton = getView().findViewById(R.id.connectionFragmentNextButton); Callback callback = (ConnectionExampleFragment.Callback) this.getActivity(); connectionFragmentNextButton.setOnClickListener( v -> { Log.i(TAG, "onViewCreated() NEXT clicked. Calling handleConnectionComplete()"); - callback.handleConnectionComplete(targetCastingPlayer); + callback.handleConnectionComplete(targetCastingPlayer, useCommissionerGeneratedPasscode); }); Executors.newSingleThreadExecutor() @@ -103,25 +128,42 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { () -> { Log.d(TAG, "onViewCreated() calling CastingPlayer.verifyOrEstablishConnection()"); - EndpointFilter desiredEndpointFilter = new EndpointFilter(); - desiredEndpointFilter.vendorId = DESIRED_ENDPOINT_VENDOR_ID; + IdentificationDeclarationOptions idOptions = new IdentificationDeclarationOptions(); + TargetAppInfo targetAppInfo = new TargetAppInfo(); + targetAppInfo.vendorId = DESIRED_TARGET_APP_VENDOR_ID; - MatterError err = - targetCastingPlayer.verifyOrEstablishConnection( - MIN_CONNECTION_TIMEOUT_SEC, - desiredEndpointFilter, + if (useCommissionerGeneratedPasscode) { + idOptions.commissionerPasscode = true; + targetAppInfo.vendorId = DESIRED_TARGET_APP_VENDOR_ID_FOR_CGP_FLOW; + Log.d( + TAG, + "onViewCreated() calling CastingPlayer.verifyOrEstablishConnection() Target Content Application Vendor ID: " + + targetAppInfo.vendorId + + ", useCommissionerGeneratedPasscode: " + + useCommissionerGeneratedPasscode); + } else { + Log.d( + TAG, + "onViewCreated() calling CastingPlayer.verifyOrEstablishConnection() Target Content Application Vendor ID: " + + targetAppInfo.vendorId); + } + + idOptions.addTargetAppInfo(targetAppInfo); + + ConnectionCallbacks connectionCallbacks = + new ConnectionCallbacks( new MatterCallback() { @Override public void handle(Void v) { Log.i( TAG, - "Connected to CastingPlayer with deviceId: " + "Successfully connected to CastingPlayer with deviceId: " + targetCastingPlayer.getDeviceId()); getActivity() .runOnUiThread( () -> { connectionFragmentStatusTextView.setText( - "Connected to Casting Player with device name: " + "Successfully connected to Casting Player with device name: " + targetCastingPlayer.getDeviceName() + "\n\n"); connectionFragmentNextButton.setEnabled(true); @@ -139,7 +181,39 @@ public void handle(MatterError err) { "Casting Player connection failed due to: " + err + "\n\n"); }); } - }); + }, + null); + + // CommissionerDeclaration is only needed for the CastingPlayer/Commissioner-Generated + // passcode commissioning flow. + if (useCommissionerGeneratedPasscode) { + connectionCallbacks.onCommissionerDeclaration = + new MatterCallback() { + @Override + public void handle(CommissionerDeclaration cd) { + Log.i(TAG, "CastingPlayer CommissionerDeclaration message received: "); + cd.logDetail(); + + getActivity() + .runOnUiThread( + () -> { + connectionFragmentStatusTextView.setText( + "CommissionerDeclaration message received from Casting Player: \n\n"); + if (cd.getCommissionerPasscode()) { + + displayPasscodeInputDialog(getActivity()); + + connectionFragmentStatusTextView.setText( + "CommissionerDeclaration message received from Casting Player: A passcode is now displayed for the user by the Casting Player. \n\n"); + } + }); + } + }; + } + + MatterError err = + targetCastingPlayer.verifyOrEstablishConnection( + connectionCallbacks, MIN_CONNECTION_TIMEOUT_SEC, idOptions); if (err.hasError()) { getActivity() @@ -152,9 +226,133 @@ public void handle(MatterError err) { }); } + private void displayPasscodeInputDialog(Context context) { + AlertDialog.Builder builder = new AlertDialog.Builder(context); + + LayoutInflater inflater = LayoutInflater.from(context); + View dialogView = inflater.inflate(R.layout.custom_passcode_dialog, null); + + // Set up the input dialog with the default passcode + final EditText input = dialogView.findViewById(R.id.passcode_input); + input.setText("" + DEFAULT_COMMISSIONER_GENERATED_PASSCODE); + + // Set up the buttons + builder.setPositiveButton( + "Continue Connecting", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + String passcode = input.getText().toString(); + Log.i( + TAG, + "displayPasscodeInputDialog() User entered CastingPlayer/Commissioner-Generated passcode: " + + passcode); + + // Display the user entered passcode on the screen + connectionFragmentStatusTextView.setText( + "Continue Connecting with user entered CastingPlayer/Commissioner-Generated passcode: " + + passcode + + "\n\n"); + + long passcodeLongValue = DEFAULT_COMMISSIONER_GENERATED_PASSCODE; + try { + passcodeLongValue = Long.parseLong(passcode); + Log.i( + TAG, + "displayPasscodeInputDialog() User entered CastingPlayer/Commissioner-Generated passcode: " + + passcodeLongValue); + } catch (NumberFormatException nfe) { + Log.e( + TAG, + "displayPasscodeInputDialog()User entered CastingPlayer/Commissioner-Generated passcode is not a valid integer. NumberFormatException: " + + nfe); + connectionFragmentStatusTextView.setText( + "User entered CastingPlayer/Commissioner-Generated passcode is not a valid integer: " + + passcode + + "\n\n"); + } + + // Update the CommissionableData DataProvider with the user entered + // CastingPlayer/Commissioner-Generated setup passcode. This is mandatory for + // Commissioner-Generated passcode commissioning since the commissioning session's PAKE + // verifier needs to be updated with the entered passcode. + InitializationExample.commissionableDataProvider.updateCommissionableDataSetupPasscode( + passcodeLongValue, DEFAULT_DISCRIMINATOR_FOR_CGP_FLOW); + + Log.i(TAG, "displayPasscodeInputDialog() calling continueConnecting()"); + connectionFragmentStatusTextView = + getView().findViewById(R.id.connectionFragmentStatusText); + connectionFragmentStatusTextView.setText( + "Continuing to connect with Casting Player with device name: " + + targetCastingPlayer.getDeviceName() + + "\nCastingPlayer/Commissioner-Generated Setup Passcode: " + + InitializationExample.commissionableDataProvider.get().getSetupPasscode() + + "\nDiscriminator: " + + InitializationExample.commissionableDataProvider.get().getDiscriminator()); + + MatterError err = targetCastingPlayer.continueConnecting(); + + if (err.hasError()) { + MatterError finalErr = err; + getActivity() + .runOnUiThread( + () -> { + connectionFragmentStatusTextView.setText( + "Casting Player CONTINUE CONNECTING failed due to: " + + finalErr + + "\n\n"); + }); + Log.e( + TAG, + "displayPasscodeInputDialog() continueConnecting() failed, calling stopConnecting() due to: " + + err); + // Since continueConnecting() failed, Attempt to cancel the connection attempt with + // the CastingPlayer/Commissioner. + err = targetCastingPlayer.stopConnecting(); + if (err.hasError()) { + Log.e(TAG, "displayPasscodeInputDialog() stopConnecting() failed due to: " + err); + } + } + } + }); + + builder.setNegativeButton( + "Cancel", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Log.i( + TAG, + "displayPasscodeInputDialog() user cancelled the CastingPlayer/Commissioner-Generated Passcode input dialog. Calling stopConnecting()"); + connectionFragmentStatusTextView.setText( + "Connection attempt with Casting Player cancelled by the user, route back to exit. \n\n"); + MatterError err = targetCastingPlayer.stopConnecting(); + if (err.hasError()) { + MatterError finalErr = err; + getActivity() + .runOnUiThread( + () -> { + connectionFragmentStatusTextView.setText( + "Casting Player CANCEL failed due to: " + finalErr + "\n\n"); + }); + Log.e(TAG, "displayPasscodeInputDialog() stopConnecting() failed due to: " + err); + } + dialog.cancel(); + } + }); + + builder.setView(dialogView); + AlertDialog alertDialog = builder.create(); + alertDialog.show(); + alertDialog + .getWindow() + .setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + } + /** Interface for notifying the host. */ public interface Callback { /** Notifies listener to trigger transition on completion of connection */ - void handleConnectionComplete(CastingPlayer castingPlayer); + void handleConnectionComplete( + CastingPlayer castingPlayer, boolean useCommissionerGeneratedPasscode); } } diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java index ddf41b349d6890..e1cfc4a456112b 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java @@ -37,25 +37,32 @@ public class ContentLauncherLaunchURLExampleFragment extends Fragment { private static final String TAG = ContentLauncherLaunchURLExampleFragment.class.getSimpleName(); private static final Integer SAMPLE_ENDPOINT_VID = 65521; + private static final int DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1; private final CastingPlayer selectedCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private View.OnClickListener launchUrlButtonClickListener; - public ContentLauncherLaunchURLExampleFragment(CastingPlayer selectedCastingPlayer) { + public ContentLauncherLaunchURLExampleFragment( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { this.selectedCastingPlayer = selectedCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** * Use this factory method to create a new instance of this fragment using the provided * parameters. * - * @param selectedCastingPlayer CastingPlayer that the casting app connected to + * @param selectedCastingPlayer CastingPlayer that the casting app connected to. + * @param useCommissionerGeneratedPasscode Boolean indicating whether this CastingPlayer was + * commissioned using the Commissioner-Generated Passcode (CGP) commissioning flow. * @return A new instance of fragment ContentLauncherLaunchURLExampleFragment. */ public static ContentLauncherLaunchURLExampleFragment newInstance( - CastingPlayer selectedCastingPlayer) { - return new ContentLauncherLaunchURLExampleFragment(selectedCastingPlayer); + CastingPlayer selectedCastingPlayer, Boolean useCommissionerGeneratedPasscode) { + return new ContentLauncherLaunchURLExampleFragment( + selectedCastingPlayer, useCommissionerGeneratedPasscode); } @Override @@ -68,8 +75,14 @@ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.launchUrlButtonClickListener = v -> { - Endpoint endpoint = - EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + Endpoint endpoint; + if (useCommissionerGeneratedPasscode) { + endpoint = + EndpointSelectorExample.selectEndpointById( + selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); + } else { + endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + } if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/DiscoveryExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/DiscoveryExampleFragment.java index 65d670584971aa..3dca2320b8924c 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/DiscoveryExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/DiscoveryExampleFragment.java @@ -45,7 +45,7 @@ public class DiscoveryExampleFragment extends Fragment { private static final Long DISCOVERY_TARGET_DEVICE_TYPE = 35L; private static final int DISCOVERY_RUNTIME_SEC = 15; private TextView matterDiscoveryMessageTextView; - private TextView matterDiscoveryErrorMessageTextView; + public static TextView matterDiscoveryErrorMessageTextView; private static final List castingPlayerList = new ArrayList<>(); private static ArrayAdapter arrayAdapter; @@ -221,8 +221,8 @@ public void onPause() { /** Interface for notifying the host. */ public interface Callback { /** Notifies listener of Connection Button click. */ - // TODO: In following PRs. Implement CastingPlayer connection - void handleConnectionButtonClicked(CastingPlayer castingPlayer); + void handleConnectionButtonClicked( + CastingPlayer castingPlayer, boolean useCommissionerGeneratedPasscode); } private boolean startDiscovery() { @@ -320,6 +320,8 @@ public View getView(int i, View view, ViewGroup viewGroup) { Button playerDescription = view.findViewById(R.id.commissionable_player_description); playerDescription.setText(buttonText); + // OnClickListener for the CastingPLayer button, to be used for the Commissionee-Generated + // passcode commissioning flow. View.OnClickListener clickListener = v -> { CastingPlayer castingPlayer = playerList.get(i); @@ -329,9 +331,37 @@ public View getView(int i, View view, ViewGroup viewGroup) { + castingPlayer.getDeviceId()); DiscoveryExampleFragment.Callback onClickCallback = (DiscoveryExampleFragment.Callback) context; - onClickCallback.handleConnectionButtonClicked(castingPlayer); + onClickCallback.handleConnectionButtonClicked(castingPlayer, false); }; playerDescription.setOnClickListener(clickListener); + + // OnLongClickListener for the CastingPLayer button, to be used for the Commissioner-Generated + // passcode commissioning flow. + View.OnLongClickListener longClickListener = + v -> { + CastingPlayer castingPlayer = playerList.get(i); + if (!castingPlayer.getSupportsCommissionerGeneratedPasscode()) { + Log.e( + TAG, + "OnLongClickListener.onLongClick() called for CastingPlayer with deviceId " + + castingPlayer.getDeviceId() + + ". This CastingPlayer does not support Commissioner-Generated passcode commissioning."); + + DiscoveryExampleFragment.matterDiscoveryErrorMessageTextView.setText( + "The selected Casting Player does not support Commissioner-Generated passcode commissioning"); + return true; + } + Log.d( + TAG, + "OnLongClickListener.onLongClick() called for CastingPlayer with deviceId " + + castingPlayer.getDeviceId() + + ", attempting the Commissioner-Generated passcode commissioning flow."); + DiscoveryExampleFragment.Callback onClickCallback = + (DiscoveryExampleFragment.Callback) context; + onClickCallback.handleConnectionButtonClicked(castingPlayer, true); + return true; + }; + playerDescription.setOnLongClickListener(longClickListener); return view; } @@ -353,7 +383,7 @@ private String getCastingPlayerButtonText(CastingPlayer player) { aux += (aux.isEmpty() ? "" : ", ") + "Resolved IP?: " + (player.getIpAddresses().size() > 0); aux += (aux.isEmpty() ? "" : ", ") - + "Supports Commissioner Generated Passcode: " + + "Supports Commissioner-Generated Passcode: " + (player.getSupportsCommissionerGeneratedPasscode()); aux = aux.isEmpty() ? aux : "\n" + aux; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java index c2932c59117c64..5a906d7007d8b5 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java @@ -19,14 +19,33 @@ public static Endpoint selectFirstEndpointByVID(CastingPlayer selectedCastingPla if (selectedCastingPlayer != null) { List endpoints = selectedCastingPlayer.getEndpoints(); if (endpoints == null) { - Log.e(TAG, "No Endpoints found on CastingPlayer"); + Log.e(TAG, "selectFirstEndpointByVID() No Endpoints found on CastingPlayer"); } else { endpoint = endpoints .stream() .filter(e -> SAMPLE_ENDPOINT_VID.equals(e.getVendorId())) .findFirst() - .get(); + .orElse(null); + } + } + return endpoint; + } + + /** + * Returns the Endpoint with the desired endpoint Id in the list of Endpoints associated with the + * selectedCastingPlayer. + */ + public static Endpoint selectEndpointById( + CastingPlayer selectedCastingPlayer, int desiredEndpointId) { + Endpoint endpoint = null; + if (selectedCastingPlayer != null) { + List endpoints = selectedCastingPlayer.getEndpoints(); + if (endpoints == null) { + Log.e(TAG, "selectEndpointById() No Endpoints found on CastingPlayer"); + } else { + endpoint = + endpoints.stream().filter(e -> desiredEndpointId == e.getId()).findFirst().orElse(null); } } return endpoint; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/InitializationExample.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/InitializationExample.java index aa602c79a66a94..6cae9ab8326474 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/InitializationExample.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/InitializationExample.java @@ -28,6 +28,10 @@ public class InitializationExample { private static final String TAG = InitializationExample.class.getSimpleName(); + // Dummy values for commissioning demonstration only. These are hard coded in the example tv-app: + // connectedhomeip/examples/tv-app/tv-common/src/AppTv.cpp + private static final long DUMMY_SETUP_PASSCODE = 20202021; + private static final int DUMMY_DISCRIMINATOR = 3874; /** * DataProvider implementation for the Unique ID that is used by the SDK to generate the Rotating @@ -48,14 +52,32 @@ public byte[] get() { * DataProvider implementation for the Commissioning Data used by the SDK when the CastingApp goes * through commissioning */ - static final DataProvider commissionableDataProvider = - new DataProvider() { - @Override - public CommissionableData get() { - // dummy values for demonstration only - return new CommissionableData(20202021, 3874); - } - }; + public static class CommissionableDataProvider implements DataProvider { + CommissionableData commissionableData = + new CommissionableData(DUMMY_SETUP_PASSCODE, DUMMY_DISCRIMINATOR); + + @Override + public CommissionableData get() { + return commissionableData; + } + + /** + * Must be implemented in the CommissionableData DataProvider if the + * CastingPlayer/Commissioner-Generated passcode commissioning flow is going to be used. In this + * flow, the setup passcode is generated by the Commissioner and entered by the user in the + * tv-casting-app CX. Once it is obtained, this function should be called with the + * Commissioner-Generated passcode to update the CommissionableData DataProvider in + * AppParameters. + */ + public void updateCommissionableDataSetupPasscode(long setupPasscode, int discriminator) { + Log.i(TAG, "DataProvider::updateCommissionableDataSetupPasscode()"); + commissionableData.setSetupPasscode(setupPasscode); + commissionableData.setDiscriminator(discriminator); + } + }; + + public static CommissionableDataProvider commissionableDataProvider = + new CommissionableDataProvider(); /** * DACProvider implementation for the Device Attestation Credentials required at the time of @@ -70,7 +92,7 @@ public CommissionableData get() { */ public static MatterError initAndStart(Context applicationContext) { // Create an AppParameters object to pass in global casting parameters to the SDK - final AppParameters appParameters = + AppParameters appParameters = new AppParameters( applicationContext, new DataProvider() { diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java index 77f5129b6b9e4d..cd5bbba14af2ed 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java @@ -40,26 +40,33 @@ public class MediaPlaybackSubscribeToCurrentStateExampleFragment extends Fragment { private static final String TAG = MediaPlaybackSubscribeToCurrentStateExampleFragment.class.getSimpleName(); + private static final int DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1; private final CastingPlayer selectedCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private View.OnClickListener subscribeButtonClickListener; private View.OnClickListener shutdownSubscriptionsButtonClickListener; - public MediaPlaybackSubscribeToCurrentStateExampleFragment(CastingPlayer selectedCastingPlayer) { + public MediaPlaybackSubscribeToCurrentStateExampleFragment( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { this.selectedCastingPlayer = selectedCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** * Use this factory method to create a new instance of this fragment using the provided * parameters. * - * @param selectedCastingPlayer CastingPlayer that the casting app connected to + * @param selectedCastingPlayer CastingPlayer that the casting app connected to. + * @param useCommissionerGeneratedPasscode Boolean indicating whether this CastingPlayer was + * commissioned using the Commissioner-Generated Passcode (CGP) commissioning flow. * @return A new instance of fragment MediaPlaybackSubscribeToCurrentStateExampleFragment. */ public static MediaPlaybackSubscribeToCurrentStateExampleFragment newInstance( - CastingPlayer selectedCastingPlayer) { - return new MediaPlaybackSubscribeToCurrentStateExampleFragment(selectedCastingPlayer); + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + return new MediaPlaybackSubscribeToCurrentStateExampleFragment( + selectedCastingPlayer, useCommissionerGeneratedPasscode); } @Override @@ -70,7 +77,14 @@ public void onCreate(Bundle savedInstanceState) { @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - Endpoint endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + Endpoint endpoint; + if (useCommissionerGeneratedPasscode) { + endpoint = + EndpointSelectorExample.selectEndpointById( + selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); + } else { + endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + } if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return inflater.inflate( diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingApp.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingApp.java index f79eab859a8ce3..8b99fefcfa50f8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingApp.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingApp.java @@ -46,6 +46,7 @@ public final class CastingApp { private AppParameters appParameters; private NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState; private ChipAppServer chipAppServer; + private AndroidChipPlatform chipPlatform; private CastingApp() {} @@ -62,7 +63,7 @@ public static CastingApp getInstance() { * @param appParameters */ public MatterError initialize(AppParameters appParameters) { - Log.i(TAG, "CastingApp.initialize called"); + Log.i(TAG, "CastingApp.initialize() called"); if (mState != CastingAppState.UNINITIALIZED) { return MatterError.CHIP_ERROR_INCORRECT_STATE; } @@ -72,7 +73,7 @@ public MatterError initialize(AppParameters appParameters) { new NsdManagerServiceResolver.NsdManagerResolverAvailState(); Context applicationContext = appParameters.getApplicationContext(); - AndroidChipPlatform chipPlatform = + chipPlatform = new AndroidChipPlatform( new AndroidBleManager(), new PreferencesKeyValueStoreManager(appParameters.getApplicationContext()), @@ -83,6 +84,34 @@ public MatterError initialize(AppParameters appParameters) { new ChipMdnsCallbackImpl(), new DiagnosticDataProviderImpl(applicationContext)); + MatterError err = updateAndroidChipPlatformWithCommissionableData(); + if (err.hasError()) { + Log.e( + TAG, + "CastingApp.initialize() failed to updateCommissionableDataProviderData() on AndroidChipPlatform"); + return err; + } + + err = finishInitialization(appParameters); + + if (err.hasNoError()) { + chipAppServer = new ChipAppServer(); // get a reference to the Matter server now + mState = CastingAppState.NOT_RUNNING; // initialization done, set state to NOT_RUNNING + } + return err; + } + + /** + * Updates the Android CHIP platform with the CommissionableData. This function retrieves + * commissionable data from the AppParameters and updates the Android CHIP platform using this + * data. The commissionable data includes information such as the SPAKE2+ verifier, salt, + * iteration count, setup passcode, and discriminator. + * + * @return MatterError.NO_ERROR if the update was successful, + * MatterError.CHIP_ERROR_INVALID_ARGUMENT otherwise. + */ + MatterError updateAndroidChipPlatformWithCommissionableData() { + Log.i(TAG, "CastingApp.updateAndroidChipPlatformWithCommissionableData()"); CommissionableData commissionableData = appParameters.getCommissionableDataProvider().get(); boolean updated = chipPlatform.updateCommissionableDataProviderData( @@ -93,17 +122,11 @@ public MatterError initialize(AppParameters appParameters) { commissionableData.getDiscriminator()); if (!updated) { Log.e( - TAG, "CastingApp.initApp failed to updateCommissionableDataProviderData on chipPlatform"); + TAG, + "CastingApp.updateAndroidChipPlatformWithCommissionableData() failed to updateCommissionableDataProviderData() on AndroidChipPlatform"); return MatterError.CHIP_ERROR_INVALID_ARGUMENT; } - - MatterError err = finishInitialization(appParameters); - - if (err.hasNoError()) { - chipAppServer = new ChipAppServer(); // get a reference to the Matter server now - mState = CastingAppState.NOT_RUNNING; // initialization done, set state to NOT_RUNNING - } - return err; + return MatterError.NO_ERROR; } /** diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java index 3c3a74032bd313..d7ba6f00f9888f 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java @@ -16,14 +16,14 @@ */ package com.matter.casting.core; -import com.matter.casting.support.EndpointFilter; -import com.matter.casting.support.MatterCallback; +import com.matter.casting.support.ConnectionCallbacks; +import com.matter.casting.support.IdentificationDeclarationOptions; import com.matter.casting.support.MatterError; import java.net.InetAddress; import java.util.List; /** - * The CastingPlayer interface defines a Matter commissioner that is able to play media to a + * The CastingPlayer interface defines a Matter Commissioner that is able to play media to a * physical output or to a display screen which is part of the device (e.g. TV). It is discovered on * the local network using Matter Commissioner discovery over DNS. It contains all the information * about the service discovered/resolved. @@ -63,39 +63,92 @@ public interface CastingPlayer { int hashCode(); /** - * Verifies that a connection exists with this CastingPlayer, or triggers a new session request. - * If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on - * disk, this will execute the user directed commissioning process. - * + * @brief Verifies that a connection exists with this CastingPlayer, or triggers a new + * commissioning session request. If the CastingApp does not have the nodeId and fabricIndex + * of this CastingPlayer cached on disk, this will execute the User Directed Commissioning + * (UDC) process by sending an IdentificationDeclaration message to the Commissioner. For + * certain UDC features, where a Commissioner reply is expected, this API needs to be followed + * up with the continueConnecting() API defiend below. See the Matter UDC specification or + * parameter class definitions for details on features not included in the description below. + * @param connectionCallbacks contains the onSuccess (Required), onFailure (Required) and + * onCommissionerDeclaration (Optional) callbacks defiend in ConnectCallbacks.java. + *

For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the + * Commissioner replies with a CommissionerDeclaration message with PasscodeDialogDisplayed + * and CommissionerPasscode set to true. Given these Commissioner state details, the client is + * expected to perform some actions, detailed in the continueConnecting() API below, and then + * call the continueConnecting() API to complete the process. * @param commissioningWindowTimeoutSec (Optional) time (in sec) to keep the commissioning window - * open, if commissioning is required. Needs to be >= MIN_CONNECTION_TIMEOUT_SEC. - * @param desiredEndpointFilter (Optional) Attributes (such as VendorId) describing an Endpoint - * that the client wants to interact with after commissioning. If this value is passed in, the - * VerifyOrEstablishConnection will force User Directed Commissioning, in case the desired - * Endpoint is not found in the on device CastingStore. - * @param successCallback called when the connection is established successfully - * @param failureCallback called with MatterError when the connection is fails to establish - * @return MatterError - Matter.NO_ERROR if request submitted successfully, otherwise a - * MatterError object corresponding to the error + * open, if commissioning is required. Needs to be >= kCommissioningWindowTimeoutSec. + * @param idOptions (Optional) Parameters in the IdentificationDeclaration message sent by the + * Commissionee to the Commissioner. These parameters specify the information relating to the + * requested commissioning session. + *

For example: To invoke the CastingPlayer/Commissioner-Generated passcode commissioning + * flow, the client would call this API with IdentificationDeclarationOptions containing + * CommissionerPasscode set to true. See IdentificationDeclarationOptions.java for a complete + * list of optional parameters. + *

Furthermore, attributes (such as VendorId) describe the TargetApp that the client wants + * to interact with after commissioning. If this value is passed in, + * verifyOrEstablishConnection() will force UDC, in case the desired TargetApp is not found in + * the on-device CastingStore. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. */ MatterError verifyOrEstablishConnection( - long commissioningWindowTimeoutSec, - EndpointFilter desiredEndpointFilter, - MatterCallback successCallback, - MatterCallback failureCallback); + ConnectionCallbacks connectionCallbacks, + short commissioningWindowTimeoutSec, + IdentificationDeclarationOptions idOptions); /** - * Verifies that a connection exists with this CastingPlayer, or triggers a new session request. - * If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on - * disk, this will execute the user directed commissioning process. + * The simplified version of the verifyOrEstablishConnection() API above. * - * @param successCallback called when the connection is established successfully - * @param failureCallback called with MatterError when the connection is fails to establish - * @return MatterError - Matter.NO_ERROR if request submitted successfully, otherwise a - * MatterError object corresponding to the error + * @param connectionCallbacks contains the onSuccess (Required), onFailure (Required) and + * onCommissionerDeclaration (Optional) callbacks defiend in ConnectCallbacks.java. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. */ - MatterError verifyOrEstablishConnection( - MatterCallback successCallback, MatterCallback failureCallback); + MatterError verifyOrEstablishConnection(ConnectionCallbacks connectionCallbacks); + + /** + * @brief This is a continuation of the CastingPlayer/Commissioner-Generated passcode + * commissioning flow started via the verifyOrEstablishConnection() API above. It continues + * the UDC process by sending a second IdentificationDeclaration message to Commissioner + * containing CommissionerPasscode and CommissionerPasscodeReady set to true. At this point it + * is assumed that the following have occurred: + *

1. Client (Commissionee) has sent the first IdentificationDeclaration message, via + * verifyOrEstablishConnection(), to the Commissioner containing CommissionerPasscode set to + * true. + *

2. Commissioner generated and displayed a passcode. + *

3. The Commissioner replied with a CommissionerDecelration message with + * PasscodeDialogDisplayed and CommissionerPasscode set to true. + *

4. Client has handled the Commissioner's CommissionerDecelration message. + *

5. Client prompted user to input Passcode from Commissioner. + *

6. Client has updated the CastingApp's AppParameters DataProvider + * via the following function call: DataProvider.updateCommissionableDataSetupPasscode(long + * setupPasscode, int discriminator). This allows continueConnecting() to update the + * commissioning session's PAKE verifier with the user entered passcode. + *

Note: The same connectionCallbacks and commissioningWindowTimeoutSec parameters passed + * into verifyOrEstablishConnection() will be used. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. + */ + MatterError continueConnecting(); + + MatterError continueConnectingNative(); + + /** + * @brief This cancels the CastingPlayer/Commissioner-Generated passcode commissioning flow + * started via the VerifyOrEstablishConnection() API above. It constructs and sends an + * IdentificationDeclaration message to the CastingPlayer/Commissioner containing + * CancelPasscode set to true. It is used to indicate that the user, and thus the + * Client/Commissionee, have cancelled the commissioning process. This indicates that the + * CastingPlayer/Commissioner can dismiss any dialogs corresponding to commissioning, such as + * a Passcode input dialog or a Passcode display dialog. + *

Note: stopConnecting() does not call the onSuccess() callback passed to the + * VerifyOrEstablishConnection() API above since no connection is established. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. + */ + MatterError stopConnecting(); /** @brief Sets the internal connection state of this CastingPlayer to "disconnected" */ void disconnect(); diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/Endpoint.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/Endpoint.java index f906b80235700c..d98ee77d5d3806 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/Endpoint.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/Endpoint.java @@ -1,20 +1,16 @@ -/* - * Copyright (c) 2024 Project CHIP Authors - * All rights reserved. +/** + * Copyright (c) 2024 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 + *

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 + *

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. + *

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. */ - package com.matter.casting.core; import chip.devicecontroller.ChipClusters; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java index a4f03a00e4f5a2..29ee17e26db8be 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java @@ -16,15 +16,16 @@ */ package com.matter.casting.core; -import com.matter.casting.support.EndpointFilter; -import com.matter.casting.support.MatterCallback; +import android.util.Log; +import com.matter.casting.support.ConnectionCallbacks; +import com.matter.casting.support.IdentificationDeclarationOptions; import com.matter.casting.support.MatterError; import java.net.InetAddress; import java.util.List; import java.util.Objects; /** - * A Matter Casting Player represents a Matter commissioner that is able to play media to a physical + * A Matter Casting Player represents a Matter Commissioner that is able to play media to a physical * output or to a display screen which is part of the device (e.g. TV). It is discovered on the * local network using Matter Commissioner discovery over DNS. It contains all the information about * the service discovered/resolved. @@ -35,7 +36,7 @@ public class MatterCastingPlayer implements CastingPlayer { * Time (in sec) to keep the commissioning window open, if commissioning is required. Must be >= 3 * minutes. */ - public static final long MIN_CONNECTION_TIMEOUT_SEC = 3 * 60; + public static final short MIN_CONNECTION_TIMEOUT_SEC = 3 * 60; private boolean connected; private String deviceId; @@ -162,49 +163,108 @@ public boolean equals(Object o) { } /** - * Verifies that a connection exists with this CastingPlayer, or triggers a new session request. - * If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on - * disk, this will execute the user directed commissioning process. - * + * @brief Verifies that a connection exists with this CastingPlayer, or triggers a new + * commissioning session request. If the CastingApp does not have the nodeId and fabricIndex + * of this CastingPlayer cached on disk, this will execute the User Directed Commissioning + * (UDC) process by sending an IdentificationDeclaration message to the Commissioner. For + * certain UDC features, where a Commissioner reply is expected, this API needs to be followed + * up with the continueConnecting() API defiend below. See the Matter UDC specification or + * parameter class definitions for details on features not included in the description below. + * @param connectionCallbacks contains the onSuccess (Required), onFailure (Required) and + * onCommissionerDeclaration (Optional) callbacks defiend in ConnectCallbacks.java. + *

For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the + * Commissioner replies with a CommissionerDeclaration message with PasscodeDialogDisplayed + * and CommissionerPasscode set to true. Given these Commissioner state details, the client is + * expected to perform some actions, detailed in the continueConnecting() API below, and then + * call the continueConnecting() API to complete the process. * @param commissioningWindowTimeoutSec (Optional) time (in sec) to keep the commissioning window - * open, if commissioning is required. Needs to be >= MIN_CONNECTION_TIMEOUT_SEC. - * @param desiredEndpointFilter (Optional) Attributes (such as VendorId) describing an Endpoint - * that the client wants to interact with after commissioning. If this value is passed in, the - * VerifyOrEstablishConnection will force User Directed Commissioning, in case the desired - * Endpoint is not found in the on device CastingStore. - * @return A CompletableFuture that completes when the VerifyOrEstablishConnection is completed. - * The CompletableFuture will be completed with a Void value if the - * VerifyOrEstablishConnection is successful. Otherwise, the CompletableFuture will be - * completed with an Exception. The Exception will be of type - * com.matter.casting.core.CastingException. If the VerifyOrEstablishConnection fails, the - * CastingException will contain the error code and message from the CastingApp. + * open, if commissioning is required. Needs to be >= kCommissioningWindowTimeoutSec. + * @param idOptions (Optional) Parameters in the IdentificationDeclaration message sent by the + * Commissionee to the Commissioner. These parameters specify the information relating to the + * requested commissioning session. + *

For example: To invoke the CastingPlayer/Commissioner-Generated passcode commissioning + * flow, the client would call this API with IdentificationDeclarationOptions containing + * CommissionerPasscode set to true. See IdentificationDeclarationOptions.java for a complete + * list of optional parameters. + *

Furthermore, attributes (such as VendorId) describe the TargetApp that the client wants + * to interact with after commissioning. If this value is passed in, + * verifyOrEstablishConnection() will force UDC, in case the desired TargetApp is not found in + * the on-device CastingStore. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. */ @Override public native MatterError verifyOrEstablishConnection( - long commissioningWindowTimeoutSec, - EndpointFilter desiredEndpointFilter, - MatterCallback successCallback, - MatterCallback failureCallback); + ConnectionCallbacks connectionCallbacks, + short commissioningWindowTimeoutSec, + IdentificationDeclarationOptions idOptions); /** - * Verifies that a connection exists with this CastingPlayer, or triggers a new session request. - * If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on - * disk, this will execute the user directed commissioning process. + * The simplified version of the verifyOrEstablishConnection() API above. * - * @return A CompletableFuture that completes when the VerifyOrEstablishConnection is completed. - * The CompletableFuture will be completed with a Void value if the - * VerifyOrEstablishConnection is successful. Otherwise, the CompletableFuture will be - * completed with an Exception. The Exception will be of type - * com.matter.casting.core.CastingException. If the VerifyOrEstablishConnection fails, the - * CastingException will contain the error code and message from the CastingApp. + * @param connectionCallbacks contains the onSuccess (Required), onFailure (Required) and + * onCommissionerDeclaration (Optional) callbacks defiend in ConnectCallbacks.java. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. */ @Override - public MatterError verifyOrEstablishConnection( - MatterCallback successCallback, MatterCallback failureCallback) { - return verifyOrEstablishConnection( - MIN_CONNECTION_TIMEOUT_SEC, null, successCallback, failureCallback); + public MatterError verifyOrEstablishConnection(ConnectionCallbacks connectionCallbacks) { + Log.d(TAG, "verifyOrEstablishConnection() (ConnectionCallbacks)"); + return verifyOrEstablishConnection(connectionCallbacks, MIN_CONNECTION_TIMEOUT_SEC, null); + } + + /** + * @brief This is a continuation of the CastingPlayer/Commissioner-Generated passcode + * commissioning flow started via the verifyOrEstablishConnection() API above. It continues + * the UDC process by sending a second IdentificationDeclaration message to Commissioner + * containing CommissionerPasscode and CommissionerPasscodeReady set to true. At this point it + * is assumed that the following have occurred: + *

1. Client (Commissionee) has sent the first IdentificationDeclaration message, via + * verifyOrEstablishConnection(), to the Commissioner containing CommissionerPasscode set to + * true. + *

2. Commissioner generated and displayed a passcode. + *

3. The Commissioner replied with a CommissionerDecelration message with + * PasscodeDialogDisplayed and CommissionerPasscode set to true. + *

4. Client has handled the Commissioner's CommissionerDecelration message. + *

5. Client prompted user to input Passcode from Commissioner. + *

6. Client has updated the CastingApp's AppParameters DataProvider + * via the following function call: DataProvider.updateCommissionableDataSetupPasscode(long + * setupPasscode, int discriminator). This allows continueConnecting() to update the + * commissioning session's PAKE verifier with the user entered passcode. + *

Note: The same connectionCallbacks and commissioningWindowTimeoutSec parameters passed + * into verifyOrEstablishConnection() will be used. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. + */ + public MatterError continueConnecting() { + Log.d(TAG, "continueConnecting()"); + // Update AndroidChipPlatform's CommissionableData with the user entered passcode. + MatterError err = CastingApp.getInstance().updateAndroidChipPlatformWithCommissionableData(); + if (err != MatterError.NO_ERROR) { + Log.e(TAG, "continueConnecting() Error updating AndroidChipPlatform with CommissionableData"); + return err; + } + Log.d(TAG, "continueConnecting() calling continueConnectingNative()"); + return continueConnectingNative(); } + public native MatterError continueConnectingNative(); + + /** + * @brief This cancels the CastingPlayer/Commissioner-Generated passcode commissioning flow + * started via the VerifyOrEstablishConnection() API above. It constructs and sends an + * IdentificationDeclaration message to the CastingPlayer/Commissioner containing + * CancelPasscode set to true. It is used to indicate that the user, and thus the + * Client/Commissionee, have cancelled the commissioning process. This indicates that the + * CastingPlayer/Commissioner can dismiss any dialogs corresponding to commissioning, such as + * a Passcode input dialog or a Passcode display dialog. + *

Note: stopConnecting() does not call the onSuccess() callback passed to the + * VerifyOrEstablishConnection() API above since no connection is established. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. + */ + public native MatterError stopConnecting(); + @Override public native void disconnect(); } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionableData.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionableData.java index b436c98c533786..cafa42919a121f 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionableData.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionableData.java @@ -39,10 +39,18 @@ public long getSetupPasscode() { return setupPasscode; } + public void setSetupPasscode(long setupPasscode) { + this.setupPasscode = setupPasscode; + } + public int getDiscriminator() { return discriminator; } + public void setDiscriminator(int discriminator) { + this.discriminator = discriminator; + } + @Nullable public String getSpake2pVerifierBase64() { return spake2pVerifierBase64; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java new file mode 100644 index 00000000000000..82213a3a69517d --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java @@ -0,0 +1,172 @@ +/** + * Copyright (c) 2024 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. + */ +package com.matter.casting.support; + +import android.util.Log; + +/** + * Represents the Commissioner Declaration message sent by a User Directed Commissioning server + * (CastingPlayer/Commissioner) to a UDC client (Casting Client/Commissionee). + */ +public class CommissionerDeclaration { + static final String TAG = CommissionerDeclaration.class.getSimpleName(); + + /** The allowed values for the ErrorCode field are the following */ + public enum CdError { + kNoError(0), + kCommissionableDiscoveryFailed(1), + kPaseConnectionFailed(2), + kPaseAuthFailed(3), + kDacValidationFailed(4), + kAlreadyOnFabric(5), + kOperationalDiscoveryFailed(6), + kCaseConnectionFailed(7), + kCaseAuthFailed(8), + kConfigurationFailed(9), + kBindingConfigurationFailed(10), + kCommissionerPasscodeNotSupported(11), + kInvalidIdentificationDeclarationParams(12), + kAppInstallConsentPending(13), + kAppInstalling(14), + kAppInstallFailed(15), + kAppInstalledRetryNeeded(16), + kCommissionerPasscodeDisabled(17), + kUnexpectedCommissionerPasscodeReady(18); + private final int value; + + CdError(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + /** Feature: All - Indicates errors incurred during commissioning. */ + private CdError errorCode = CdError.kNoError; + /** + * Feature: Coordinate PIN Dialogs - When NoPasscode field set to true, and the Commissioner + * determines that a Passcode code will be needed for commissioning. + */ + private boolean needsPasscode = false; + /** + * Feature: Target Content Application - No apps with AccountLogin cluster implementation were + * found for the last IdentificationDeclaration request. Only apps which provide access to the + * vendor id of the Commissionee will be considered. + */ + private boolean noAppsFound = false; + /** + * Feature: Coordinate PIN Dialogs - A Passcode input dialog is now displayed for the user on the + * Commissioner. + */ + private boolean passcodeDialogDisplayed = false; + /** + * Feature: Commissioner-Generated Passcode - A Passcode is now displayed for the user by the + * CastingPlayer/Commissioner. + */ + private boolean commissionerPasscode = false; + /** + * Feature: Commissioner-Generated Passcode - The user experience conveying a Passcode to the user + * also displays a QR code. + */ + private boolean qRCodeDisplayed = false; + + public CommissionerDeclaration( + int errorCode, + boolean needsPasscode, + boolean noAppsFound, + boolean passcodeDialogDisplayed, + boolean commissionerPasscode, + boolean qRCodeDisplayed) { + this.errorCode = CdError.values()[errorCode]; + this.needsPasscode = needsPasscode; + this.noAppsFound = noAppsFound; + this.passcodeDialogDisplayed = passcodeDialogDisplayed; + this.commissionerPasscode = commissionerPasscode; + this.qRCodeDisplayed = qRCodeDisplayed; + } + + public void setErrorCode(CdError errorCode) { + this.errorCode = errorCode; + } + + public CdError getErrorCode() { + return this.errorCode; + } + + public void setNeedsPasscode(boolean needsPasscode) { + this.needsPasscode = needsPasscode; + } + + public boolean getNeedsPasscode() { + return this.needsPasscode; + } + + public void setNoAppsFound(boolean noAppsFound) { + this.noAppsFound = noAppsFound; + } + + public boolean getNoAppsFound() { + return this.noAppsFound; + } + + public void setPasscodeDialogDisplayed(boolean passcodeDialogDisplayed) { + this.passcodeDialogDisplayed = passcodeDialogDisplayed; + } + + public boolean getPasscodeDialogDisplayed() { + return this.passcodeDialogDisplayed; + } + + public void setCommissionerPasscode(boolean commissionerPasscode) { + this.commissionerPasscode = commissionerPasscode; + } + + public boolean getCommissionerPasscode() { + return this.commissionerPasscode; + } + + public void setQRCodeDisplayed(boolean qRCodeDisplayed) { + this.qRCodeDisplayed = qRCodeDisplayed; + } + + public boolean getQRCodeDisplayed() { + return this.qRCodeDisplayed; + } + + @Override + public String toString() { + return "CommissionerDeclaration::errorCode: " + + errorCode.name() + + "\n" + + "CommissionerDeclaration::needsPasscode: " + + needsPasscode + + "\n" + + "CommissionerDeclaration::noAppsFound: " + + noAppsFound + + "\n" + + "CommissionerDeclaration::passcodeDialogDisplayed: " + + passcodeDialogDisplayed + + "\n" + + "CommissionerDeclaration:commissionerPasscode: " + + commissionerPasscode + + "\n" + + "CommissionerDeclaration::qRCodeDisplayed: " + + qRCodeDisplayed; + } + + public void logDetail() { + Log.d(TAG, "CommissionerDeclaration::logDetail()\n" + this.toString()); + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java new file mode 100644 index 00000000000000..3d4152bf106cce --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2024 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. + */ +package com.matter.casting.support; + +/** @brief A container struct for User Directed Commissioning (UDC) callbacks. */ +public class ConnectionCallbacks { + + /** (Required) The callback called when the connection is established successfully. */ + public final MatterCallback onSuccess; + + /** (Required) The callback called with MatterError when the connection is fails to establish. */ + public final MatterCallback onFailure; + + /** + * (Optional) The callback called when the Client/Commissionee receives a CommissionerDeclaration + * message from the CastingPlayer/Commissioner. This callback is needed to support UDC features + * where a reply from the Commissioner is expected. It provides information indicating the + * Commissioner’s pre-commissioning state. + */ + public MatterCallback onCommissionerDeclaration; + + public ConnectionCallbacks( + MatterCallback onSuccess, + MatterCallback onFailure, + MatterCallback onCommissionerDeclaration) { + this.onSuccess = onSuccess; + this.onFailure = onFailure; + this.onCommissionerDeclaration = onCommissionerDeclaration; + } + + public MatterCallback getOnSuccess() { + return onSuccess; + } + + public MatterCallback getOnFailure() { + return onFailure; + } + + public MatterCallback getOnCommissionerDeclaration() { + return onCommissionerDeclaration; + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java index eb701413bcd477..854cf76ce8aca8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java @@ -19,15 +19,15 @@ import android.util.Log; -public abstract class DataProvider { - private static final String TAG = DataProvider.class.getSimpleName(); +public interface DataProvider { + public static final String TAG = DataProvider.class.getSimpleName(); - protected T _get() { + default T _get() { T val = null; try { val = get(); } catch (Throwable t) { - Log.e(TAG, "DataProvider::Caught an unhandled Throwable from the client: " + t); + Log.e(TAG, "DataProvider::_get() Caught an unhandled Throwable from the client: " + t); } return val; } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java new file mode 100644 index 00000000000000..18567374c66a17 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) 2024 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. + */ +package com.matter.casting.support; + +import android.util.Log; +import java.util.ArrayList; +import java.util.List; + +/** + * This class contains the optional parameters used in the IdentificationDeclaration Message, sent + * by the Commissionee to the Commissioner. The options specify information relating to the + * requested UDC commissioning session. + */ +public class IdentificationDeclarationOptions { + private final String TAG = IdentificationDeclarationOptions.class.getSimpleName(); + private final short CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS = + getChipDeviceConfigUdcMaxTargetApps(); + + public IdentificationDeclarationOptions() {} + + public IdentificationDeclarationOptions( + boolean noPasscode, + boolean cdUponPasscodeDialog, + boolean commissionerPasscode, + boolean commissionerPasscodeReady, + boolean cancelPasscode, + List targetAppInfos) { + this.noPasscode = noPasscode; + this.cdUponPasscodeDialog = cdUponPasscodeDialog; + this.commissionerPasscode = commissionerPasscode; + this.commissionerPasscodeReady = commissionerPasscodeReady; + this.cancelPasscode = cancelPasscode; + this.targetAppInfos = targetAppInfos != null ? targetAppInfos : new ArrayList<>(); + } + + /** + * @brief Gets the maximum number of Target Content Apps that can be added to the + * IdentificationDeclarationOptions.java TargetAppInfo list from + * connectedhomeip/examples/tv-casting-app/tv-casting-common/include/CHIPProjectAppConfig.h. + * See this file for details. + */ + private native short getChipDeviceConfigUdcMaxTargetApps(); + + /** + * Feature: Target Content Application - Flag to instruct the Commissioner not to display a + * Passcode input dialog, and instead send a CommissionerDeclaration message if a commissioning + * Passcode is needed. + */ + public boolean noPasscode = false; + /** + * Feature: Coordinate Passcode Dialogs - Flag to instruct the Commissioner to send a + * CommissionerDeclaration message when the Passcode input dialog on the Commissioner has been + * shown to the user. + */ + public boolean cdUponPasscodeDialog = false; + /** + * Feature: Commissioner-Generated Passcode - Flag to instruct the Commissioner to use the + * Commissioner-generated Passcode for commissioning. + */ + public boolean commissionerPasscode = false; + /** + * Feature: Commissioner-Generated Passcode - Flag to indicate whether or not the Commissionee has + * obtained the Commissioner Passcode from the user and is therefore ready for commissioning. + */ + public boolean commissionerPasscodeReady = false; + /** + * Feature: Coordinate Passcode Dialogs Flag - to indicate when the Commissionee user has decided + * to exit the commissioning process. + */ + public boolean cancelPasscode = false; + /** + * Feature: Target Content Application - The set of content app Vendor IDs (and optionally, + * Product IDs) that can be used for authentication. Also, if TargetAppInfo is passed in, + * VerifyOrEstablishConnection() will force User Directed Commissioning, in case the desired + * TargetApp is not found in the on-device CastingStore. + */ + private List targetAppInfos = new ArrayList<>(); + + /** + * @brief Adds a TargetAppInfo to the IdentificationDeclarationOptions.java TargetAppInfos list, + * up to a maximum of CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS. + */ + public boolean addTargetAppInfo(TargetAppInfo targetAppInfo) { + Log.d(TAG, "addTargetAppInfo()"); + if (targetAppInfos.size() >= CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS) { + Log.e( + TAG, + "addTargetAppInfo() failed to add TargetAppInfo, max list size is: " + + CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS); + return false; + } + targetAppInfos.add(targetAppInfo); + return true; + } + + public List getTargetAppInfoList() { + return targetAppInfos; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("IdentificationDeclarationOptions::noPasscode: ") + .append(noPasscode) + .append("\n"); + sb.append("IdentificationDeclarationOptions::cdUponPasscodeDialog: ") + .append(cdUponPasscodeDialog) + .append("\n"); + sb.append("IdentificationDeclarationOptions::commissionerPasscode: ") + .append(commissionerPasscode) + .append("\n"); + sb.append("IdentificationDeclarationOptions::commissionerPasscodeReady: ") + .append(commissionerPasscodeReady) + .append("\n"); + sb.append("IdentificationDeclarationOptions::cancelPasscode: ") + .append(cancelPasscode) + .append("\n"); + sb.append("IdentificationDeclarationOptions::targetAppInfos list: \n"); + + for (TargetAppInfo targetAppInfo : targetAppInfos) { + sb.append("\t\tTargetAppInfo - Vendor ID: ") + .append(targetAppInfo.vendorId) + .append(", Product ID: ") + .append(targetAppInfo.productId) + .append("\n"); + } + + return sb.toString(); + } + + public void logDetail() { + Log.d(TAG, "IdentificationDeclarationOptions::logDetail()\n" + this.toString()); + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java new file mode 100644 index 00000000000000..1f605a89833bb1 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2024 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. + */ +package com.matter.casting.support; + +/** + * Feature: Target Content Application - The set of content app Vendor IDs (and optionally, Product + * IDs) that can be used for authentication. + */ +public class TargetAppInfo { + /** Target Target Content Application Vendor ID, null means unspecified */ + public Integer vendorId; + /** Target Target Content Application Product ID, null means unspecified */ + public Integer productId; +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp index 81a42115070da7..ce8e8c0e1b77a6 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp @@ -24,6 +24,7 @@ // from tv-casting-common #include "core/CastingApp.h" +#include "core/CommissionerDeclarationHandler.h" #include "support/ChipDeviceEventHandler.h" #include @@ -47,7 +48,7 @@ jobject extractJAppParameter(jobject jAppParameters, const char * methodName, co JNI_METHOD(jobject, finishInitialization)(JNIEnv *, jobject, jobject jAppParameters) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD CastingApp-JNI::finishInitialization() called"); + ChipLogProgress(AppServer, "CastingApp-JNI::finishInitialization() called"); VerifyOrReturnValue(jAppParameters != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT)); CHIP_ERROR err = CHIP_NO_ERROR; @@ -81,7 +82,7 @@ JNI_METHOD(jobject, finishInitialization)(JNIEnv *, jobject, jobject jAppParamet JNI_METHOD(jobject, finishStartup)(JNIEnv *, jobject) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD CastingAppJNI::finishStartup() called"); + ChipLogProgress(AppServer, "CastingApp-JNI::finishStartup() called"); CHIP_ERROR err = CHIP_NO_ERROR; auto & server = chip::Server::GetInstance(); @@ -102,13 +103,28 @@ JNI_METHOD(jobject, finishStartup)(JNIEnv *, jobject) VerifyOrReturnValue(err == CHIP_NO_ERROR, support::convertMatterErrorFromCppToJava(err), ChipLogError(AppServer, "Failed to register ChipDeviceEventHandler %" CHIP_ERROR_FORMAT, err.Format())); + ChipLogProgress(AppServer, + "CastingApp-JNI::finishStartup() calling " + "GetUserDirectedCommissioningClient()->SetCommissionerDeclarationHandler()"); +#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + // Set a handler for Commissioner's CommissionerDeclaration messages. This is set in + // connectedhomeip/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h + chip::Server::GetInstance().GetUserDirectedCommissioningClient()->SetCommissionerDeclarationHandler( + CommissionerDeclarationHandler::GetInstance()); +#endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + return support::convertMatterErrorFromCppToJava(CHIP_NO_ERROR); } JNI_METHOD(jobject, shutdownAllSubscriptions)(JNIEnv * env, jobject) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD CastingApp-JNI::shutdownAllSubscriptions called"); + ChipLogProgress(AppServer, "CastingApp-JNI::shutdownAllSubscriptions() called"); + +#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + // Remove the handler previously set for Commissioner's CommissionerDeclaration messages. + chip::Server::GetInstance().GetUserDirectedCommissioningClient()->SetCommissionerDeclarationHandler(nullptr); +#endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT CHIP_ERROR err = matter::casting::core::CastingApp::GetInstance()->ShutdownAllSubscriptions(); return support::convertMatterErrorFromCppToJava(err); @@ -117,7 +133,7 @@ JNI_METHOD(jobject, shutdownAllSubscriptions)(JNIEnv * env, jobject) JNI_METHOD(jobject, clearCache)(JNIEnv * env, jobject) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD CastingApp-JNI::clearCache called"); + ChipLogProgress(AppServer, "CastingApp-JNI::clearCache called"); CHIP_ERROR err = matter::casting::core::CastingApp::GetInstance()->ClearCache(); return support::convertMatterErrorFromCppToJava(err); @@ -125,7 +141,7 @@ JNI_METHOD(jobject, clearCache)(JNIEnv * env, jobject) jobject extractJAppParameter(jobject jAppParameters, const char * methodName, const char * methodSig) { - ChipLogProgress(AppServer, "JNI_METHOD CastingApp-JNI::extractJAppParameter() called"); + ChipLogProgress(AppServer, "CastingApp-JNI::extractJAppParameter() called"); JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); jclass jAppParametersClass; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp index b2597c883406d8..b718682a17124b 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp @@ -21,10 +21,12 @@ #include "../JNIDACProvider.h" #include "../support/Converters-JNI.h" #include "../support/RotatingDeviceIdUniqueIdProvider-JNI.h" -#include "core/CastingApp.h" // from tv-casting-common -#include "core/CastingPlayer.h" // from tv-casting-common -#include "core/CastingPlayerDiscovery.h" // from tv-casting-common -#include "core/ConnectionCallbacks.h" // from tv-casting-common +#include "core/CastingApp.h" // from tv-casting-common +#include "core/CastingPlayer.h" // from tv-casting-common +#include "core/CastingPlayerDiscovery.h" // from tv-casting-common +#include "core/CommissionerDeclarationHandler.h" // from tv-casting-common +#include "core/ConnectionCallbacks.h" // from tv-casting-common +#include "core/IdentificationDeclarationOptions.h" // from tv-casting-common #include #include @@ -44,87 +46,113 @@ namespace core { MatterCastingPlayerJNI MatterCastingPlayerJNI::sInstance; JNI_METHOD(jobject, verifyOrEstablishConnection) -(JNIEnv * env, jobject thiz, jlong commissioningWindowTimeoutSec, jobject desiredEndpointFilterJavaObject, jobject jSuccessCallback, - jobject jFailureCallback) +(JNIEnv * env, jobject thiz, jobject jconnectionCallbacks, jlong commissioningWindowTimeoutSec, + jobject jIdentificationDeclarationOptions) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() called with a timeout of: %ld seconds", - static_cast(commissioningWindowTimeoutSec)); + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() called with a timeout of: %d seconds", + static_cast(commissioningWindowTimeoutSec)); CastingPlayer * castingPlayer = support::convertCastingPlayerFromJavaToCpp(thiz); VerifyOrReturnValue(castingPlayer != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT)); - matter::casting::core::IdentificationDeclarationOptions idOptions; - - // TODO: In the following PRs. Replace EndpointFilter Java class with IdentificationDeclarationOptions Java class. - matter::casting::core::EndpointFilter desiredEndpointFilter; - if (desiredEndpointFilterJavaObject != nullptr) + // Find the ConnectionCallbacks class, get the field IDs of the connection callbacks and extract the callback objects. + jclass connectionCallbacksClass = env->GetObjectClass(jconnectionCallbacks); + VerifyOrReturnValue( + connectionCallbacksClass != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT), + ChipLogError(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() connectionCallbacksClass == nullptr ")); + + jfieldID successCallbackFieldID = + env->GetFieldID(connectionCallbacksClass, "onSuccess", "Lcom/matter/casting/support/MatterCallback;"); + jfieldID failureCallbackFieldID = + env->GetFieldID(connectionCallbacksClass, "onFailure", "Lcom/matter/casting/support/MatterCallback;"); + jfieldID commissionerDeclarationCallbackFieldID = + env->GetFieldID(connectionCallbacksClass, "onCommissionerDeclaration", "Lcom/matter/casting/support/MatterCallback;"); + + jobject jSuccessCallback = env->GetObjectField(jconnectionCallbacks, successCallbackFieldID); + jobject jFailureCallback = env->GetObjectField(jconnectionCallbacks, failureCallbackFieldID); + jobject jCommissionerDeclarationCallback = env->GetObjectField(jconnectionCallbacks, commissionerDeclarationCallbackFieldID); + + VerifyOrReturnValue( + jSuccessCallback != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT), + ChipLogError(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() jSuccessCallback == nullptr but is mandatory ")); + VerifyOrReturnValue( + jFailureCallback != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT), + ChipLogError(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() jFailureCallback == nullptr but is mandatory ")); + + // jIdentificationDeclarationOptions is optional + matter::casting::core::IdentificationDeclarationOptions * idOptions = nullptr; + if (jIdentificationDeclarationOptions == nullptr) + { + ChipLogProgress(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() Optional jIdentificationDeclarationOptions not " + "provided by the client"); + } + else { - chip::Protocols::UserDirectedCommissioning::TargetAppInfo targetAppInfo; - - // Convert the EndpointFilter Java class to a C++ EndpointFilter - jclass endpointFilterJavaClass = env->GetObjectClass(desiredEndpointFilterJavaObject); - jfieldID vendorIdFieldId = env->GetFieldID(endpointFilterJavaClass, "vendorId", "Ljava/lang/Integer;"); - jfieldID productIdFieldId = env->GetFieldID(endpointFilterJavaClass, "productId", "Ljava/lang/Integer;"); - jobject vendorIdIntegerObject = env->GetObjectField(desiredEndpointFilterJavaObject, vendorIdFieldId); - jobject productIdIntegerObject = env->GetObjectField(desiredEndpointFilterJavaObject, productIdFieldId); - // jfieldID requiredDeviceTypesFieldId = env->GetFieldID(endpointFilterJavaClass, "requiredDeviceTypes", - // "Ljava/util/List;"); - - // Value of 0 means unspecified - targetAppInfo.vendorId = vendorIdIntegerObject != nullptr - ? static_cast(env->CallIntMethod( - vendorIdIntegerObject, env->GetMethodID(env->GetObjectClass(vendorIdIntegerObject), "intValue", "()I"))) - : 0; - targetAppInfo.productId = productIdIntegerObject != nullptr - ? static_cast(env->CallIntMethod( - productIdIntegerObject, env->GetMethodID(env->GetObjectClass(productIdIntegerObject), "intValue", "()I"))) - : 0; - - CHIP_ERROR result = idOptions.addTargetAppInfo(targetAppInfo); - if (result != CHIP_NO_ERROR) - { - ChipLogError(AppServer, - "MatterCastingPlayer-JNI::verifyOrEstablishConnection() failed to add targetAppInfo: %" CHIP_ERROR_FORMAT, - result.Format()); - } + ChipLogProgress( + AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() jIdentificationDeclarationOptions was provided by client"); + idOptions = support::convertIdentificationDeclarationOptionsFromJavaToCpp(jIdentificationDeclarationOptions); + VerifyOrReturnValue(idOptions != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT), + ChipLogError(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() " + "convertIdentificationDeclarationOptionsFromJavaToCpp() error")); + idOptions->LogDetail(); } MatterCastingPlayerJNIMgr().mConnectionSuccessHandler.SetUp(env, jSuccessCallback); MatterCastingPlayerJNIMgr().mConnectionFailureHandler.SetUp(env, jFailureCallback); - auto connectCallback = [](CHIP_ERROR err, CastingPlayer * playerPtr) { - ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback()"); - if (err == CHIP_NO_ERROR) - { - ChipLogProgress(AppServer, - "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback() Connected to Casting Player " - "with device ID: %s", - playerPtr->GetId()); - // The Java jSuccessCallback is expecting a Void v callback parameter which translates to a nullptr. When calling the - // Java method from C++ via JNI, passing nullptr is equivalent to passing a Void object in Java. - MatterCastingPlayerJNIMgr().mConnectionSuccessHandler.Handle(nullptr); - } - else - { - ChipLogError( - AppServer, - "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback() Connection error: %" CHIP_ERROR_FORMAT, - err.Format()); - MatterCastingPlayerJNIMgr().mConnectionFailureHandler.Handle(err); - } - }; - - // TODO: In the following PRs. Add optional CommissionerDeclarationHandler callback parameter for the Commissioner-Generated - // passcode commissioning flow. + // jCommissionerDeclarationCallback is optional + if (jCommissionerDeclarationCallback == nullptr) + { + ChipLogProgress(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() optional jCommissionerDeclarationCallback was not " + "provided by the client"); + } + else + { + MatterCastingPlayerJNIMgr().mCommissionerDeclarationHandler.SetUp(env, jCommissionerDeclarationCallback); + } + matter::casting::core::ConnectionCallbacks connectionCallbacks; - connectionCallbacks.mOnConnectionComplete = connectCallback; + connectionCallbacks.mOnConnectionComplete = MatterCastingPlayerJNI::getInstance().getConnectCallback(); + connectionCallbacks.mCommissionerDeclarationCallback = + MatterCastingPlayerJNI::getInstance().getCommissionerDeclarationCallback(); castingPlayer->VerifyOrEstablishConnection(connectionCallbacks, static_cast(commissioningWindowTimeoutSec), - idOptions); + *idOptions); + return support::convertMatterErrorFromCppToJava(CHIP_NO_ERROR); } +JNI_METHOD(jobject, continueConnectingNative) +(JNIEnv * env, jobject thiz) +{ + chip::DeviceLayer::StackLock lock; + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::continueConnecting()"); + + CastingPlayer * castingPlayer = support::convertCastingPlayerFromJavaToCpp(thiz); + VerifyOrReturnValue(castingPlayer != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT)); + + return support::convertMatterErrorFromCppToJava(castingPlayer->ContinueConnecting()); +} + +JNI_METHOD(jobject, stopConnecting) +(JNIEnv * env, jobject thiz) +{ + chip::DeviceLayer::StackLock lock; + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::stopConnecting()"); + + CastingPlayer * castingPlayer = support::convertCastingPlayerFromJavaToCpp(thiz); + VerifyOrReturnValue(castingPlayer != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT)); + + return support::convertMatterErrorFromCppToJava(castingPlayer->StopConnecting()); +} + JNI_METHOD(void, disconnect) (JNIEnv * env, jobject thiz) { @@ -161,6 +189,54 @@ JNI_METHOD(jobject, getEndpoints) return jEndpointList; } +void MatterCastingPlayerJNI::ConnectCallback(CHIP_ERROR err, CastingPlayer * playerPtr) +{ + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback()"); + if (err == CHIP_NO_ERROR) + { + ChipLogProgress(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback() Connected to Casting Player " + "with device ID: %s", + playerPtr->GetId()); + // The Java jSuccessCallback is expecting a Void v callback parameter which translates to a nullptr. When calling the + // Java method from C++ via JNI, passing nullptr is equivalent to passing a Void object in Java. + MatterCastingPlayerJNIMgr().mConnectionSuccessHandler.Handle(nullptr); + } + else + { + ChipLogError( + AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback() Connection error: %" CHIP_ERROR_FORMAT, + err.Format()); + MatterCastingPlayerJNIMgr().mConnectionFailureHandler.Handle(err); + } +} + +void MatterCastingPlayerJNI::CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source, + chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd) +{ + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() CommissionerDeclarationCallback()"); + cd.DebugLog(); + + char addressStr[chip::Transport::PeerAddress::kMaxToStringSize]; + source.ToString(addressStr, sizeof(addressStr)); + ChipLogProgress(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() CommissionerDeclarationCallback() source: %s", + addressStr); + + // Call the Java CommissionerDeclarationCallback if it was provided by the client. + if (!MatterCastingPlayerJNIMgr().mCommissionerDeclarationHandler.IsSetUp()) + { + ChipLogError(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() CommissionerDeclarationCallback() received from " + "but Java callback is not set"); + } + else + { + MatterCastingPlayerJNIMgr().mCommissionerDeclarationHandler.Handle(cd); + } +} + }; // namespace core }; // namespace casting }; // namespace matter diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h index 7f58162fff52b3..286d380cf7d942 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h @@ -27,16 +27,32 @@ namespace matter { namespace casting { namespace core { +/** + * This class is used to manage the JNI callbacks and C++ to Java conversions for the CastingPlayer. + */ class MatterCastingPlayerJNI { public: - MatterCastingPlayerJNI() : mConnectionSuccessHandler([](void *) { return nullptr; }) {} + // Member initializer list + MatterCastingPlayerJNI() : + mConnectionSuccessHandler([](void *) { return nullptr; }), + mConnectionFailureHandler(matter::casting::support::convertMatterErrorFromCppToJava), + mCommissionerDeclarationHandler(matter::casting::support::convertCommissionerDeclarationFromCppToJava) + {} support::MatterCallbackJNI mConnectionSuccessHandler; - support::MatterFailureCallbackJNI mConnectionFailureHandler; + support::MatterCallbackJNI mConnectionFailureHandler; + support::MatterCallbackJNI mCommissionerDeclarationHandler; + + static MatterCastingPlayerJNI & getInstance() { return sInstance; } + auto getConnectCallback() const { return ConnectCallback; } + auto getCommissionerDeclarationCallback() const { return CommissionerDeclarationCallback; } private: friend MatterCastingPlayerJNI & MatterCastingPlayerJNIMgr(); static MatterCastingPlayerJNI sInstance; + static void ConnectCallback(CHIP_ERROR err, CastingPlayer * playerPtr); + static void CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source, + chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd); }; inline class MatterCastingPlayerJNI & MatterCastingPlayerJNIMgr() diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.cpp index 00ca47216ae804..69f70c47d1762e 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.cpp @@ -25,6 +25,17 @@ namespace support { using namespace chip; +extern "C" { + +JNIEXPORT jshort JNICALL +Java_com_matter_casting_support_IdentificationDeclarationOptions_getChipDeviceConfigUdcMaxTargetApps(JNIEnv *, jclass clazz) +{ + ChipLogProgress(AppServer, "Converters-JNI::getChipDeviceConfigUdcMaxTargetApps(), CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS: %d", + CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS); + return CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS; +} +} + jobject convertLongFromCppToJava(jlong value) { ChipLogProgress(AppServer, "convertLongFromCppToJava called"); @@ -366,6 +377,171 @@ jobject convertLongFromCppToJava(uint64_t responseData) return env->NewObject(responseTypeClass, constructor, responseData); } +chip::Protocols::UserDirectedCommissioning::TargetAppInfo * convertTargetAppInfoFromJavaToCpp(jobject jTargetAppInfo) +{ + ChipLogProgress(AppServer, "convertTargetAppInfoFromJavaToCpp() called"); + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnValue(env != nullptr, nullptr, + ChipLogError(AppServer, "convertTargetAppInfoFromJavaToCpp() Could not get JNIEnv for current thread")); + jclass targetAppInfoClass = env->GetObjectClass(jTargetAppInfo); + VerifyOrReturnValue(targetAppInfoClass != nullptr, nullptr, + ChipLogError(AppServer, "convertTargetAppInfoFromJavaToCpp() TargetAppInfo class not found!")); + + jfieldID vendorIdField = env->GetFieldID(targetAppInfoClass, "vendorId", "Ljava/lang/Integer;"); + jfieldID productIdField = env->GetFieldID(targetAppInfoClass, "productId", "Ljava/lang/Integer;"); + VerifyOrReturnValue(vendorIdField != nullptr, nullptr, + ChipLogError(AppServer, "convertTargetAppInfoFromJavaToCpp() vendorIdField not found!")); + VerifyOrReturnValue(productIdField != nullptr, nullptr, + ChipLogError(AppServer, "convertTargetAppInfoFromJavaToCpp() productIdField not found!")); + + jobject jVendorIdObject = env->GetObjectField(jTargetAppInfo, vendorIdField); + jobject jProductIdObject = env->GetObjectField(jTargetAppInfo, productIdField); + + jclass integerClass = env->FindClass("java/lang/Integer"); + jmethodID intValueMethod = env->GetMethodID(integerClass, "intValue", "()I"); + + jint vendorId = 0; + jint productId = 0; + if (jVendorIdObject != nullptr) + { + vendorId = env->CallIntMethod(jVendorIdObject, intValueMethod); + } + if (jProductIdObject != nullptr) + { + productId = env->CallIntMethod(jProductIdObject, intValueMethod); + } + + chip::Protocols::UserDirectedCommissioning::TargetAppInfo * cppTargetAppInfo = + new chip::Protocols::UserDirectedCommissioning::TargetAppInfo(); + + cppTargetAppInfo->vendorId = static_cast(vendorId); + cppTargetAppInfo->productId = static_cast(productId); + + env->DeleteLocalRef(targetAppInfoClass); + env->DeleteLocalRef(jVendorIdObject); + env->DeleteLocalRef(jProductIdObject); + env->DeleteLocalRef(integerClass); + + return reinterpret_cast(cppTargetAppInfo); +} + +matter::casting::core::IdentificationDeclarationOptions * convertIdentificationDeclarationOptionsFromJavaToCpp(jobject jIdOptions) +{ + ChipLogProgress(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() called"); + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnValue( + env != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() Could not get JNIEnv for current thread")); + + jclass idOptionsClass = env->GetObjectClass(jIdOptions); + VerifyOrReturnValue( + idOptionsClass != nullptr, nullptr, + ChipLogError(AppServer, + "convertIdentificationDeclarationOptionsFromJavaToCpp() IdentificationDeclarationOptions class not found!")); + + jfieldID noPasscodeField = env->GetFieldID(idOptionsClass, "noPasscode", "Z"); + jfieldID cdUponPasscodeDialogField = env->GetFieldID(idOptionsClass, "cdUponPasscodeDialog", "Z"); + jfieldID commissionerPasscodeField = env->GetFieldID(idOptionsClass, "commissionerPasscode", "Z"); + jfieldID commissionerPasscodeReadyField = env->GetFieldID(idOptionsClass, "commissionerPasscodeReady", "Z"); + jfieldID cancelPasscodeField = env->GetFieldID(idOptionsClass, "cancelPasscode", "Z"); + jfieldID targetAppInfosField = env->GetFieldID(idOptionsClass, "targetAppInfos", "Ljava/util/List;"); + VerifyOrReturnValue( + noPasscodeField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() noPasscodeField not found!")); + VerifyOrReturnValue( + cdUponPasscodeDialogField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() cdUponPasscodeDialogField not found!")); + VerifyOrReturnValue( + commissionerPasscodeField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() commissionerPasscodeField not found!")); + VerifyOrReturnValue( + commissionerPasscodeReadyField != nullptr, nullptr, + ChipLogError(AppServer, + "convertIdentificationDeclarationOptionsFromJavaToCpp() commissionerPasscodeReadyField not found!")); + VerifyOrReturnValue( + cancelPasscodeField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() cancelPasscodeField not found!")); + VerifyOrReturnValue( + targetAppInfosField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() targetAppInfosField not found!")); + + matter::casting::core::IdentificationDeclarationOptions * cppIdOptions = + new matter::casting::core::IdentificationDeclarationOptions(); + + cppIdOptions->mNoPasscode = env->GetBooleanField(jIdOptions, noPasscodeField); + cppIdOptions->mCdUponPasscodeDialog = env->GetBooleanField(jIdOptions, cdUponPasscodeDialogField); + cppIdOptions->mCommissionerPasscode = env->GetBooleanField(jIdOptions, commissionerPasscodeField); + cppIdOptions->mCommissionerPasscodeReady = env->GetBooleanField(jIdOptions, commissionerPasscodeReadyField); + cppIdOptions->mCancelPasscode = env->GetBooleanField(jIdOptions, cancelPasscodeField); + + jobject targetAppInfosList = env->GetObjectField(jIdOptions, targetAppInfosField); + VerifyOrReturnValue( + targetAppInfosList != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() targetAppInfosList not found!")); + jclass listClass = env->FindClass("java/util/List"); + jmethodID sizeMethod = env->GetMethodID(listClass, "size", "()I"); + jmethodID getMethod = env->GetMethodID(listClass, "get", "(I)Ljava/lang/Object;"); + + jint size = env->CallIntMethod(targetAppInfosList, sizeMethod); + + for (jint i = 0; i < size; i++) + { + jobject jTargetAppInfo = env->CallObjectMethod(targetAppInfosList, getMethod, i); + + chip::Protocols::UserDirectedCommissioning::TargetAppInfo * cppTargetAppInfo = + convertTargetAppInfoFromJavaToCpp(jTargetAppInfo); + VerifyOrReturnValue( + cppTargetAppInfo != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() Could not convert jTargetAppInfo")); + + CHIP_ERROR err = cppIdOptions->addTargetAppInfo(*cppTargetAppInfo); + + env->DeleteLocalRef(jTargetAppInfo); + VerifyOrReturnValue(err == CHIP_NO_ERROR, nullptr, + ChipLogError(AppServer, + "convertIdentificationDeclarationOptionsFromJavaToCpp() failed to addTargetAppInfo, due " + "to err: %" CHIP_ERROR_FORMAT, + err.Format())); + } + + env->DeleteLocalRef(targetAppInfosList); + env->DeleteLocalRef(listClass); + env->DeleteLocalRef(idOptionsClass); + + return reinterpret_cast(cppIdOptions); +} + +jobject +convertCommissionerDeclarationFromCppToJava(const chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration & cppCd) +{ + ChipLogProgress(AppServer, "convertCommissionerDeclarationFromCppToJava() called"); + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnValue( + env != nullptr, nullptr, + ChipLogError(AppServer, "convertCommissionerDeclarationFromCppToJava() Could not get JNIEnv for current thread")); + + jclass jCommissionerDeclarationClass; + CHIP_ERROR err = chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/matter/casting/support/CommissionerDeclaration", + jCommissionerDeclarationClass); + VerifyOrReturnValue(err == CHIP_NO_ERROR, nullptr); + + jmethodID jCommissionerDeclarationConstructor = env->GetMethodID(jCommissionerDeclarationClass, "", "(IZZZZZ)V"); + if (jCommissionerDeclarationConstructor == nullptr) + { + ChipLogError(AppServer, + "convertCommissionerDeclarationFromCppToJava() Failed to access Java CommissionerDeclaration constructor"); + env->ExceptionClear(); + return nullptr; + } + + return env->NewObject(jCommissionerDeclarationClass, jCommissionerDeclarationConstructor, + static_cast(cppCd.GetErrorCode()), cppCd.GetNeedsPasscode(), cppCd.GetNoAppsFound(), + cppCd.GetPasscodeDialogDisplayed(), cppCd.GetCommissionerPasscode(), cppCd.GetQRCodeDisplayed()); +} + }; // namespace support }; // namespace casting }; // namespace matter diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.h index aa96af0668f5d4..d5ef62e349ae61 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.h @@ -19,7 +19,10 @@ #include "core/BaseCluster.h" #include "core/CastingPlayer.h" #include "core/Command.h" +#include "core/CommissionerDeclarationHandler.h" +#include "core/ConnectionCallbacks.h" #include "core/Endpoint.h" +#include "core/IdentificationDeclarationOptions.h" #include @@ -74,6 +77,28 @@ void * convertCommandFromJavaToCpp(jobject jCommandObject); jobject convertLongFromCppToJava(uint64_t responseData); +/** + * @brief Converts a Java TargetAppInfo into a native MatterTargetAppInfo. + * + * @return pointer to the TargetAppInfo jobject if created successfully, nullptr otherwise. + */ +chip::Protocols::UserDirectedCommissioning::TargetAppInfo * convertTargetAppInfoFromJavaToCpp(jobject jTargetAppInfo); + +/** + * @brief Converts a Java IdentificationDeclarationOptions into a native IdentificationDeclarationOptions + * + * @return pointer to the IdentificationDeclarationOptions if created successfully, nullptr otherwise. + */ +matter::casting::core::IdentificationDeclarationOptions * convertIdentificationDeclarationOptionsFromJavaToCpp(jobject jIdOptions); + +/** + * @brief Converts a native CommissioningDeclaration into a MatterCommissioningDeclaration jobject + * + * @return pointer to the CommissioningDeclaration jobject if created successfully, nullptr otherwise. + */ +jobject +convertCommissionerDeclarationFromCppToJava(const chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration & cppCd); + }; // namespace support }; // namespace casting }; // namespace matter diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/MatterCallback-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/MatterCallback-JNI.h index 82894e075ea912..6bd185952535e7 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/MatterCallback-JNI.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/MatterCallback-JNI.h @@ -62,6 +62,8 @@ class MatterCallbackJNI return CHIP_NO_ERROR; } + bool IsSetUp() const { return mCallbackObject.HasValidObjectRef() && mMethod != nullptr; } + void Handle(T responseData) { ChipLogProgress(AppServer, "MatterCallbackJNI::Handle called"); diff --git a/examples/tv-casting-app/android/App/app/src/main/res/layout/custom_passcode_dialog.xml b/examples/tv-casting-app/android/App/app/src/main/res/layout/custom_passcode_dialog.xml new file mode 100644 index 00000000000000..1b868e06b71f29 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/res/layout/custom_passcode_dialog.xml @@ -0,0 +1,39 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/tv-casting-app/android/App/app/src/main/res/values/strings.xml b/examples/tv-casting-app/android/App/app/src/main/res/values/strings.xml index 4485b6a31ab788..21b7841a656796 100644 --- a/examples/tv-casting-app/android/App/app/src/main/res/values/strings.xml +++ b/examples/tv-casting-app/android/App/app/src/main/res/values/strings.xml @@ -33,11 +33,13 @@ Initializing Discovering Casting Players on-network: Discovery Stopped - No errors to report + Long click on a Casting Player to connect using CastingPlayer/Commissioner-Generated passcode commissioning flow (if supported). Start discovery error. - Start discovery error. Discovery ongoing, stop before starting. - Stop discovery error. - Next + Enter the Commissioner-Generated Passcode + Input the Commissioner-Generated passcode displayed on the CastingPlayer UX, or use the default provided (12345678). Select an action Content Launcher Launch URL Disconnect from Casting Player diff --git a/examples/tv-casting-app/android/BUILD.gn b/examples/tv-casting-app/android/BUILD.gn index 416570417b0794..48d68100930a91 100644 --- a/examples/tv-casting-app/android/BUILD.gn +++ b/examples/tv-casting-app/android/BUILD.gn @@ -114,12 +114,16 @@ android_library("java") { "App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayerDiscovery.java", "App/app/src/main/jni/com/matter/casting/support/AppParameters.java", "App/app/src/main/jni/com/matter/casting/support/CommissionableData.java", + "App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java", + "App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java", "App/app/src/main/jni/com/matter/casting/support/DACProvider.java", "App/app/src/main/jni/com/matter/casting/support/DataProvider.java", "App/app/src/main/jni/com/matter/casting/support/DeviceTypeStruct.java", "App/app/src/main/jni/com/matter/casting/support/EndpointFilter.java", + "App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java", "App/app/src/main/jni/com/matter/casting/support/MatterCallback.java", "App/app/src/main/jni/com/matter/casting/support/MatterError.java", + "App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java", ] javac_flags = [ "-Xlint:deprecation" ] diff --git a/examples/tv-casting-app/linux/simple-app-helper.cpp b/examples/tv-casting-app/linux/simple-app-helper.cpp index beef624eea5ff8..c961bd5adaaacb 100644 --- a/examples/tv-casting-app/linux/simple-app-helper.cpp +++ b/examples/tv-casting-app/linux/simple-app-helper.cpp @@ -344,7 +344,7 @@ void CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source { ChipLogProgress(AppServer, "---- Awaiting user input ----"); ChipLogProgress(AppServer, "Input the Commissioner-Generated passcode displayed on the CastingPlayer UX."); - ChipLogProgress(AppServer, "Input 1245678 to use the default passcode."); + ChipLogProgress(AppServer, "Input 12345678 to use the default passcode."); ChipLogProgress(AppServer, "Example: cast setcommissionerpasscode 12345678"); ChipLogProgress(AppServer, "---- Awaiting user input ----"); gAwaitingCommissionerPasscodeInput = true; @@ -458,7 +458,7 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) uint32_t passcode = (uint32_t) strtol(argv[1], &eptr, 10); if (gAwaitingCommissionerPasscodeInput) { - ChipLogProgress(AppServer, "CommandHandler() setcommissionerpasscode user enterd passcode: %d", passcode); + ChipLogProgress(AppServer, "CommandHandler() setcommissionerpasscode user entered passcode: %d", passcode); gAwaitingCommissionerPasscodeInput = false; // Per connectedhomeip/examples/platform/linux/LinuxCommissionableDataProvider.h: We don't support overriding the @@ -486,7 +486,12 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) } // Continue Connecting to the target CastingPlayer with the user entered Commissioner-generated Passcode. - targetCastingPlayer->ContinueConnecting(); + err = targetCastingPlayer->ContinueConnecting(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "CommandHandler() setcommissionerpasscode ContinueConnecting() err %" CHIP_ERROR_FORMAT, + err.Format()); + } } else { @@ -495,6 +500,15 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) "CommandHandler() setcommissionerpasscode, no Commissioner-Generated passcode input expected at this time."); } } + if (strcmp(argv[0], "stop-connecting") == 0) + { + ChipLogProgress(AppServer, "CommandHandler() stop-connecting"); + CHIP_ERROR err = targetCastingPlayer->StopConnecting(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "CommandHandler() stop-connecting, err %" CHIP_ERROR_FORMAT, err.Format()); + } + } if (strcmp(argv[0], "print-bindings") == 0) { PrintBindings(); @@ -536,6 +550,9 @@ CHIP_ERROR PrintAllCommands() " setcommissionerpasscode Set the commissioning session's passcode to the " "Commissioner-Generated passcode. Used for the the Commissioner-Generated passcode commissioning flow. Usage: " "cast setcommissionerpasscode 12345678\r\n"); + streamer_printf(sout, + " stop-connecting Stop connecting to Casting Player upon " + "Commissioner-Generated passcode commissioning flow passcode input request. Usage: cast stop-connecting\r\n"); streamer_printf(sout, "\r\n"); return CHIP_NO_ERROR; diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp index ff204923da5d40..cff903a1a1316b 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp @@ -60,6 +60,10 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa // information indicating the Commissioner's pre-commissioning state. if (connectionCallbacks.mCommissionerDeclarationCallback != nullptr) { + ChipLogProgress(AppServer, + "CastingPlayer::VerifyOrEstablishConnection() Setting CommissionerDeclarationCallback in " + "CommissionerDeclarationHandler"); + // Set the callback for handling CommissionerDeclaration messages. matter::casting::core::CommissionerDeclarationHandler::GetInstance()->SetCommissionerDeclarationCallback( connectionCallbacks.mCommissionerDeclarationCallback); } @@ -155,9 +159,9 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa } else { - // We need to call OpenBasicCommissioningWindow() for both Commissionee-Generated passcode commissioning flow and - // Commissioner-Generated passcode commissioning flow. Per the Matter spec (UserDirectedCommissioning), even if the - // Commissionee sends an IdentificationDeclaration with CommissionerPasscode set to true, the Commissioner will first + // We need to call OpenBasicCommissioningWindow() for both the Client/Commissionee-Generated passcode commissioning flow and + // Casting Player/Commissioner-Generated passcode commissioning flow. Per the Matter spec (UserDirectedCommissioning), even + // if the Commissionee sends an IdentificationDeclaration with CommissionerPasscode set to true, the Commissioner will first // attempt to use AccountLogin in order to obtain Passcode using rotatingID. If no Passcode is obtained, Commissioner // displays a Passcode. ChipLogProgress(AppServer, "CastingPlayer::VerifyOrEstablishConnection() calling OpenBasicCommissioningWindow()"); @@ -178,18 +182,20 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa } } -void CastingPlayer::ContinueConnecting() +CHIP_ERROR CastingPlayer::ContinueConnecting() { ChipLogProgress(AppServer, "CastingPlayer::ContinueConnecting()"); - CHIP_ERROR err = CHIP_NO_ERROR; - // Verify that mOnCompleted is not nullptr. - VerifyOrExit(mOnCompleted != nullptr, ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() mOnCompleted == nullptr")); - if (!matter::casting::core::CommissionerDeclarationHandler::GetInstance()->HasCommissionerDeclarationCallback()) - { - ChipLogProgress(AppServer, - "CastingPlayer::ContinueConnecting() CommissionerDeclaration message callback has not been set."); - } - mConnectionState = CASTING_PLAYER_CONNECTING; + VerifyOrReturnValue(mOnCompleted != nullptr, CHIP_ERROR_INVALID_ARGUMENT, + ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() mOnCompleted == nullptr");); + VerifyOrReturnValue(mConnectionState == CASTING_PLAYER_CONNECTING, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() called while not in connecting state");); + VerifyOrReturnValue( + mIdOptions.mCommissionerPasscode, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(AppServer, + "CastingPlayer::ContinueConnecting() mIdOptions.mCommissionerPasscode == false, ContinueConnecting() should " + "only be called when the CastingPlayer/Commissioner-Generated passcode commissioning flow is in progress.");); + + CHIP_ERROR err = CHIP_NO_ERROR; mTargetCastingPlayer = this; ChipLogProgress(AppServer, "CastingPlayer::ContinueConnecting() calling OpenBasicCommissioningWindow()"); @@ -208,6 +214,57 @@ void CastingPlayer::ContinueConnecting() ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() failed with %" CHIP_ERROR_FORMAT, err.Format()); resetState(err); } + + return err; +} + +CHIP_ERROR CastingPlayer::StopConnecting() +{ + ChipLogProgress(AppServer, "CastingPlayer::StopConnecting() called, while ChipDeviceEventHandler.sUdcInProgress: %s", + support::ChipDeviceEventHandler::isUdcInProgress() ? "true" : "false"); + VerifyOrReturnValue(mConnectionState == CASTING_PLAYER_CONNECTING, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(AppServer, "CastingPlayer::StopConnecting() called while not in connecting state");); + VerifyOrReturnValue( + mIdOptions.mCommissionerPasscode, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(AppServer, + "CastingPlayer::StopConnecting() mIdOptions.mCommissionerPasscode == false, ContinueConnecting() should only " + "be called when the CastingPlayer/Commissioner-Generated passcode commissioning flow is in progress.");); + + CHIP_ERROR err = CHIP_NO_ERROR; + mIdOptions.resetState(); + mIdOptions.mCancelPasscode = true; + mConnectionState = CASTING_PLAYER_NOT_CONNECTED; + mCommissioningWindowTimeoutSec = kCommissioningWindowTimeoutSec; + mTargetCastingPlayer = nullptr; + + // If a CastingPlayer::ContinueConnecting() error occurs, StopConnecting() can be called while sUdcInProgress == true. + // sUdcInProgress should be set to false before sending the CancelPasscode IdentificationDeclaration message to the + // CastingPlayer/Commissioner. + if (support::ChipDeviceEventHandler::isUdcInProgress()) + { + support::ChipDeviceEventHandler::SetUdcStatus(false); + } + + ChipLogProgress( + AppServer, + "CastingPlayer::StopConnecting() calling SendUserDirectedCommissioningRequest() to indicate user canceled passcode entry"); +#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + err = SendUserDirectedCommissioningRequest(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "CastingPlayer::StopConnecting() failed with %" CHIP_ERROR_FORMAT, err.Format()); + resetState(err); + return err; + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + + // CastingPlayer::SendUserDirectedCommissioningRequest() calls SetUdcStatus(true) before sending the UDC + // IdentificationDeclaration message. Since StopConnecting() is attempting to cancel the commissioning process, we need to set + // the UDC status to false after sending the message. + support::ChipDeviceEventHandler::SetUdcStatus(false); + + ChipLogProgress(AppServer, "CastingPlayer::StopConnecting() User Directed Commissioning stopped"); + return err; } void CastingPlayer::resetState(CHIP_ERROR err) diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h index d5bbcd46006920..0802765bf37dd7 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h @@ -89,7 +89,7 @@ class ConnectionContext; class CastingPlayer; /** - * @brief CastingPlayer represents a Matter commissioner that is able to play media to a physical + * @brief CastingPlayer represents a Matter Commissioner that is able to play media to a physical * output or to a display screen which is part of the device. */ class CastingPlayer : public std::enable_shared_from_this @@ -129,23 +129,18 @@ class CastingPlayer : public std::enable_shared_from_this /** * @brief Verifies that a connection exists with this CastingPlayer, or triggers a new commissioning session request. If the * CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on disk, this will execute the User Directed - * Commissioning (UDC) process by sending an IdentificationDeclaration message to the Commissioner. For certain UDC features, - * where a Commissioner reply is expected, this API needs to be followed up with the ContinueConnecting() API defiend below. See - * the Matter UDC specification or parameter class definitions for details on features not included in the description below. + * Commissioning (UDC) process by sending an IdentificationDeclaration message to the CastingPlayer/Commissioner. For certain + * UDC features, where a Commissioner reply is expected, this API needs to be followed up with the ContinueConnecting() API + * defiend below. See the Matter UDC specification or parameter class definitions for details on features not included in the + * description below. * * @param connectionCallbacks contains the ConnectCallback (Required) and CommissionerDeclarationCallback (Optional) defiend in * ConnectCallbacks.h. * - * ConnectCallback: The callback called when the connection process has ended, regardless of whether it was successful or not. - * - * CommissionerDeclarationCallback: The callback called when the Commissionee receives a CommissionerDeclaration message from - * the Commissioner. This callback is needed to support UDC features where a reply from the Commissioner is expected. It - * provides information indicating the Commissioner’s pre-commissioning state. - * - * For example: During Commissioner-Generated passcode commissioning, the Commissioner replies with a CommissionerDeclaration - * message with PasscodeDialogDisplayed and CommissionerPasscode set to true. Given these Commissioner state details, the client - * is expected to perform some actions, detailed in the ContinueConnecting() API below, and then call the ContinueConnecting() - * API to complete the process. + * For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the Commissioner replies with a + * CommissionerDeclaration message with PasscodeDialogDisplayed and CommissionerPasscode set to true. Given these Commissioner + * state details, the client is expected to perform some actions, detailed in the ContinueConnecting() API below, and then call + * the ContinueConnecting() API to complete the process. * * @param commissioningWindowTimeoutSec (Optional) time (in sec) to keep the commissioning window open, if commissioning is * required. Needs to be >= kCommissioningWindowTimeoutSec. @@ -153,9 +148,9 @@ class CastingPlayer : public std::enable_shared_from_this * @param idOptions (Optional) Parameters in the IdentificationDeclaration message sent by the Commissionee to the Commissioner. * These parameters specify the information relating to the requested commissioning session. * - * For example: To invoke the Commissioner-Generated passcode commissioning flow, the client would call this API with - * IdentificationDeclarationOptions containing CommissionerPasscode set to true. See IdentificationDeclarationOptions.h for a - * complete list of optional parameters. + * For example: To invoke the CastingPlayer/Commissioner-Generated passcode commissioning flow, the client would call this API + * with IdentificationDeclarationOptions containing CommissionerPasscode set to true. See IdentificationDeclarationOptions.h for + * a complete list of optional parameters. * * Furthermore, attributes (such as VendorId) describe the TargetApp that the client wants to interact with after commissioning. * If this value is passed in, VerifyOrEstablishConnection() will force UDC, in case the desired @@ -166,7 +161,7 @@ class CastingPlayer : public std::enable_shared_from_this IdentificationDeclarationOptions idOptions = IdentificationDeclarationOptions()); /** - * @brief This is a continuation of the Commissioner-Generated passcode commissioning flow started via the + * @brief This is a continuation of the CastingPlayer/Commissioner-Generated passcode commissioning flow started via the * VerifyOrEstablishConnection() API above. It continues the UDC process by sending a second IdentificationDeclaration message * to Commissioner containing CommissionerPasscode and CommissionerPasscodeReady set to true. At this point it is assumed that * the following have occurred: @@ -176,16 +171,29 @@ class CastingPlayer : public std::enable_shared_from_this * 2. Commissioner generated and displayed a passcode. * 3. The Commissioner replied with a CommissionerDecelration message with PasscodeDialogDisplayed and CommissionerPasscode set * to true. - * 3. Client has handled the Commissioner's CommissionerDecelration message. - * 4. Client prompted user to input Passcode from Commissioner. - * 5. Client has updated the commissioning session's PAKE verifier using the user input Passcode by updating the CastingApps + * 4. Client has handled the Commissioner's CommissionerDecelration message. + * 5. Client prompted user to input Passcode from Commissioner. + * 6. Client has updated the commissioning session's PAKE verifier using the user input Passcode by updating the CastingApp's * CommissionableDataProvider * (matter::casting::core::CastingApp::GetInstance()->UpdateCommissionableDataProvider(CommissionableDataProvider)). * * The same connectionCallbacks and commissioningWindowTimeoutSec parameters passed into VerifyOrEstablishConnection() will be * used. + * @return CHIP_NO_ERROR if this function was called with the CastingPlayer in the correct state and an error otherwise. + */ + CHIP_ERROR ContinueConnecting(); + + /** + * @brief This cancels the CastingPlayer/Commissioner-Generated passcode commissioning flow started via the + * VerifyOrEstablishConnection() API above. It constructs and sends an IdentificationDeclaration message to the + * CastingPlayer/Commissioner containing CancelPasscode set to true. It is used to indicate that the user, and thus the + * Client/Commissionee, have cancelled the commissioning process. This indicates that the CastingPlayer/Commissioner can dismiss + * any dialogs corresponding to commissioning, such as a Passcode input dialog or a Passcode display dialog. + * Note: stopConnecting() does not call the ConnectCallback() callback passed to the VerifyOrEstablishConnection() API above + * since no connection is established. + * @return CHIP_NO_ERROR if this function was called with the CastingPlayer in the correct state and an error otherwise. */ - void ContinueConnecting(); + CHIP_ERROR StopConnecting(); /** * @brief Sets the internal connection state of this CastingPlayer to "disconnected" diff --git a/examples/tv-casting-app/tv-casting-common/core/ConnectionCallbacks.h b/examples/tv-casting-app/tv-casting-common/core/ConnectionCallbacks.h index 01badaaf059dad..bc03df3afee421 100644 --- a/examples/tv-casting-app/tv-casting-common/core/ConnectionCallbacks.h +++ b/examples/tv-casting-app/tv-casting-common/core/ConnectionCallbacks.h @@ -47,11 +47,13 @@ using CommissionerDeclarationCallback = std::function getTargetAppInfoList() const { return mTargetAppInfos; } + void resetState() + { + mNoPasscode = false; + mCdUponPasscodeDialog = false; + mCommissionerPasscode = false; + mCommissionerPasscodeReady = false; + mCancelPasscode = false; + mTargetAppInfos.clear(); + } + /** * @brief Builds an IdentificationDeclaration message to be sent to a CastingPlayer, given the options state specified in this * object. @@ -107,7 +117,6 @@ class IdentificationDeclarationOptions { id.SetCommissionerPasscodeReady(true); id.SetInstanceName(mCommissioneeInstanceName); - mCommissionerPasscodeReady = false; } else { @@ -136,7 +145,7 @@ class IdentificationDeclarationOptions void LogDetail() { - ChipLogDetail(AppServer, "IdentificationDeclarationOptions::LogDetail()"); + ChipLogDetail(AppServer, "IdentificationDeclarationOptions::LogDetail() - cpp"); ChipLogDetail(AppServer, "IdentificationDeclarationOptions::mNoPasscode: %s", mNoPasscode ? "true" : "false"); ChipLogDetail(AppServer, "IdentificationDeclarationOptions::mCdUponPasscodeDialog: %s", @@ -148,6 +157,14 @@ class IdentificationDeclarationOptions ChipLogDetail(AppServer, "IdentificationDeclarationOptions::mCancelPasscode: %s", mCancelPasscode ? "true" : "false"); ChipLogDetail(AppServer, "IdentificationDeclarationOptions::mCommissioneeInstanceName: %s", mCommissioneeInstanceName); + + ChipLogDetail(AppServer, "IdentificationDeclarationOptions::TargetAppInfos list:"); + for (size_t i = 0; i < mTargetAppInfos.size(); i++) + { + const chip::Protocols::UserDirectedCommissioning::TargetAppInfo & info = mTargetAppInfos[i]; + ChipLogDetail(AppServer, "\t\tTargetAppInfo %d, Vendor ID: %u, Product ID: %u", int(i + 1), info.vendorId, + info.productId); + } } private: diff --git a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp index fd6039d5256031..bb226a15298229 100644 --- a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp @@ -222,6 +222,11 @@ CHIP_ERROR ChipDeviceEventHandler::SetUdcStatus(bool udcInProgress) return CHIP_NO_ERROR; } +bool ChipDeviceEventHandler::isUdcInProgress() +{ + return sUdcInProgress; +} + }; // namespace support }; // namespace casting }; // namespace matter diff --git a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.h b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.h index d8660a007cc585..cdebdf698b927c 100644 --- a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.h +++ b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.h @@ -45,6 +45,11 @@ class ChipDeviceEventHandler */ static CHIP_ERROR SetUdcStatus(bool udcInProgress); + /** + * @brief Returns true if User Directed Commissioning (UDC) is in progress, false otherwise. + */ + static bool isUdcInProgress(); + private: /** * @brief if kFailSafeTimerExpired is received and a request to connect to a CastingPlayer is pending, open a basic diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h b/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h index 7a496e5a2f0a33..cf9a55365b9191 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h @@ -535,6 +535,7 @@ class DLL_EXPORT UserDirectedCommissioningClient : public TransportMgrDelegate */ void SetCommissionerDeclarationHandler(CommissionerDeclarationHandler * commissionerDeclarationHandler) { + ChipLogProgress(AppServer, "UserDirectedCommissioningClient::SetCommissionerDeclarationHandler()"); mCommissionerDeclarationHandler = commissionerDeclarationHandler; } diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp b/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp index 6d7c315ffb5308..aeb5691be2554c 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp @@ -242,7 +242,7 @@ void UserDirectedCommissioningClient::OnMessageReceived(const Transport::PeerAdd char addrBuffer[chip::Transport::PeerAddress::kMaxToStringSize]; source.ToString(addrBuffer); - ChipLogProgress(AppServer, "UserDirectedCommissioningClient::OnMessageReceived from %s", addrBuffer); + ChipLogProgress(AppServer, "UserDirectedCommissioningClient::OnMessageReceived() from %s", addrBuffer); PacketHeader packetHeader; @@ -250,14 +250,16 @@ void UserDirectedCommissioningClient::OnMessageReceived(const Transport::PeerAdd if (packetHeader.IsEncrypted()) { - ChipLogError(AppServer, "UDC encryption flag set - ignoring"); + ChipLogError(AppServer, "UserDirectedCommissioningClient::OnMessageReceived() UDC encryption flag set - ignoring"); return; } PayloadHeader payloadHeader; ReturnOnFailure(payloadHeader.DecodeAndConsume(msg)); - ChipLogProgress(AppServer, "CommissionerDeclaration DataLength()=%" PRIu32, static_cast(msg->DataLength())); + ChipLogProgress(AppServer, + "UserDirectedCommissioningClient::OnMessageReceived() CommissionerDeclaration DataLength() = %" PRIu32, + static_cast(msg->DataLength())); uint8_t udcPayload[IdentificationDeclaration::kUdcTLVDataMaxBytes]; size_t udcPayloadLength = std::min(msg->DataLength(), sizeof(udcPayload)); @@ -272,6 +274,10 @@ void UserDirectedCommissioningClient::OnMessageReceived(const Transport::PeerAdd { mCommissionerDeclarationHandler->OnCommissionerDeclarationMessage(source, cd); } + else + { + ChipLogProgress(AppServer, "UserDirectedCommissioningClient::OnMessageReceived() No registered handler for UDC messages"); + } } } // namespace UserDirectedCommissioning From d4d905414b47ea2da52c8719948d351331560d51 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 Jun 2024 18:02:10 -0400 Subject: [PATCH 063/162] Fix Darwin server cluster checks for wildcard read to check received values. (#33737) This caught a bug where the synthesized descriptor clusters were not spec-compliant in the sense of requiring admin privileges to read their attributes, and the synthesized global attributes likewise required admin privileges. The changes to MTRServerAccessControl fix that. --- .../ServerEndpoint/MTRServerAccessControl.mm | 49 +++-- .../CHIPTests/MTRPerControllerStorageTests.m | 191 ++++++++++++++---- 2 files changed, 182 insertions(+), 58 deletions(-) diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm index 28dacef27c2a78..e98bdc0b9e61a4 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm @@ -18,6 +18,7 @@ #import #import // for MTRClusterPath +#import // For MTRClusterIDTypeDescriptorID #import #import "MTRDeviceControllerFactory_Internal.h" @@ -29,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -135,36 +138,52 @@ bool GrantSubjectMatchesDescriptor(MTRAccessGrant * grant, const SubjectDescript } // anonymous namespace -chip::Access::Privilege MatterGetAccessPrivilegeForReadEvent(ClusterId cluster, EventId event) +Privilege MatterGetAccessPrivilegeForReadEvent(ClusterId cluster, EventId event) { // We don't support any event bits yet. - return chip::Access::Privilege::kAdminister; + return Privilege::kAdminister; } -chip::Access::Privilege MatterGetAccessPrivilegeForInvokeCommand(ClusterId cluster, CommandId command) +Privilege MatterGetAccessPrivilegeForInvokeCommand(ClusterId cluster, CommandId command) { // For now we only have OTA, which uses Operate. - return chip::Access::Privilege::kOperate; + return Privilege::kOperate; } -chip::Access::Privilege MatterGetAccessPrivilegeForReadAttribute(ClusterId cluster, AttributeId attribute) +Privilege MatterGetAccessPrivilegeForReadAttribute(ClusterId cluster, AttributeId attribute) { NSNumber * _Nullable neededPrivilege = [[MTRDeviceControllerFactory sharedInstance] neededReadPrivilegeForClusterID:@(cluster) attributeID:@(attribute)]; if (neededPrivilege == nil) { - // No privileges declared for this attribute on this cluster. Treat as - // "needs admin privileges", so we fail closed. - return chip::Access::Privilege::kAdminister; + // No privileges declared for this attribute on this cluster. + + // In some cases, we know based on the spec what the answer is, and our + // API clients my not be able to provide explicit privileges for + // these cases because our API surface does not allow them to create + // custom attribute definitions for them. + + // (1) Global attributes always require View privilege to read. + if (IsGlobalAttribute(attribute)) { + return Privilege::kView; + } + + // (2) All standard descriptor attributes just require View privilege to read. + if (cluster == MTRClusterIDTypeDescriptorID && ExtractVendorFromMEI(attribute) == VendorId::Common) { + return Privilege::kView; + } + + // Treat as "needs admin privileges", so we fail closed. + return Privilege::kAdminister; } switch (neededPrivilege.unsignedLongLongValue) { case MTRAccessControlEntryPrivilegeView: - return chip::Access::Privilege::kView; + return Privilege::kView; case MTRAccessControlEntryPrivilegeOperate: - return chip::Access::Privilege::kOperate; + return Privilege::kOperate; case MTRAccessControlEntryPrivilegeManage: - return chip::Access::Privilege::kManage; + return Privilege::kManage; case MTRAccessControlEntryPrivilegeAdminister: - return chip::Access::Privilege::kAdminister; + return Privilege::kAdminister; case MTRAccessControlEntryPrivilegeProxyView: // Just treat this as an unknown value; there is no value for this in privilege-storage. FALLTHROUGH; @@ -175,13 +194,13 @@ bool GrantSubjectMatchesDescriptor(MTRAccessGrant * grant, const SubjectDescript // To be safe, treat unknown values as "needs admin privileges". That way the failure case // disallows access that maybe should be allowed, instead of allowing access that maybe // should be disallowed. - return chip::Access::Privilege::kAdminister; + return Privilege::kAdminister; } -chip::Access::Privilege MatterGetAccessPrivilegeForWriteAttribute(ClusterId cluster, AttributeId attribute) +Privilege MatterGetAccessPrivilegeForWriteAttribute(ClusterId cluster, AttributeId attribute) { // We don't have any writable attributes yet, but default to Operate. - return chip::Access::Privilege::kOperate; + return Privilege::kOperate; } void InitializeServerAccessControl() diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index fc233ffaebf93d..7b821d8648d949 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -1721,15 +1721,6 @@ - (void)testControllerServer ], }; -#if 0 - __auto_type * listOfStructsValue2 = @{ - MTRTypeKey : MTRArrayValueType, - MTRValueKey : @[ - @{ MTRDataKey: structValue2, }, - ], - }; -#endif - __auto_type responsePathFromRequestPath = ^(MTRAttributeRequestPath * path) { return [MTRAttributePath attributePathWithEndpointID:path.endpoint clusterID:path.cluster attributeID:path.attribute]; }; @@ -2007,32 +1998,60 @@ - (void)testControllerServer // Now do a wildcard read on the endpoint and check that this does the right // thing (gets the right things from descriptor, gets both clusters, etc). -#if 0 - // Unused bits ifdefed out until we doing more testing on the actual values - // we get back. __auto_type globalAttributePath = ^(NSNumber * clusterID, MTRAttributeIDType attributeID) { return [MTRAttributePath attributePathWithEndpointID:endpointId1 clusterID:clusterID attributeID:@(attributeID)]; }; + __auto_type descriptorAttributePath = ^(MTRAttributeIDType attributeID) { + return [MTRAttributePath attributePathWithEndpointID:endpointId1 clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(attributeID)]; + }; __auto_type unsignedIntValue = ^(NSUInteger value) { return @{ - MTRTypeKey: MTRUnsignedIntegerValueType, - MTRValueKey: @(value), + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(value), }; }; __auto_type arrayOfUnsignedIntegersValue = ^(NSArray * values) { __auto_type * mutableArray = [[NSMutableArray alloc] init]; for (NSNumber * value in values) { - [mutableArray addObject:@{ MTRDataKey: @{ - MTRTypeKey: MTRUnsignedIntegerValueType, - MTRValueKey: value, - }, }]; + [mutableArray addObject:@{ + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : value, + }, + }]; } return @{ - MTRTypeKey: MTRArrayValueType, - MTRValueKey: [mutableArray copy], - }; + MTRTypeKey : MTRArrayValueType, + MTRValueKey : [mutableArray copy], + }; }; -#endif + __auto_type endpoint1DeviceTypeValue = @{ + MTRTypeKey : MTRArrayValueType, + MTRValueKey : @[ + @{ + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(0), + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : deviceType1.deviceTypeID, + }, + }, + @{ + MTRContextTagKey : @(1), + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : deviceType1.deviceTypeRevision, + }, + }, + ], + } + }, + ], + }; + XCTestExpectation * wildcardReadExpectation = [self expectationWithDescription:@"Wildcard read of our endpoint"]; [baseDevice readAttributePaths:@[ [MTRAttributeRequestPath requestPathWithEndpointID:endpointId1 clusterID:nil attributeID:nil] ] eventPaths:nil @@ -2042,32 +2061,118 @@ - (void)testControllerServer XCTAssertNil(error); XCTAssertNotNil(values); - // TODO: Figure out how to test that values is correct that's not - // too fragile if things get returned in different valid order. - // For now just check that every path we got has a value, not an - // error. for (NSDictionary * value in values) { XCTAssertNotNil(value[MTRAttributePathKey]); XCTAssertNil(value[MTRErrorKey]); XCTAssertNotNil(value[MTRDataKey]); } -#if 0 - XCTAssertEqualObjects(values, @[ - // cluster1 - @{ MTRAttributePathKey: attribute1ResponsePath, - MTRDataKey: unsignedIntValue2, }, - @{ MTRAttributePathKey: globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeFeatureMapID), - MTRDataKey: unsignedIntValue(0), }, - @{ MTRAttributePathKey: globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeClusterRevisionID), - MTRDataKey: clusterRevision1, }, - @{ MTRAttributePathKey: globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID), - MTRDataKey: arrayOfUnsignedIntegersValue(@[]), }, - @{ MTRAttributePathKey: globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID), - MTRDataKey: arrayOfUnsignedIntegersValue(@[]), }, - // etc - - ]); -#endif + + NSSet *> * receivedValues = [NSSet setWithArray:values]; + NSSet *> * expectedValues = [NSSet setWithArray:@[ + // cluster1 + @ { + MTRAttributePathKey : attribute1ResponsePath, + MTRDataKey : unsignedIntValue2, + }, + // attribute3 requires Operate privileges to read, which we do not have + // for this cluster, so it will not be present here. + @ { + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeFeatureMapID), + MTRDataKey : unsignedIntValue(0), + }, + @ { + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeClusterRevisionID), + MTRDataKey : unsignedIntValue(clusterRevision1.unsignedIntegerValue), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeAttributeListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[ + attributeId1, @(0xFFF8), @(0xFFF9), @(0xFFFB), attributeId2, @(0xFFFC), @(0xFFFD) + ]), + }, + + // cluster2 + @ { + MTRAttributePathKey : attribute2ResponsePath, + MTRDataKey : listOfStructsValue1, + }, + @ { + MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeFeatureMapID), + MTRDataKey : unsignedIntValue(0), + }, + @ { + MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeClusterRevisionID), + MTRDataKey : unsignedIntValue(clusterRevision2.unsignedIntegerValue), + }, + @{MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeAttributeListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[ + @0xFFF8, @(0xFFF9), @(0xFFFB), attributeId2, @(0xFFFC), @(0xFFFD) + ]), + }, + + // descriptor + @ { + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID), + MTRDataKey : endpoint1DeviceTypeValue, + }, + @{ + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeClusterDescriptorAttributeServerListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[ clusterId1, clusterId2, @(MTRClusterIDTypeDescriptorID) ]), + }, + @{ + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeClusterDescriptorAttributeClientListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeClusterDescriptorAttributePartsListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + // No TagList attribute on this descriptor. + @ { + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeGlobalAttributeFeatureMapID), + MTRDataKey : unsignedIntValue(0), + }, + @ { + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeGlobalAttributeClusterRevisionID), + // Would be nice if we could get the Descriptor cluster revision + // from somewhere intead of hardcoding it... + MTRDataKey : unsignedIntValue(2), + }, + @{ + MTRAttributePathKey : globalAttributePath(@(MTRClusterIDTypeDescriptorID), MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(@(MTRClusterIDTypeDescriptorID), MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(@(MTRClusterIDTypeDescriptorID), MTRAttributeIDTypeGlobalAttributeAttributeListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[ + @(0), @(1), @(2), @(3), @(0xFFF8), @(0xFFF9), @(0xFFFB), @(0xFFFC), @(0xFFFD) + ]), + }, + + ]]; + + XCTAssertEqualObjects(receivedValues, expectedValues); + [wildcardReadExpectation fulfill]; }]; [self waitForExpectations:@[ wildcardReadExpectation ] timeout:kTimeoutInSeconds]; From 8b8dadd92b176b6d1c7d32d70a46ab3668d30e0f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 Jun 2024 18:16:24 -0400 Subject: [PATCH 064/162] Fix some random Darwin test failures due to timing dependency. (#33761) Some Darwin tests failed randomly if a subscription took longer than 10s to establish. Add test-only conditionals around the relevant code so we suppress that behavior in tests. --- src/darwin/Framework/CHIP/MTRDevice.mm | 28 +++++++++++++------ .../TestHelpers/MTRDeviceTestDelegate.m | 9 ++++++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 01f22543cde160..8d808324fe9765 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -383,6 +383,7 @@ - (BOOL)unitTestPretendThreadEnabled:(MTRDevice *)device; - (void)unitTestSubscriptionPoolDequeue:(MTRDevice *)device; - (void)unitTestSubscriptionPoolWorkComplete:(MTRDevice *)device; - (void)unitTestClusterDataPersisted:(MTRDevice *)device; +- (BOOL)unitTestSuppressTimeBasedReachabilityChanges:(MTRDevice *)device; @end #endif @@ -2026,15 +2027,24 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason MTR_LOG("%@ setting up subscription with reason: %@", self, reason); - // Set up a timer to mark as not reachable if it takes too long to set up a subscription - MTRWeakReference * weakSelf = [MTRWeakReference weakReferenceWithObject:self]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, static_cast(kSecondsToWaitBeforeMarkingUnreachableAfterSettingUpSubscription) * static_cast(NSEC_PER_SEC)), self.queue, ^{ - MTRDevice * strongSelf = weakSelf.strongObject; - if (strongSelf != nil) { - std::lock_guard lock(strongSelf->_lock); - [strongSelf _markDeviceAsUnreachableIfNeverSubscribed]; - } - }); + bool markUnreachableAfterWait = true; +#ifdef DEBUG + if (delegate && [delegate respondsToSelector:@selector(unitTestSuppressTimeBasedReachabilityChanges:)]) { + markUnreachableAfterWait = ![delegate unitTestSuppressTimeBasedReachabilityChanges:self]; + } +#endif + + if (markUnreachableAfterWait) { + // Set up a timer to mark as not reachable if it takes too long to set up a subscription + MTRWeakReference * weakSelf = [MTRWeakReference weakReferenceWithObject:self]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, static_cast(kSecondsToWaitBeforeMarkingUnreachableAfterSettingUpSubscription) * static_cast(NSEC_PER_SEC)), self.queue, ^{ + MTRDevice * strongSelf = weakSelf.strongObject; + if (strongSelf != nil) { + std::lock_guard lock(strongSelf->_lock); + [strongSelf _markDeviceAsUnreachableIfNeverSubscribed]; + } + }); + } [_deviceController getSessionForNode:_nodeID.unsignedLongLongValue diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRDeviceTestDelegate.m b/src/darwin/Framework/CHIPTests/TestHelpers/MTRDeviceTestDelegate.m index d896906fa99c01..740f5f71cf8b7c 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRDeviceTestDelegate.m +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRDeviceTestDelegate.m @@ -103,6 +103,15 @@ - (void)unitTestClusterDataPersisted:(MTRDevice *)device } } +- (BOOL)unitTestSuppressTimeBasedReachabilityChanges:(MTRDevice *)device +{ + // Allowing time-based reachability changes just makes the tests + // non-deterministic and can lead to random failures. Suppress them + // unconditionally for now. If we ever add tests that try to exercise that + // codepath, we can make this configurable. + return YES; +} + @end @implementation MTRDeviceTestDelegateWithSubscriptionSetupOverride From 321f8951c97fe44ad2b707a97f09e0ca95c961dc Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Wed, 5 Jun 2024 16:44:03 -0700 Subject: [PATCH 065/162] Fix the icd registerClient (#33738) * Fix the icd registerClient * address comments * Update ClusterCommand.h * Update ClusterCommand.h --- .../chip-tool/commands/clusters/ClusterCommand.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/chip-tool/commands/clusters/ClusterCommand.h b/examples/chip-tool/commands/clusters/ClusterCommand.h index fe20f4f36b9f84..ac141fb012e259 100644 --- a/examples/chip-tool/commands/clusters/ClusterCommand.h +++ b/examples/chip-tool/commands/clusters/ClusterCommand.h @@ -118,9 +118,13 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub if (data != nullptr) { - LogErrorOnFailure(RemoteDataModelLogger::LogCommandAsJSON(path, data)); - - error = DataModelLogger::LogCommand(path, data); + { + // log a snapshot to not advance the data reader. + chip::TLV::TLVReader logTlvReader; + logTlvReader.Init(*data); + LogErrorOnFailure(RemoteDataModelLogger::LogCommandAsJSON(path, &logTlvReader)); + error = DataModelLogger::LogCommand(path, &logTlvReader); + } if (CHIP_NO_ERROR != error) { ChipLogError(chipTool, "Response Failure: Can not decode Data"); @@ -128,8 +132,9 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub return; } if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) && - (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClient::Id)) + (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::Id)) { + // log a snapshot to not advance the data reader. chip::TLV::TLVReader counterTlvReader; counterTlvReader.Init(*data); chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value; @@ -139,7 +144,6 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub ChipLogError(chipTool, "Failed to decode ICD counter: %" CHIP_ERROR_FORMAT, err.Format()); return; } - chip::app::ICDClientInfo clientInfo; clientInfo.peer_node = mScopedNodeId; clientInfo.monitored_subject = mMonitoredSubject; From 9c7fbe826954656c39b06c9543e75d6c3fde7082 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 6 Jun 2024 00:27:29 -0700 Subject: [PATCH 066/162] Allows Fabric Admin to process command other than console (#33765) --- .../fabric-sync/FabricSyncCommand.cpp | 7 --- .../interactive/InteractiveCommands.cpp | 44 ++++++++++++++++++- .../interactive/InteractiveCommands.h | 2 + .../pairing/OpenCommissioningWindowCommand.h | 1 + 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp index c2a1b5df8fb80e..38ea541dab5873 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -22,13 +22,6 @@ #include #if defined(PW_RPC_ENABLED) -#include "pw_assert/check.h" -#include "pw_hdlc/decoder.h" -#include "pw_hdlc/default_addresses.h" -#include "pw_hdlc/rpc_channel.h" -#include "pw_rpc/client.h" -#include "pw_stream/socket_stream.h" - #include #endif diff --git a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp index c5c844256f5351..4b767c460c1f87 100644 --- a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp +++ b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #if defined(PW_RPC_ENABLED) @@ -44,6 +45,26 @@ constexpr uint16_t kRetryIntervalS = 5; // File pointer for the log file FILE * sLogFile = nullptr; +std::queue sCommandQueue; +std::mutex sQueueMutex; +std::condition_variable sQueueCondition; + +void ReadCommandThread() +{ + char * command; + while (true) + { + command = readline(kInteractiveModePrompt); + if (command != nullptr && *command) + { + std::unique_lock lock(sQueueMutex); + sCommandQueue.push(command); + free(command); + sQueueCondition.notify_one(); + } + } +} + void OpenLogFile(const char * filePath) { sLogFile = fopen(filePath, "a"); @@ -113,13 +134,22 @@ void ExecuteDeferredConnect(intptr_t ignored) char * InteractiveStartCommand::GetCommand(char * command) { + std::unique_lock lock(sQueueMutex); + sQueueCondition.wait(lock, [&] { return !sCommandQueue.empty(); }); + + std::string cmd = sCommandQueue.front(); + sCommandQueue.pop(); + if (command != nullptr) { free(command); command = nullptr; } - command = readline(kInteractiveModePrompt); + command = new char[cmd.length() + 1]; + strcpy(command, cmd.c_str()); + + ChipLogProgress(NotSpecified, "GetCommand: %s", command); // Do not save empty lines if (command != nullptr && *command) @@ -168,6 +198,9 @@ CHIP_ERROR InteractiveStartCommand::RunCommand() DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredConnect, 0); #endif + std::thread readCommands(ReadCommandThread); + readCommands.detach(); + char * command = nullptr; int status; while (true) @@ -213,3 +246,12 @@ bool InteractiveCommand::NeedsOperationalAdvertising() { return mAdvertiseOperational.ValueOr(true); } + +void PushCommand(const std::string & command) +{ + std::unique_lock lock(sQueueMutex); + + ChipLogProgress(NotSpecified, "PushCommand: %s", command.c_str()); + sCommandQueue.push(command); + sQueueCondition.notify_one(); +} diff --git a/examples/fabric-admin/commands/interactive/InteractiveCommands.h b/examples/fabric-admin/commands/interactive/InteractiveCommands.h index a0b490f3b668e5..e3d28080657e26 100644 --- a/examples/fabric-admin/commands/interactive/InteractiveCommands.h +++ b/examples/fabric-admin/commands/interactive/InteractiveCommands.h @@ -64,3 +64,5 @@ class InteractiveStartCommand : public InteractiveCommand char * GetCommand(char * command); std::string GetHistoryFilePath() const; }; + +void PushCommand(const std::string & command); diff --git a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h index 2c1d62f31c566b..5bf6fd986f1947 100644 --- a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h +++ b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h @@ -43,6 +43,7 @@ class OpenCommissioningWindowCommand : public CHIPCommand /////////// CHIPCommand Interface ///////// CHIP_ERROR RunCommand() override; + // We issue multiple data model operations for this command, and the default // timeout for those is 10 seconds, so default to 20 seconds. chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(20)); } From be9409098865cf2fb9358b285a35d00b59352760 Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Thu, 6 Jun 2024 11:35:48 +0300 Subject: [PATCH 067/162] [Telink] Update default CI app/SoC & Update builds to docker version 54 (#33726) * [Telink] Update default CI app/SoC builds * [Telink] Update builds to docker version 54 * [Telink] disable debug part --- .github/workflows/bloat_check.yaml | 2 +- .github/workflows/build.yaml | 10 ++--- .github/workflows/chef.yaml | 10 ++--- .github/workflows/cirque.yaml | 2 +- .github/workflows/doxygen.yaml | 2 +- .github/workflows/examples-ameba.yaml | 2 +- .github/workflows/examples-asr.yaml | 2 +- .github/workflows/examples-bouffalolab.yaml | 2 +- .github/workflows/examples-cc13xx_26xx.yaml | 2 +- .github/workflows/examples-cc32xx.yaml | 2 +- .github/workflows/examples-efr32.yaml | 2 +- .github/workflows/examples-esp32.yaml | 4 +- .github/workflows/examples-infineon.yaml | 2 +- .github/workflows/examples-linux-arm.yaml | 2 +- .github/workflows/examples-linux-imx.yaml | 2 +- .../workflows/examples-linux-standalone.yaml | 2 +- .../examples-linux-tv-casting-app.yaml | 2 +- .github/workflows/examples-mbed.yaml | 2 +- .github/workflows/examples-mw320.yaml | 2 +- .github/workflows/examples-nrfconnect.yaml | 2 +- .github/workflows/examples-nuttx.yaml | 2 +- .github/workflows/examples-nxp.yaml | 2 +- .github/workflows/examples-openiotsdk.yaml | 2 +- .github/workflows/examples-qpg.yaml | 2 +- .github/workflows/examples-rw61x.yaml | 2 +- .github/workflows/examples-stm32.yaml | 2 +- .github/workflows/examples-telink.yaml | 44 +++++++++---------- .github/workflows/examples-tizen.yaml | 2 +- .github/workflows/full-android.yaml | 2 +- .github/workflows/fuzzing-build.yaml | 2 +- .github/workflows/java-tests.yaml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/minimal-build.yaml | 4 +- .github/workflows/qemu.yaml | 4 +- .github/workflows/release_artifacts.yaml | 4 +- .github/workflows/smoketest-android.yaml | 2 +- .github/workflows/tests.yaml | 4 +- .github/workflows/unit_integration_test.yaml | 2 +- .github/workflows/zap_regeneration.yaml | 2 +- .github/workflows/zap_templates.yaml | 2 +- examples/all-clusters-app/ameba/README.md | 4 +- .../all-clusters-minimal-app/ameba/README.md | 4 +- examples/light-switch-app/ameba/README.md | 4 +- examples/lighting-app/ameba/README.md | 4 +- examples/ota-requestor-app/ameba/README.md | 4 +- examples/pigweed-app/ameba/README.md | 4 +- integrations/cloudbuild/chef.yaml | 8 ++-- integrations/cloudbuild/smoke-test.yaml | 14 +++--- 48 files changed, 97 insertions(+), 97 deletions(-) diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index d4aa3a2fcc342c..a1b93c882bf64f 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 190a71f2c167dd..64e6b99a05d02a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -138,7 +138,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -281,7 +281,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -342,7 +342,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -451,7 +451,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 7531d97c00a10c..77c1a21be6b388 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 options: --user root steps: @@ -56,7 +56,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:53 + image: ghcr.io/project-chip/chip-build-esp32:54 options: --user root steps: @@ -77,7 +77,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:53 + image: ghcr.io/project-chip/chip-build-nrf-platform:54 options: --user root steps: @@ -98,7 +98,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:53 + image: ghcr.io/project-chip/chip-build-telink:54 options: --user root steps: @@ -110,7 +110,7 @@ jobs: platform: telink # - name: Update Zephyr to specific revision (for developers purpose) # shell: bash - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 68deadeb5c20b82d68700e720d4580e8003bf1d8" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 0e8032dfef7e02498f34ba0b5d5d2df71a62adb1" - name: CI Examples Telink shell: bash run: | diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 1f30377b83dcf2..b3e2f9d1086ee8 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -42,7 +42,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: ghcr.io/project-chip/chip-build-cirque:53 + # image: ghcr.io/project-chip/chip-build-cirque:54 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index cdd535b382f3e5..abe0568fb9e011 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:53 + image: ghcr.io/project-chip/chip-build-doxygen:54 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index a75593e4240b81..7c098ea57f2403 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:53 + image: ghcr.io/project-chip/chip-build-ameba:54 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index bd6287b1a7c656..f238d10a5cf6b3 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:53 + image: ghcr.io/project-chip/chip-build-asr:54 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index ab1ba6acdb2360..12b033b791f900 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:53 + image: ghcr.io/project-chip/chip-build-bouffalolab:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index 8d26fe6fa88adc..abdc5605ada47b 100644 --- a/.github/workflows/examples-cc13xx_26xx.yaml +++ b/.github/workflows/examples-cc13xx_26xx.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:53 + image: ghcr.io/project-chip/chip-build-ti:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index e0509250c39a18..564cd34dddd5b2 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:53 + image: ghcr.io/project-chip/chip-build-ti:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 39d61fb09f2608..c44b24f02f49bd 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:53 + image: ghcr.io/project-chip/chip-build-efr32:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index c8170de4e0fec9..92415c0ce96930 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:53 + image: ghcr.io/project-chip/chip-build-esp32:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -126,7 +126,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:53 + image: ghcr.io/project-chip/chip-build-esp32:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index a7a1fb1ab14b14..290e67273f9bd3 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-infineon:53 + image: ghcr.io/project-chip/chip-build-infineon:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index f8e7632c60e0ed..4bf103ddae4542 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:53 + image: ghcr.io/project-chip/chip-build-crosscompile:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index dd053382ccf079..ab32eef0801353 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:53 + image: ghcr.io/project-chip/chip-build-imx:54 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index b020b0cff1a1a3..eb97e63235e714 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml index 84ab3bfa137c0e..d18de64382ee6a 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 steps: - name: Checkout diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index a774fbf52f1ae7..3516c721fa157f 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-mbed-os:53 + image: ghcr.io/project-chip/chip-build-mbed-os:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 8b489aec59e5dd..780543a70d1f11 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 8689925c6f35f6..c8d997d5ca6631 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:53 + image: ghcr.io/project-chip/chip-build-nrf-platform:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index a074e17bedb029..5ffd19b1319ff5 100644 --- a/.github/workflows/examples-nuttx.yaml +++ b/.github/workflows/examples-nuttx.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nuttx:53 + image: ghcr.io/project-chip/chip-build-nuttx:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index f437461ea8c5bb..05d434b0a67792 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:53 + image: ghcr.io/project-chip/chip-build-k32w:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index c2fbe82b806bfa..2f878ea48e4540 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:53 + image: ghcr.io/project-chip/chip-build-openiotsdk:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 29bdb3f8abae12..2bb85ad4acbfac 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-rw61x.yaml b/.github/workflows/examples-rw61x.yaml index efc56c2ec125c8..eed41f209ed61d 100644 --- a/.github/workflows/examples-rw61x.yaml +++ b/.github/workflows/examples-rw61x.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-rw61x:53 + image: ghcr.io/project-chip/chip-build-rw61x:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 050ec72a48db5a..809861cdee179e 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 331ee5543932e9..6c836294381a0f 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:53 + image: ghcr.io/project-chip/chip-build-telink:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -57,7 +57,7 @@ jobs: gh-context: ${{ toJson(github) }} # - name: Update Zephyr to specific revision (for developers purpose) - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 68deadeb5c20b82d68700e720d4580e8003bf1d8" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 0e8032dfef7e02498f34ba0b5d5d2df71a62adb1" - name: Build example Telink (B92 retention) Air Quality Sensor App run: | @@ -95,13 +95,13 @@ jobs: - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B91) Bridge App + - name: Build example Telink (B95) Bridge App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-bridge' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9258a-bridge' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9518adk80d bridge-app \ - out/telink-tlsr9518adk80d-bridge/zephyr/zephyr.elf \ + telink tlsr9258a bridge-app \ + out/telink-tlsr9258a-bridge/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output @@ -177,37 +177,37 @@ jobs: - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B91) OTA Requestor App + - name: Build example Telink (B95) OTA Requestor App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-ota-requestor' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9258a-ota-requestor' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9518adk80d ota-requestor-app \ - out/telink-tlsr9518adk80d-ota-requestor/zephyr/zephyr.elf \ + telink tlsr9258a ota-requestor-app \ + out/telink-tlsr9258a-ota-requestor/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B95) Pump App + - name: Build example Telink (B91) Pump App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9258a-pump' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9258a pump-app \ - out/telink-tlsr9258a-pump/zephyr/zephyr.elf \ + telink tlsr9518adk80d pump-app \ + out/telink-tlsr9518adk80d-pump/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output run: rm -rf ./out - - name: Build example Telink (W91) Pump Controller App + - name: Build example Telink (B91) Pump Controller App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-pump-controller' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-controller' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9118bdk40d pump-controller-app \ - out/telink-tlsr9118bdk40d-pump-controller/zephyr/zephyr.elf \ + telink tlsr9518adk80d pump-controller-app \ + out/telink-tlsr9518adk80d-pump-controller/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output @@ -261,13 +261,13 @@ jobs: - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B95) Window Covering App + - name: Build example Telink (W91) Window Covering App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9258a-window-covering' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-window-covering' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9258a window-covering \ - out/telink-tlsr9258a-window-covering/zephyr/zephyr.elf \ + telink tlsr9118bdk40d window-covering \ + out/telink-tlsr9118bdk40d-window-covering/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 295f6d158c87d9..ae5a847026d3c1 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:53 + image: ghcr.io/project-chip/chip-build-tizen:54 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index eec019ed11b85d..c86839d8f51708 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:53 + image: ghcr.io/project-chip/chip-build-android:54 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 55d0ccd18c75e1..30b697c5f1f6ce 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 16bec4c8187ca3..ff734d2d4fe338 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:53 + image: ghcr.io/project-chip/chip-build-java:54 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bd5385580b9c22..2b5bbeff0fe465 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:50 + image: ghcr.io/project-chip/chip-build:54 steps: - name: Checkout diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 7e2170baedf5b5..6fd9a96e151ec6 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:53 + image: ghcr.io/project-chip/chip-build-minimal:54 steps: - name: Checkout @@ -55,7 +55,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:50 + image: ghcr.io/project-chip/chip-build-minimal:54 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 8129351ce9bf7c..bff12a5999586e 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:53 + image: ghcr.io/project-chip/chip-build-esp32-qemu:54 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -78,7 +78,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen-qemu:53 + image: ghcr.io/project-chip/chip-build-tizen-qemu:54 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 2605f723edf5ff..178bc028ea6b46 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-esp32:53 + image: ghcr.io/project-chip/chip-build-esp32:54 steps: - name: Checkout @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:53 + image: ghcr.io/project-chip/chip-build-efr32:54 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 90afb58f5f06ec..014573614a0448 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:53 + image: ghcr.io/project-chip/chip-build-android:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 24895bf5f07e01..78c6d7347725ef 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -440,7 +440,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index fc209e42ea7b01..c1d3bebddde5ae 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 1ce0250f6a623e..81ffbcbb3b057a 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index fb2d2de06becfd..987cc82a2e3f06 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 defaults: run: shell: sh diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 831933d86e6d25..adf6e590593fd7 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -27,11 +27,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index 12e9ff5eca1a71..b4e72ca32d02b5 100644 --- a/examples/all-clusters-minimal-app/ameba/README.md +++ b/examples/all-clusters-minimal-app/ameba/README.md @@ -27,13 +27,13 @@ The CHIP demo application is supported on - Pull docker image: ``` - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 ``` - Setup build environment: diff --git a/examples/light-switch-app/ameba/README.md b/examples/light-switch-app/ameba/README.md index 8bf606b1381042..3476d6d8cd5317 100644 --- a/examples/light-switch-app/ameba/README.md +++ b/examples/light-switch-app/ameba/README.md @@ -26,11 +26,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index 8d4c0fc79acc09..b170e9026325f8 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -23,11 +23,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/examples/ota-requestor-app/ameba/README.md b/examples/ota-requestor-app/ameba/README.md index fd262c6a029030..a5de1316eb523c 100644 --- a/examples/ota-requestor-app/ameba/README.md +++ b/examples/ota-requestor-app/ameba/README.md @@ -6,11 +6,11 @@ A prototype application that demonstrates OTA Requestor capabilities. - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/examples/pigweed-app/ameba/README.md b/examples/pigweed-app/ameba/README.md index d997bccd5353c4..7086f7fe87e7ac 100644 --- a/examples/pigweed-app/ameba/README.md +++ b/examples/pigweed-app/ameba/README.md @@ -31,11 +31,11 @@ following features are available: - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 220d147bce4fb5..7ff067f725d3f4 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" # NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting # jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3) env: @@ -23,7 +23,7 @@ steps: - name: pwenv path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -38,7 +38,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" env: - PW_ENVIRONMENT_ROOT=/pwenv args: diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index d418f9cd2ec63c..c8e49945881484 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" # NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting # jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3) env: @@ -24,7 +24,7 @@ steps: path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: ESP32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -45,7 +45,7 @@ steps: volumes: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: NRFConnect env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -66,7 +66,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: EFR32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -88,7 +88,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: Linux env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -141,7 +141,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: Android env: - PW_ENVIRONMENT_ROOT=/pwenv From d15f6c13b68651e7724dd12deb87b57902b51bfe Mon Sep 17 00:00:00 2001 From: Sting Chang <33673360+stingchang@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:50:07 +0800 Subject: [PATCH 068/162] Enable chef robotic vacuum cleaner device (#33258) * Enable chef robotic vacuum cleaner device * Restyled by whitespace * Restyled by clang-format * remove old rvc feature * Restyled by clang-format * update return status * Restyled by whitespace * Restyled by clang-format * add back ifdef; remove old feature flag * Restyled by clang-format * write read attributes into buffer * Restyled by clang-format * update readCallback write buffer * Restyled by whitespace * update buffer read in read call back * Restyled by clang-format * use static instance * Restyled by clang-format * write attribute into buffer in callback * use unique_ptr * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../chef/common/chef-rvc-mode-delegate.cpp | 155 +++++++--- examples/chef/common/chef-rvc-mode-delegate.h | 20 ++ .../chef-rvc-operational-state-delegate.cpp | 208 +++++++++---- .../chef-rvc-operational-state-delegate.h | 71 ++--- examples/chef/common/stubs.cpp | 32 ++ ...ode_roboticvacuumcleaner_1807ff0c49.matter | 276 ++++++++++++++++++ ...otnode_roboticvacuumcleaner_1807ff0c49.zap | 245 +++++++++++++++- integrations/cloudbuild/chef.yaml | 2 +- 8 files changed, 862 insertions(+), 147 deletions(-) diff --git a/examples/chef/common/chef-rvc-mode-delegate.cpp b/examples/chef/common/chef-rvc-mode-delegate.cpp index 20f3afbbd5592d..32b4cad0236899 100644 --- a/examples/chef/common/chef-rvc-mode-delegate.cpp +++ b/examples/chef/common/chef-rvc-mode-delegate.cpp @@ -18,17 +18,20 @@ #include #include +using namespace chip; +using namespace chip::app; using namespace chip::app::Clusters; using chip::Protocols::InteractionModel::Status; template using List = chip::app::DataModel::List; using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type; -#ifdef ZCL_USING_RVC_RUN_MODE_CLUSTER_SERVER +#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER #include using namespace chip::app::Clusters::RvcRunMode; -static RvcRunModeDelegate * gRvcRunModeDelegate = nullptr; -static ModeBase::Instance * gRvcRunModeInstance = nullptr; + +static std::unique_ptr gRvcRunModeDelegate; +static std::unique_ptr gRvcRunModeInstance; CHIP_ERROR RvcRunModeDelegate::Init() { @@ -87,40 +90,82 @@ CHIP_ERROR RvcRunModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, ListattributeId; + + switch (attributeId) { - delete gRvcRunModeInstance; - gRvcRunModeInstance = nullptr; + case chip::app::Clusters::RvcRunMode::Attributes::CurrentMode::Id: { + uint8_t m = static_cast(buffer[0]); + ret = gRvcRunModeInstance->UpdateCurrentMode(m); + if (chip::Protocols::InteractionModel::Status::Success != ret) + { + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %d", static_cast(ret)); + } } - if (gRvcRunModeDelegate != nullptr) + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedWrite; + ChipLogError(DeviceLayer, "Unsupported Writng Attribute ID: %d", static_cast(attributeId)); + break; + } + + return ret; +} + +chip::Protocols::InteractionModel::Status chefRvcRunModeReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) +{ + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + chip::AttributeId attributeId = attributeMetadata->attributeId; + + switch (attributeId) { - delete gRvcRunModeDelegate; - gRvcRunModeDelegate = nullptr; + case chip::app::Clusters::RvcRunMode::Attributes::CurrentMode::Id: { + *buffer = gRvcRunModeInstance->GetCurrentMode(); + ChipLogDetail(DeviceLayer, "Reading RunMode CurrentMode : %d", static_cast(attributeId)); + } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedRead; + ChipLogDetail(DeviceLayer, "Unsupported attributeId %d from reading RvcRunMode", static_cast(attributeId)); + break; } + + return ret; } void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gRvcRunModeDelegate == nullptr && gRvcRunModeInstance == nullptr); - gRvcRunModeDelegate = new RvcRunMode::RvcRunModeDelegate; - gRvcRunModeInstance = - new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, chip::to_underlying(RvcRunMode::Feature::kOnOff)); + VerifyOrDie(!gRvcRunModeDelegate && !gRvcRunModeInstance); + + gRvcRunModeDelegate = std::make_unique(); + gRvcRunModeInstance = std::make_unique(gRvcRunModeDelegate.get(), endpointId, RvcRunMode::Id, + chip::to_underlying(RvcRunMode::Feature::kNoFeatures)); gRvcRunModeInstance->Init(); } -#ifdef ZCL_USING_RVC_CLEAN_MODE_CLUSTER_SERVER +#endif // MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER + +#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER #include using namespace chip::app::Clusters::RvcCleanMode; -static RvcCleanModeDelegate * gRvcCleanModeDelegate = nullptr; -static ModeBase::Instance * gRvcCleanModeInstance = nullptr; +static std::unique_ptr gRvcCleanModeDelegate; +static std::unique_ptr gRvcCleanModeInstance; CHIP_ERROR RvcCleanModeDelegate::Init() { @@ -178,33 +223,75 @@ CHIP_ERROR RvcCleanModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, ListattributeId; + + switch (attributeId) { - delete gRvcCleanModeInstance; - gRvcCleanModeInstance = nullptr; + case chip::app::Clusters::RvcCleanMode::Attributes::CurrentMode::Id: { + uint8_t m = static_cast(buffer[0]); + ret = gRvcCleanModeInstance->UpdateCurrentMode(m); + if (chip::Protocols::InteractionModel::Status::Success != ret) + { + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %d", static_cast(ret)); + } + } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedWrite; + ChipLogError(DeviceLayer, "Unsupported Attribute ID: %d", static_cast(attributeId)); + break; } - if (gRvcCleanModeDelegate != nullptr) + + return ret; +} + +chip::Protocols::InteractionModel::Status chefRvcCleanModeReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) +{ + VerifyOrReturnValue(maxReadLength > 0, chip::Protocols::InteractionModel::Status::ResourceExhausted); + buffer[0] = gRvcCleanModeInstance->GetCurrentMode(); + + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + chip::AttributeId attributeId = attributeMetadata->attributeId; + + switch (attributeId) { - delete gRvcCleanModeDelegate; - gRvcCleanModeDelegate = nullptr; + case chip::app::Clusters::RvcCleanMode::Attributes::CurrentMode::Id: { + *buffer = gRvcCleanModeInstance->GetCurrentMode(); + ChipLogDetail(DeviceLayer, "Reading CleanMode CurrentMode : %d", static_cast(attributeId)); } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedRead; + ChipLogDetail(DeviceLayer, "Unsupported attributeId %d from reading RvcCleanMode", static_cast(attributeId)); + break; + } + + return ret; } void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gRvcCleanModeDelegate == nullptr && gRvcCleanModeInstance == nullptr); - gRvcCleanModeDelegate = new RvcCleanMode::RvcCleanModeDelegate; - gRvcCleanModeInstance = - new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, chip::to_underlying(RvcCleanMode::Feature::kOnOff)); + VerifyOrDie(!gRvcCleanModeDelegate && !gRvcCleanModeInstance); + + gRvcCleanModeDelegate = std::make_unique(); + gRvcCleanModeInstance = std::make_unique(gRvcCleanModeDelegate.get(), endpointId, RvcCleanMode::Id, + chip::to_underlying(RvcCleanMode::Feature::kNoFeatures)); gRvcCleanModeInstance->Init(); } -#endif // ZCL_USING_RVC_CLEAN_MODE_CLUSTER_SERVER -#endif // ZCL_USING_RVC_RUN_MODE_CLUSTER_SERVER +#endif // MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER diff --git a/examples/chef/common/chef-rvc-mode-delegate.h b/examples/chef/common/chef-rvc-mode-delegate.h index 5f96957420a441..359c90c5a08162 100644 --- a/examples/chef/common/chef-rvc-mode-delegate.h +++ b/examples/chef/common/chef-rvc-mode-delegate.h @@ -23,6 +23,8 @@ #include #include +using chip::Protocols::InteractionModel::Status; + namespace chip { namespace app { namespace Clusters { @@ -118,3 +120,21 @@ void Shutdown(); } // namespace Clusters } // namespace app } // namespace chip + +#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER +chip::Protocols::InteractionModel::Status chefRvcRunModeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +chip::Protocols::InteractionModel::Status chefRvcRunModeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); +#endif // MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER + +#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER +chip::Protocols::InteractionModel::Status chefRvcCleanModeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +chip::Protocols::InteractionModel::Status chefRvcCleanModeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); +#endif // MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER diff --git a/examples/chef/common/chef-rvc-operational-state-delegate.cpp b/examples/chef/common/chef-rvc-operational-state-delegate.cpp index 9ea4e610e64fb1..36ff3e88fcd181 100644 --- a/examples/chef/common/chef-rvc-operational-state-delegate.cpp +++ b/examples/chef/common/chef-rvc-operational-state-delegate.cpp @@ -17,17 +17,31 @@ */ #include #include - -#ifdef ZCL_USING_OPERATIONAL_STATE_RVC_CLUSTER_SERVER #include +#include +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::OperationalState; using namespace chip::app::Clusters::RvcOperationalState; +using chip::Protocols::InteractionModel::Status; + +static std::unique_ptr gRvcOperationalStateDelegate; +static std::unique_ptr gRvcOperationalStateInstance; + +static void onOperationalStateTimerTick(System::Layer * systemLayer, void * data); + +DataModel::Nullable RvcOperationalStateDelegate::GetCountdownTime() +{ + if (mRunningTime > mPhaseDuration.Value()) + return DataModel::NullNullable; -CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) + return DataModel::MakeNullable((uint32_t) (mPhaseDuration.Value() - mRunningTime)); +} + +CHIP_ERROR RvcOperationalStateDelegate::GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) { if (index >= mOperationalStateList.size()) { @@ -37,7 +51,7 @@ CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_ return CHIP_NO_ERROR; } -CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_t index, MutableCharSpan & operationalPhase) +CHIP_ERROR RvcOperationalStateDelegate::GetOperationalPhaseAtIndex(size_t index, MutableCharSpan & operationalPhase) { if (index >= mOperationalPhaseList.size()) { @@ -46,125 +60,203 @@ CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_ return CopyCharSpanToMutableCharSpan(mOperationalPhaseList[index], operationalPhase); } -void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperationalError & err) +void RvcOperationalStateDelegate::HandlePauseStateCallback(GenericOperationalError & err) { // placeholder implementation auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)); if (error == CHIP_NO_ERROR) { - err.Set(to_underlying(ErrorStateEnum::kNoError)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); } else { - err.Set(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); } } -void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOperationalError & err) +void RvcOperationalStateDelegate::HandleResumeStateCallback(GenericOperationalError & err) { // placeholder implementation - auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) { - err.Set(to_underlying(ErrorStateEnum::kNoError)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); } else { - err.Set(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); } } -void GenericOperationalStateDelegateImpl::HandleStartStateCallback(GenericOperationalError & err) +void RvcOperationalStateDelegate::HandleStartStateCallback(GenericOperationalError & err) { + OperationalState::GenericOperationalError current_err(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + GetInstance()->GetCurrentOperationalError(current_err); + + if (current_err.errorStateID != to_underlying(OperationalState::ErrorStateEnum::kNoError)) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume)); + return; + } + // placeholder implementation - auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) { - err.Set(to_underlying(ErrorStateEnum::kNoError)); + (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(1), onOperationalStateTimerTick, this); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); } else { - err.Set(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); } } -void GenericOperationalStateDelegateImpl::HandleStopStateCallback(GenericOperationalError & err) +void RvcOperationalStateDelegate::HandleStopStateCallback(GenericOperationalError & err) { // placeholder implementation - auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kStopped)); + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)); if (error == CHIP_NO_ERROR) { - err.Set(to_underlying(ErrorStateEnum::kNoError)); + (void) DeviceLayer::SystemLayer().CancelTimer(onOperationalStateTimerTick, this); + + OperationalState::GenericOperationalError current_err(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + GetInstance()->GetCurrentOperationalError(current_err); + + Optional> totalTime((DataModel::Nullable(mRunningTime + mPausedTime))); + Optional> pausedTime((DataModel::Nullable(mPausedTime))); + + GetInstance()->OnOperationCompletionDetected(static_cast(current_err.errorStateID), totalTime, pausedTime); + + mRunningTime = 0; + mPausedTime = 0; + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); } else { - err.Set(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); } } +static void onOperationalStateTimerTick(System::Layer * systemLayer, void * data) +{ + RvcOperationalStateDelegate * delegate = reinterpret_cast(data); -// Init Operational State cluster + OperationalState::Instance * instance = gRvcOperationalStateInstance.get(); + OperationalState::OperationalStateEnum state = + static_cast(instance->GetCurrentOperationalState()); -static OperationalState::Instance * gOperationalStateInstance = nullptr; -static OperationalStateDelegate * gOperationalStateDelegate = nullptr; + auto countdown_time = delegate->GetCountdownTime(); -void OperationalState::Shutdown() -{ - if (gOperationalStateInstance != nullptr) + if (countdown_time.ValueOr(1) > 0) { - delete gOperationalStateInstance; - gOperationalStateInstance = nullptr; + if (state == OperationalState::OperationalStateEnum::kRunning) + { + delegate->mRunningTime++; + } + else if (state == OperationalState::OperationalStateEnum::kPaused) + { + delegate->mPausedTime++; + } } - if (gOperationalStateDelegate != nullptr) + + if (state == OperationalState::OperationalStateEnum::kRunning || state == OperationalState::OperationalStateEnum::kPaused) { - delete gOperationalStateDelegate; - gOperationalStateDelegate = nullptr; + (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(1), onOperationalStateTimerTick, delegate); + } + else + { + (void) DeviceLayer::SystemLayer().CancelTimer(onOperationalStateTimerTick, delegate); } } -void emberAfOperationalStateClusterInitCallback(chip::EndpointId endpointId) +void RvcOperationalState::Shutdown() { - VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gOperationalStateInstance == nullptr && gOperationalStateDelegate == nullptr); + gRvcOperationalStateInstance.reset(); + gRvcOperationalStateDelegate.reset(); +} - gOperationalStateDelegate = new OperationalStateDelegate; - EndpointId operationalStateEndpoint = 0x01; - gOperationalStateInstance = new OperationalState::Instance(gOperationalStateDelegate, operationalStateEndpoint); +chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(chip::EndpointId endpointId, + chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) +{ + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. + VerifyOrDie(gRvcOperationalStateInstance != nullptr); + chip::AttributeId attributeId = attributeMetadata->attributeId; - gOperationalStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)); + switch (attributeId) + { + case chip::app::Clusters::RvcOperationalState::Attributes::CurrentPhase::Id: { + uint8_t m = static_cast(buffer[0]); + DataModel::Nullable aPhase(m); + CHIP_ERROR err = gRvcOperationalStateInstance->SetCurrentPhase(aPhase); + if (CHIP_NO_ERROR == err) + { + break; + } + ret = chip::Protocols::InteractionModel::Status::ConstraintError; + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %" CHIP_ERROR_FORMAT, err.Format()); + } + break; + case chip::app::Clusters::RvcOperationalState::Attributes::OperationalState::Id: { + uint8_t m = static_cast(buffer[0]); + CHIP_ERROR err = gRvcOperationalStateInstance->SetOperationalState(m); + if (CHIP_NO_ERROR == err) + { + break; + } + ret = chip::Protocols::InteractionModel::Status::ConstraintError; + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %" CHIP_ERROR_FORMAT, err.Format()); + } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedAttribute; + ChipLogError(DeviceLayer, "Unsupported Attribute ID: %d", static_cast(attributeId)); + break; + } - gOperationalStateInstance->Init(); + return ret; } -// Init RVC Operational State cluster - -static RvcOperationalState::Instance * gRvcOperationalStateInstance = nullptr; -static RvcOperationalStateDelegate * gRvcOperationalStateDelegate = nullptr; - -void RvcOperationalState::Shutdown() +chip::Protocols::InteractionModel::Status chefRvcOperationalStateReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { - if (gRvcOperationalStateInstance != nullptr) + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + chip::AttributeId attributeId = attributeMetadata->attributeId; + switch (attributeId) { - delete gRvcOperationalStateInstance; - gRvcOperationalStateInstance = nullptr; + case chip::app::Clusters::RvcOperationalState::Attributes::CurrentPhase::Id: { + + app::DataModel::Nullable currentPhase = gRvcOperationalStateInstance->GetCurrentPhase(); + if (currentPhase.IsNull()) + { + ret = chip::Protocols::InteractionModel::Status::UnsupportedAttribute; + break; + } + *buffer = currentPhase.Value(); } - if (gRvcOperationalStateDelegate != nullptr) - { - delete gRvcOperationalStateDelegate; - gRvcOperationalStateDelegate = nullptr; + break; + case chip::app::Clusters::RvcOperationalState::Attributes::OperationalState::Id: { + *buffer = gRvcOperationalStateInstance->GetCurrentOperationalState(); } + break; + default: + ChipLogError(DeviceLayer, "Unsupported Attribute ID: %d", static_cast(attributeId)); + break; + } + + return ret; } void emberAfRvcOperationalStateClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gRvcOperationalStateInstance == nullptr && gRvcOperationalStateDelegate == nullptr); - - gRvcOperationalStateDelegate = new RvcOperationalStateDelegate; - EndpointId operationalStateEndpoint = 0x01; - gRvcOperationalStateInstance = new RvcOperationalState::Instance(gRvcOperationalStateDelegate, operationalStateEndpoint); - - gRvcOperationalStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)); + VerifyOrDie(!gRvcOperationalStateDelegate && !gRvcOperationalStateInstance); + gRvcOperationalStateDelegate = std::make_unique(); + gRvcOperationalStateInstance = std::make_unique(gRvcOperationalStateDelegate.get(), endpointId); gRvcOperationalStateInstance->Init(); } #endif // MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER diff --git a/examples/chef/common/chef-rvc-operational-state-delegate.h b/examples/chef/common/chef-rvc-operational-state-delegate.h index f487e38000771d..33b01d55201466 100644 --- a/examples/chef/common/chef-rvc-operational-state-delegate.h +++ b/examples/chef/common/chef-rvc-operational-state-delegate.h @@ -23,21 +23,26 @@ #include +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER +using chip::Protocols::InteractionModel::Status; + namespace chip { namespace app { namespace Clusters { -namespace OperationalState { +namespace RvcOperationalState { // This is an application level delegate to handle operational state commands according to the specific business logic. -class GenericOperationalStateDelegateImpl : public Delegate +class RvcOperationalStateDelegate : public RvcOperationalState::Delegate { public: + RvcOperationalStateDelegate() { mOperationalStateList = Span(rvcOpStateList); } + /** * Get the countdown time. This attribute is not used in this application. * @return The current countdown time. */ - app::DataModel::Nullable GetCountdownTime() override { return {}; }; + app::DataModel::Nullable GetCountdownTime() override; /** * Fills in the provided GenericOperationalState with the state at index `index` if there is one, @@ -47,7 +52,7 @@ class GenericOperationalStateDelegateImpl : public Delegate * @param index The index of the state, with 0 representing the first state. * @param operationalState The GenericOperationalState is filled. */ - CHIP_ERROR GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) override; + CHIP_ERROR GetOperationalStateAtIndex(size_t index, OperationalState::GenericOperationalState & operationalState) override; /** * Fills in the provided MutableCharSpan with the phase at index `index` if there is one, @@ -68,59 +73,34 @@ class GenericOperationalStateDelegateImpl : public Delegate * Handle Command Callback in application: Pause * @param[out] get operational error after callback. */ - void HandlePauseStateCallback(GenericOperationalError & err) override; + void HandlePauseStateCallback(OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Resume * @param[out] get operational error after callback. */ - void HandleResumeStateCallback(GenericOperationalError & err) override; + void HandleResumeStateCallback(OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Start * @param[out] get operational error after callback. */ - void HandleStartStateCallback(GenericOperationalError & err) override; + void HandleStartStateCallback(OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Stop * @param[out] get operational error after callback. */ - void HandleStopStateCallback(GenericOperationalError & err) override; + void HandleStopStateCallback(OperationalState::GenericOperationalError & err) override; -protected: - Span mOperationalStateList; - Span mOperationalPhaseList; -}; + uint32_t mRunningTime = 0; + uint32_t mPausedTime = 0; + app::DataModel::Nullable mPhaseDuration; -// This is an application level delegate to handle operational state commands according to the specific business logic. -class OperationalStateDelegate : public GenericOperationalStateDelegateImpl -{ private: - const GenericOperationalState opStateList[4] = { - GenericOperationalState(to_underlying(OperationalStateEnum::kStopped)), - GenericOperationalState(to_underlying(OperationalStateEnum::kRunning)), - GenericOperationalState(to_underlying(OperationalStateEnum::kPaused)), - GenericOperationalState(to_underlying(OperationalStateEnum::kError)), - }; - -public: - OperationalStateDelegate() - { - GenericOperationalStateDelegateImpl::mOperationalStateList = Span(opStateList); - } -}; - -void Shutdown(); - -} // namespace OperationalState - -namespace RvcOperationalState { + Span mOperationalStateList; + Span mOperationalPhaseList; -// This is an application level delegate to handle operational state commands according to the specific business logic. -class RvcOperationalStateDelegate : public OperationalState::GenericOperationalStateDelegateImpl -{ -private: const OperationalState::GenericOperationalState rvcOpStateList[7] = { OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)), OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)), @@ -131,13 +111,6 @@ class RvcOperationalStateDelegate : public OperationalState::GenericOperationalS OperationalState::GenericOperationalState(to_underlying(Clusters::RvcOperationalState::OperationalStateEnum::kCharging)), OperationalState::GenericOperationalState(to_underlying(Clusters::RvcOperationalState::OperationalStateEnum::kDocked)), }; - -public: - RvcOperationalStateDelegate() - { - GenericOperationalStateDelegateImpl::mOperationalStateList = - Span(rvcOpStateList); - } }; void Shutdown(); @@ -146,3 +119,11 @@ void Shutdown(); } // namespace Clusters } // namespace app } // namespace chip + +chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +chip::Protocols::InteractionModel::Status chefRvcOperationalStateReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); +#endif // MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index 437dfe9e6221be..c0935df51efa7e 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -19,6 +19,14 @@ #include "chef-concentration-measurement.h" #endif +#if defined(MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER) || defined(MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER) +#include "chef-rvc-mode-delegate.h" +#endif + +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER +#include "chef-rvc-operational-state-delegate.h" +#endif + using chip::app::DataModel::Nullable; using namespace chip; @@ -56,6 +64,18 @@ Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(Endpoin case chip::app::Clusters::RadonConcentrationMeasurement::Id: case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: return chefConcentrationMeasurementReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER + case chip::app::Clusters::RvcRunMode::Id: + return chefRvcRunModeReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER + case chip::app::Clusters::RvcCleanMode::Id: + return chefRvcCleanModeReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER + case chip::app::Clusters::RvcOperationalState::Id: + return chefRvcOperationalStateReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); #endif default: break; @@ -104,6 +124,18 @@ Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(Endpoi case chip::app::Clusters::RadonConcentrationMeasurement::Id: case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: return chefConcentrationMeasurementWriteCallback(endpoint, clusterId, attributeMetadata, buffer); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER + case chip::app::Clusters::RvcRunMode::Id: + return chefRvcRunModeWriteCallback(endpoint, clusterId, attributeMetadata, buffer); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER + case chip::app::Clusters::RvcCleanMode::Id: + return chefRvcCleanModeWriteCallback(endpoint, clusterId, attributeMetadata, buffer); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER + case chip::app::Clusters::RvcOperationalState::Id: + return chefRvcOperationalStateWriteCallback(endpoint, clusterId, attributeMetadata, buffer); #endif default: break; diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter index f2ab0c354ca1cf..0d5013c6b8d29c 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter @@ -333,6 +333,265 @@ cluster BasicInformation = 40 { command MfgSpecificPing(): DefaultSuccess = 0; } +/** This cluster is used to describe the configuration and capabilities of a physical power source that provides power to the Node. */ +cluster PowerSource = 47 { + revision 1; // NOTE: Default/not specifically set + + enum BatApprovedChemistryEnum : enum16 { + kUnspecified = 0; + kAlkaline = 1; + kLithiumCarbonFluoride = 2; + kLithiumChromiumOxide = 3; + kLithiumCopperOxide = 4; + kLithiumIronDisulfide = 5; + kLithiumManganeseDioxide = 6; + kLithiumThionylChloride = 7; + kMagnesium = 8; + kMercuryOxide = 9; + kNickelOxyhydride = 10; + kSilverOxide = 11; + kZincAir = 12; + kZincCarbon = 13; + kZincChloride = 14; + kZincManganeseDioxide = 15; + kLeadAcid = 16; + kLithiumCobaltOxide = 17; + kLithiumIon = 18; + kLithiumIonPolymer = 19; + kLithiumIronPhosphate = 20; + kLithiumSulfur = 21; + kLithiumTitanate = 22; + kNickelCadmium = 23; + kNickelHydrogen = 24; + kNickelIron = 25; + kNickelMetalHydride = 26; + kNickelZinc = 27; + kSilverZinc = 28; + kSodiumIon = 29; + kSodiumSulfur = 30; + kZincBromide = 31; + kZincCerium = 32; + } + + enum BatChargeFaultEnum : enum8 { + kUnspecified = 0; + kAmbientTooHot = 1; + kAmbientTooCold = 2; + kBatteryTooHot = 3; + kBatteryTooCold = 4; + kBatteryAbsent = 5; + kBatteryOverVoltage = 6; + kBatteryUnderVoltage = 7; + kChargerOverVoltage = 8; + kChargerUnderVoltage = 9; + kSafetyTimeout = 10; + } + + enum BatChargeLevelEnum : enum8 { + kOK = 0; + kWarning = 1; + kCritical = 2; + } + + enum BatChargeStateEnum : enum8 { + kUnknown = 0; + kIsCharging = 1; + kIsAtFullCharge = 2; + kIsNotCharging = 3; + } + + enum BatCommonDesignationEnum : enum16 { + kUnspecified = 0; + kAAA = 1; + kAA = 2; + kC = 3; + kD = 4; + k4v5 = 5; + k6v0 = 6; + k9v0 = 7; + k12AA = 8; + kAAAA = 9; + kA = 10; + kB = 11; + kF = 12; + kN = 13; + kNo6 = 14; + kSubC = 15; + kA23 = 16; + kA27 = 17; + kBA5800 = 18; + kDuplex = 19; + k4SR44 = 20; + k523 = 21; + k531 = 22; + k15v0 = 23; + k22v5 = 24; + k30v0 = 25; + k45v0 = 26; + k67v5 = 27; + kJ = 28; + kCR123A = 29; + kCR2 = 30; + k2CR5 = 31; + kCRP2 = 32; + kCRV3 = 33; + kSR41 = 34; + kSR43 = 35; + kSR44 = 36; + kSR45 = 37; + kSR48 = 38; + kSR54 = 39; + kSR55 = 40; + kSR57 = 41; + kSR58 = 42; + kSR59 = 43; + kSR60 = 44; + kSR63 = 45; + kSR64 = 46; + kSR65 = 47; + kSR66 = 48; + kSR67 = 49; + kSR68 = 50; + kSR69 = 51; + kSR516 = 52; + kSR731 = 53; + kSR712 = 54; + kLR932 = 55; + kA5 = 56; + kA10 = 57; + kA13 = 58; + kA312 = 59; + kA675 = 60; + kAC41E = 61; + k10180 = 62; + k10280 = 63; + k10440 = 64; + k14250 = 65; + k14430 = 66; + k14500 = 67; + k14650 = 68; + k15270 = 69; + k16340 = 70; + kRCR123A = 71; + k17500 = 72; + k17670 = 73; + k18350 = 74; + k18500 = 75; + k18650 = 76; + k19670 = 77; + k25500 = 78; + k26650 = 79; + k32600 = 80; + } + + enum BatFaultEnum : enum8 { + kUnspecified = 0; + kOverTemp = 1; + kUnderTemp = 2; + } + + enum BatReplaceabilityEnum : enum8 { + kUnspecified = 0; + kNotReplaceable = 1; + kUserReplaceable = 2; + kFactoryReplaceable = 3; + } + + enum PowerSourceStatusEnum : enum8 { + kUnspecified = 0; + kActive = 1; + kStandby = 2; + kUnavailable = 3; + } + + enum WiredCurrentTypeEnum : enum8 { + kAC = 0; + kDC = 1; + } + + enum WiredFaultEnum : enum8 { + kUnspecified = 0; + kOverVoltage = 1; + kUnderVoltage = 2; + } + + bitmap Feature : bitmap32 { + kWired = 0x1; + kBattery = 0x2; + kRechargeable = 0x4; + kReplaceable = 0x8; + } + + struct BatChargeFaultChangeType { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + struct BatFaultChangeType { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + struct WiredFaultChangeType { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event WiredFaultChange = 0 { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event BatFaultChange = 1 { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + info event BatChargeFaultChange = 2 { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + readonly attribute PowerSourceStatusEnum status = 0; + readonly attribute int8u order = 1; + readonly attribute char_string<60> description = 2; + readonly attribute optional nullable int32u wiredAssessedInputVoltage = 3; + readonly attribute optional nullable int16u wiredAssessedInputFrequency = 4; + readonly attribute optional WiredCurrentTypeEnum wiredCurrentType = 5; + readonly attribute optional nullable int32u wiredAssessedCurrent = 6; + readonly attribute optional int32u wiredNominalVoltage = 7; + readonly attribute optional int32u wiredMaximumCurrent = 8; + readonly attribute optional boolean wiredPresent = 9; + readonly attribute optional WiredFaultEnum activeWiredFaults[] = 10; + readonly attribute optional nullable int32u batVoltage = 11; + readonly attribute optional nullable int8u batPercentRemaining = 12; + readonly attribute optional nullable int32u batTimeRemaining = 13; + readonly attribute optional BatChargeLevelEnum batChargeLevel = 14; + readonly attribute optional boolean batReplacementNeeded = 15; + readonly attribute optional BatReplaceabilityEnum batReplaceability = 16; + readonly attribute optional boolean batPresent = 17; + readonly attribute optional BatFaultEnum activeBatFaults[] = 18; + readonly attribute optional char_string<60> batReplacementDescription = 19; + readonly attribute optional BatCommonDesignationEnum batCommonDesignation = 20; + readonly attribute optional char_string<20> batANSIDesignation = 21; + readonly attribute optional char_string<20> batIECDesignation = 22; + readonly attribute optional BatApprovedChemistryEnum batApprovedChemistry = 23; + readonly attribute optional int32u batCapacity = 24; + readonly attribute optional int8u batQuantity = 25; + readonly attribute optional BatChargeStateEnum batChargeState = 26; + readonly attribute optional nullable int32u batTimeToFullCharge = 27; + readonly attribute optional boolean batFunctionalWhileCharging = 28; + readonly attribute optional nullable int32u batChargingCurrent = 29; + readonly attribute optional BatChargeFaultEnum activeBatChargeFaults[] = 30; + readonly attribute endpoint_no endpointList[] = 31; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** This cluster is used to manage global aspects of the Commissioning flow. */ cluster GeneralCommissioning = 48 { revision 1; // NOTE: Default/not specifically set @@ -1366,6 +1625,7 @@ endpoint 0 { } } endpoint 1 { + device type ma_powersource = 17, version 1; device type ma_robotic_vacuum_cleaner = 116, version 1; @@ -1417,6 +1677,22 @@ endpoint 1 { callback attribute clusterRevision; } + server cluster PowerSource { + ram attribute status; + ram attribute order; + ram attribute description; + ram attribute batPercentRemaining default = 95; + ram attribute batPresent default = 1; + ram attribute batChargeState default = 4; + callback attribute endpointList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + server cluster RvcRunMode { callback attribute supportedModes; callback attribute currentMode; diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap index 3c058e9910c45d..15c155dbb69d12 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -29,6 +29,7 @@ "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/app-templates.json", "type": "gen-templates-json", + "category": "matter", "version": "chip-v1" } ], @@ -1924,12 +1925,18 @@ "id": 2, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 116, + "code": 17, "profileId": 259, - "label": "MA-robotic-vacuum-cleaner", - "name": "MA-robotic-vacuum-cleaner" + "label": "MA-powersource", + "name": "MA-powersource" }, "deviceTypes": [ + { + "code": 17, + "profileId": 259, + "label": "MA-powersource", + "name": "MA-powersource" + }, { "code": 116, "profileId": 259, @@ -1938,13 +1945,15 @@ } ], "deviceVersions": [ + 1, 1 ], "deviceIdentifiers": [ + 17, 116 ], - "deviceTypeName": "MA-robotic-vacuum-cleaner", - "deviceTypeCode": 116, + "deviceTypeName": "MA-powersource", + "deviceTypeCode": 17, "deviceTypeProfileId": 259, "clusters": [ { @@ -2342,7 +2351,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2358,7 +2367,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2374,7 +2383,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2477,6 +2486,224 @@ } ] }, + { + "name": "Power Source", + "code": 47, + "mfgCode": null, + "define": "POWER_SOURCE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "Status", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "PowerSourceStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Order", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Description", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPercentRemaining", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "95", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPresent", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatChargeState", + "code": 26, + "mfgCode": null, + "side": "server", + "type": "BatChargeStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EndpointList", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "RVC Run Mode", "code": 84, diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 7ff067f725d3f4..95cba5a3730e38 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -29,7 +29,7 @@ steps: args: - >- perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt && - ./examples/chef/chef.py --build_all --build_exclude noip\|roboticvacuumcleaner + ./examples/chef/chef.py --build_all id: CompileAll waitFor: - Bootstrap From 88ebdf78b11216db85f6c81928f6fabb29ecf08c Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 6 Jun 2024 17:11:34 +0200 Subject: [PATCH 069/162] [Python] Remove Python Bluetooth and ChipStack event loop integration (#33775) The Python Bluetooth implementation for Linux (`BluezManager` in ChipBluezMgr.py) and macOS (`CoreBluetoothManager` in ChipCoreBluetoothMgr.py) integrate with ChipStack to pump their event loops on long running operations such as commissioning (through `CallAsyncWithCompleteCallback()`). From what I can tell, the Python Bluetooth stack is only used for some mbed integration tests. Specifically through `scan_chip_ble_devices()` in src/test_driver/mbed/integration_tests/common/utils.py. This operation doesn't need the event loop integration. So as a first step, this PR simply breaks this tie and removes the event loop integration with the Device ChipStack/ChipDeviceController. --- src/controller/python/chip/ChipBluezMgr.py | 1 - src/controller/python/chip/ChipCoreBluetoothMgr.py | 2 -- src/controller/python/chip/ChipDeviceCtrl.py | 5 ----- src/controller/python/chip/ChipStack.py | 8 +------- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/controller/python/chip/ChipBluezMgr.py b/src/controller/python/chip/ChipBluezMgr.py index e480750b600af8..bacf383710eccd 100644 --- a/src/controller/python/chip/ChipBluezMgr.py +++ b/src/controller/python/chip/ChipBluezMgr.py @@ -807,7 +807,6 @@ def __init__(self, devMgr, logger=None): self.rx = None self.setInputHook(self.readlineCB) self.devMgr = devMgr - self.devMgr.SetBlockingCB(self.devMgrCB) def __del__(self): self.disconnect() diff --git a/src/controller/python/chip/ChipCoreBluetoothMgr.py b/src/controller/python/chip/ChipCoreBluetoothMgr.py index 3f792a5a4d2425..4a65f1e2377038 100644 --- a/src/controller/python/chip/ChipCoreBluetoothMgr.py +++ b/src/controller/python/chip/ChipCoreBluetoothMgr.py @@ -184,8 +184,6 @@ def __init__(self, devCtrl, logger=None): def __del__(self): self.disconnect() self.setInputHook(self.orig_input_hook) - self.devCtrl.SetBlockingCB(None) - self.devCtrl.SetBleEventCB(None) def devMgrCB(self): """A callback used by ChipDeviceCtrl.py to drive the OSX runloop while the diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 2ba7c584db927b..aca971e5d392f1 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -1591,11 +1591,6 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[ else: return res.events - def SetBlockingCB(self, blockingCB): - self.CheckIsActive() - - self._ChipStack.blockingCB = blockingCB - def SetIpk(self, ipk: bytes): self._ChipStack.Call( lambda: self._dmLib.pychip_DeviceController_SetIpk(self.devCtrl, ipk, len(ipk)) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index b47c4639825da8..5fd0601ba204e7 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -165,8 +165,6 @@ def HandleChipThreadRun(callback): callback() self.cbHandleChipThreadRun = HandleChipThreadRun - # set by other modules(BLE) that require service by thread while thread blocks. - self.blockingCB = None # # Storage has to be initialized BEFORE initializing the stack, since the latter @@ -255,11 +253,7 @@ def CallAsyncWithCompleteCallback(self, callFunct): if not res.is_success: self.completeEvent.set() raise res.to_exception() - while not self.completeEvent.isSet(): - if self.blockingCB: - self.blockingCB() - - self.completeEvent.wait(0.05) + self.completeEvent.wait() if isinstance(self.callbackRes, ChipStackException): raise self.callbackRes return self.callbackRes From 72450e4d655ecb27120993b77b28ad6cf7298469 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 6 Jun 2024 11:48:57 -0400 Subject: [PATCH 070/162] Make `CommandHandler` a pure interface class, have actual implementation in `CommandHandlerImpl` (#33736) * First pass: renames only and moved things around. It should not yet compile * Move CommandHandler::Callback to CommandHandlerImpl::Callback * Prepare some compile fixes. Uses of preparation of responses is not ok yet * More replace fixes * More compile updates * Try to implement the addResponse properly * Many more updates for compilation * More compile tests - getting closer * Things compile * Restyle * Split out CommandHandler (the interface) from CommandHandlerImpl (actual IM implementation) * Restyle * make GetExchangeContext also be virtual * Fix some includes that were previously part of CommandHandler.h * Restyle * No need for casts and private APIs: Exchange context is actually available * Code review feedback * Restyle * Upgrading docs * Slight example fix --------- Co-authored-by: Andrei Litvin --- docs/index.md | 1 + docs/upgrading.md | 62 + .../lighting-app/tizen/src/DBusInterface.cpp | 15 +- src/app/BUILD.gn | 2 + src/app/CommandHandler.cpp | 1009 +--------------- src/app/CommandHandler.h | 617 ++-------- src/app/CommandHandlerImpl.cpp | 1057 +++++++++++++++++ src/app/CommandHandlerImpl.h | 476 ++++++++ src/app/CommandResponseSender.cpp | 6 +- src/app/CommandResponseSender.h | 16 +- src/app/InteractionModelEngine.cpp | 24 +- src/app/InteractionModelEngine.h | 8 +- src/app/tests/TestCommandInteraction.cpp | 73 +- .../java/OTAProviderDelegateBridge.cpp | 1 + 14 files changed, 1764 insertions(+), 1603 deletions(-) create mode 100644 docs/upgrading.md create mode 100644 src/app/CommandHandlerImpl.cpp create mode 100644 src/app/CommandHandlerImpl.h diff --git a/docs/index.md b/docs/index.md index b7615a476818df..1f8e806dc4cce9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,6 +22,7 @@ BUG_REPORT code_generation zap_clusters spec_clusters +upgrading ERROR_CODES ``` diff --git a/docs/upgrading.md b/docs/upgrading.md new file mode 100644 index 00000000000000..cd18b533484279 --- /dev/null +++ b/docs/upgrading.md @@ -0,0 +1,62 @@ +# Upgrading notes + +## API changes and code migration + +### `CommandHandler` + +`CommandHandler` ability to directly invoke `Prepare/TLV-Write/Finish` cycles +has been changed to only expose `AddResponse/AddStatus/AddClusterSpecific*`. + +Original versions of `CommandHandler` exposed the following low-level +implementation-specific methods: `PrepareCommand`, +`PrepareInvokeResponseCommand`, `GetCommandDataIBTLVWriter` and `FinishCommand`. +These are not exposed anymore and instead one should use `AddResponse` or +`AddResponseData`. When using an `EncodableToTLV` argument, the same +functionality should be achievable. + +Example + +Before: + +```cpp + +const CommandHandler::InvokeResponseParameters prepareParams(requestPath); +ReturnOnFailure(commandHandler->PrepareInvokeResponseCommand(path, prepareParams)); + +TLV::TLVWriter *writer = commandHandler->GetCommandDataIBTLVWriter(); +ReturnOnFailure(writer->Put(chip::TLV::ContextTag(1), 123)); +ReturnOnFailure(writer->Put(chip::TLV::ContextTag(2), 234)); +return commandHandler->FinishCommand(); +``` + +After: + +```cpp + +class ReplyEncoder : public DataModel::EncodableToTLV +{ +public: + CHIP_ERROR EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const override + { + TLV::TLVType outerType; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outerType)); + + ReturnOnFailure(writer.Put(chip::TLV::ContextTag(1), 123)); + ReturnOnFailure(writer.Put(chip::TLV::ContextTag(2), 234)); + + return writer.EndContainer(outerType); + } +}; + +// ... +ReplyEncoder replyEncoder; +commandHandler->AddResponse(path, kReplyCommandId, replyEncoder); + +// or if error handling is implemented: +// +// ReturnErrorOnFailure(commandHandler->AddResponseData(path, kReplyCommandId, replyEncoder)); +// +// In many cases error recovery from not being able to send a reply is not easy or expected, +// so code does AddResponse rather than AddResponseData. + +``` diff --git a/examples/lighting-app/tizen/src/DBusInterface.cpp b/examples/lighting-app/tizen/src/DBusInterface.cpp index e39ca5c1e1232c..50dbd37930b47f 100644 --- a/examples/lighting-app/tizen/src/DBusInterface.cpp +++ b/examples/lighting-app/tizen/src/DBusInterface.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -36,13 +37,13 @@ using namespace chip::app; namespace example { -// Dummy class to satisfy the CommandHandler::Callback interface. -class CommandHandlerCallback : public CommandHandler::Callback +// Dummy class to satisfy the CommandHandlerImpl::Callback interface. +class CommandHandlerImplCallback : public CommandHandlerImpl::Callback { public: using Status = Protocols::InteractionModel::Status; - void OnDone(CommandHandler & apCommandObj) {} - void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) {} + void OnDone(CommandHandlerImpl & apCommandObj) {} + void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) {} Status CommandExists(const ConcreteCommandPath & aCommandPath) { return Status::Success; } }; @@ -188,8 +189,10 @@ gboolean DBusInterface::OnColorTemperatureChanged(LightAppColorControl * colorCo // Do not handle on-change event if it was triggered by internal set VerifyOrReturnValue(!self->mInternalSet, G_DBUS_METHOD_INVOCATION_HANDLED); - CommandHandlerCallback callback; - CommandHandler handler(&callback); + // TODO: creating such a complex object seems odd here + // as handler seems not used to send back any response back anywhere. + CommandHandlerImplCallback callback; + CommandHandlerImpl handler(&callback); ConcreteCommandPath path{ self->mEndpointId, Clusters::ColorControl::Id, 0 }; diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index f49a40f398842a..55bc5f305ddd99 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -338,6 +338,8 @@ source_set("command-handler") { "CommandHandler.cpp", "CommandHandler.h", "CommandHandlerExchangeInterface.h", + "CommandHandlerImpl.cpp", + "CommandHandlerImpl.h", ] public_deps = [ diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 309685491a8d82..90ebdaa43603d7 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,802 +17,8 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - namespace chip { namespace app { -using Status = Protocols::InteractionModel::Status; - -CommandHandler::CommandHandler(Callback * apCallback) : mpCallback(apCallback), mSuppressResponse(false) {} - -CommandHandler::CommandHandler(TestOnlyOverrides & aTestOverride, Callback * apCallback) : CommandHandler(apCallback) -{ - if (aTestOverride.commandPathRegistry) - { - mMaxPathsPerInvoke = aTestOverride.commandPathRegistry->MaxSize(); - mCommandPathRegistry = aTestOverride.commandPathRegistry; - } - if (aTestOverride.commandResponder) - { - SetExchangeInterface(aTestOverride.commandResponder); - } -} - -CommandHandler::~CommandHandler() -{ - InvalidateHandles(); -} - -CHIP_ERROR CommandHandler::AllocateBuffer() -{ - // We should only allocate a buffer if we will be sending out a response. - VerifyOrReturnError(ResponsesAccepted(), CHIP_ERROR_INCORRECT_STATE); - - if (!mBufferAllocated) - { - mCommandMessageWriter.Reset(); - - System::PacketBufferHandle commandPacket = System::PacketBufferHandle::New(chip::app::kMaxSecureSduLengthBytes); - VerifyOrReturnError(!commandPacket.IsNull(), CHIP_ERROR_NO_MEMORY); - - mCommandMessageWriter.Init(std::move(commandPacket)); - ReturnErrorOnFailure(mInvokeResponseBuilder.InitWithEndBufferReserved(&mCommandMessageWriter)); - - if (mReserveSpaceForMoreChunkMessages) - { - ReturnErrorOnFailure(mInvokeResponseBuilder.ReserveSpaceForMoreChunkedMessages()); - } - - // Sending an InvokeResponse to an InvokeResponse is going to be removed from the spec soon. - // It was never implemented in the SDK, and there are no command responses that expect a - // command response. This means we will never receive an InvokeResponse Message in response - // to an InvokeResponse Message that we are sending. This means that the only response - // we are expecting to receive in response to an InvokeResponse Message that we are - // sending-out is a status when we are chunking multiple responses. As a result, to satisfy the - // condition that we don't set SuppressResponse to true while also setting - // MoreChunkedMessages to true, we are hardcoding the value to false here. - mInvokeResponseBuilder.SuppressResponse(/* aSuppressResponse = */ false); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); - - mInvokeResponseBuilder.CreateInvokeResponses(/* aReserveEndBuffer = */ true); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); - - mBufferAllocated = true; - MoveToState(State::NewResponseMessage); - } - - return CHIP_NO_ERROR; -} - -Status CommandHandler::OnInvokeCommandRequest(CommandHandlerExchangeInterface & commandResponder, - System::PacketBufferHandle && payload, bool isTimedInvoke) -{ - VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "state should be Idle"); - - SetExchangeInterface(&commandResponder); - - // Using RAII here: if this is the only handle remaining, DecrementHoldOff will - // call the CommandHandler::OnDone callback when this function returns. - Handle workHandle(this); - - Status status = ProcessInvokeRequest(std::move(payload), isTimedInvoke); - mGoneAsync = true; - return status; -} - -CHIP_ERROR CommandHandler::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) -{ - ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId, - aResponseCommandId }; - - InvokeResponseParameters prepareParams(aRequestCommandPath); - prepareParams.SetStartOrEndDataStruct(false); - - { - ScopedChange internalCallToAddResponse(mInternalCallToAddResponseData, true); - ReturnErrorOnFailure(PrepareInvokeResponseCommand(responseCommandPath, prepareParams)); - } - - TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); - VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(aEncodable.EncodeTo(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields))); - return FinishCommand(/* aEndDataStruct = */ false); -} - -CHIP_ERROR CommandHandler::ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - size_t commandCount = 0; - bool commandRefExpected = false; - InvokeRequests::Parser invokeRequests; - - ReturnErrorOnFailure(invokeRequestMessage.GetInvokeRequests(&invokeRequests)); - TLV::TLVReader invokeRequestsReader; - invokeRequests.GetReader(&invokeRequestsReader); - - ReturnErrorOnFailure(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */)); - - // If this is a GroupRequest the only thing to check is that there is only one - // CommandDataIB. - if (IsGroupRequest()) - { - VerifyOrReturnError(commandCount == 1, CHIP_ERROR_INVALID_ARGUMENT); - return CHIP_NO_ERROR; - } - // While technically any commandCount == 1 should already be unique and does not need - // any further validation, we do need to read and populate the registry to help - // in building the InvokeResponse. - - VerifyOrReturnError(commandCount <= MaxPathsPerInvoke(), CHIP_ERROR_INVALID_ARGUMENT); - - // If there is more than one CommandDataIB, spec states that CommandRef must be provided. - commandRefExpected = commandCount > 1; - - while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) - { - VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), CHIP_ERROR_INVALID_ARGUMENT); - CommandDataIB::Parser commandData; - ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); - - // First validate that we can get a ConcreteCommandPath. - CommandPathIB::Parser commandPath; - ConcreteCommandPath concretePath(0, 0, 0); - ReturnErrorOnFailure(commandData.GetPath(&commandPath)); - ReturnErrorOnFailure(commandPath.GetConcreteCommandPath(concretePath)); - - // Grab the CommandRef if there is one, and validate that it's there when it - // has to be. - std::optional commandRef; - uint16_t ref; - err = commandData.GetRef(&ref); - VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_END_OF_TLV, err); - if (err == CHIP_END_OF_TLV && commandRefExpected) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - if (err == CHIP_NO_ERROR) - { - commandRef.emplace(ref); - } - - // Adding can fail if concretePath is not unique, or if commandRef is a value - // and is not unique, or if we have already added more paths than we support. - ReturnErrorOnFailure(GetCommandPathRegistry().Add(concretePath, commandRef)); - } - - // It's OK/expected to have reached the end of the container without failure. - if (CHIP_END_OF_TLV == err) - { - err = CHIP_NO_ERROR; - } - ReturnErrorOnFailure(err); - return invokeRequestMessage.ExitContainer(); -} - -Status CommandHandler::ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - System::PacketBufferTLVReader reader; - InvokeRequestMessage::Parser invokeRequestMessage; - InvokeRequests::Parser invokeRequests; - reader.Init(std::move(payload)); - VerifyOrReturnError(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, Status::InvalidAction); -#if CHIP_CONFIG_IM_PRETTY_PRINT - invokeRequestMessage.PrettyPrint(); -#endif - VerifyOrDie(mpResponder); - if (mpResponder->GetGroupId().HasValue()) - { - SetGroupRequest(true); - } - - // When updating this code, please remember to make corresponding changes to TestOnlyInvokeCommandRequestWithFaultsInjected. - VerifyOrReturnError(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, Status::InvalidAction); - VerifyOrReturnError(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, Status::InvalidAction); - VerifyOrReturnError(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, Status::InvalidAction); - VerifyOrReturnError(mTimedRequest == isTimedInvoke, Status::TimedRequestMismatch); - - { - InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; - VerifyOrReturnError(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, - Status::InvalidAction); - } - - TLV::TLVReader invokeRequestsReader; - invokeRequests.GetReader(&invokeRequestsReader); - - size_t commandCount = 0; - VerifyOrReturnError(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, - Status::InvalidAction); - if (commandCount > 1) - { - mReserveSpaceForMoreChunkMessages = true; - } - - while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) - { - VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), Status::InvalidAction); - CommandDataIB::Parser commandData; - VerifyOrReturnError(commandData.Init(invokeRequestsReader) == CHIP_NO_ERROR, Status::InvalidAction); - Status status = Status::Success; - if (IsGroupRequest()) - { - status = ProcessGroupCommandDataIB(commandData); - } - else - { - status = ProcessCommandDataIB(commandData); - } - if (status != Status::Success) - { - return status; - } - } - - // if we have exhausted this container - if (CHIP_END_OF_TLV == err) - { - err = CHIP_NO_ERROR; - } - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - VerifyOrReturnError(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, Status::InvalidAction); - return Status::Success; -} - -void CommandHandler::Close() -{ - mSuppressResponse = false; - mpResponder = nullptr; - MoveToState(State::AwaitingDestruction); - - // We must finish all async work before we can shut down a CommandHandler. The actual CommandHandler MUST finish their work - // in reasonable time or there is a bug. The only case for releasing CommandHandler without CommandHandler::Handle releasing its - // reference is the stack shutting down, in which case Close() is not called. So the below check should always pass. - VerifyOrDieWithMsg(mPendingWork == 0, DataManagement, "CommandHandler::Close() called with %u unfinished async work items", - static_cast(mPendingWork)); - InvalidateHandles(); - - if (mpCallback) - { - mpCallback->OnDone(*this); - } -} - -void CommandHandler::AddToHandleList(Handle * apHandle) -{ - mpHandleList.PushBack(apHandle); -} - -void CommandHandler::RemoveFromHandleList(Handle * apHandle) -{ - VerifyOrDie(mpHandleList.Contains(apHandle)); - mpHandleList.Remove(apHandle); -} - -void CommandHandler::InvalidateHandles() -{ - for (auto handle = mpHandleList.begin(); handle != mpHandleList.end(); ++handle) - { - handle->Invalidate(); - } -} - -void CommandHandler::IncrementHoldOff(Handle * apHandle) -{ - mPendingWork++; - AddToHandleList(apHandle); -} - -void CommandHandler::DecrementHoldOff(Handle * apHandle) -{ - - mPendingWork--; - ChipLogDetail(DataManagement, "Decreasing reference count for CommandHandler, remaining %u", - static_cast(mPendingWork)); - - RemoveFromHandleList(apHandle); - - if (mPendingWork != 0) - { - return; - } - - if (mpResponder == nullptr) - { - ChipLogProgress(DataManagement, "Skipping command response: response sender is null"); - } - else if (!IsGroupRequest()) - { - CHIP_ERROR err = FinalizeLastInvokeResponseMessage(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DataManagement, "Failed to finalize command response: %" CHIP_ERROR_FORMAT, err.Format()); - } - } - - Close(); -} - -namespace { -// We use this when the sender did not actually provide a CommandFields struct, -// to avoid downstream consumers having to worry about cases when there is or is -// not a struct available. We use an empty struct with anonymous tag, since we -// can't use a context tag at top level, and consumers should not care about the -// tag here). -constexpr uint8_t sNoFields[] = { - CHIP_TLV_STRUCTURE(CHIP_TLV_TAG_ANONYMOUS), - CHIP_TLV_END_OF_CONTAINER, -}; -} // anonymous namespace - -Status CommandHandler::ProcessCommandDataIB(CommandDataIB::Parser & aCommandElement) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - CommandPathIB::Parser commandPath; - ConcreteCommandPath concretePath(0, 0, 0); - TLV::TLVReader commandDataReader; - - // NOTE: errors may occur before the concrete command path is even fully decoded. - - err = aCommandElement.GetPath(&commandPath); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - - err = commandPath.GetConcreteCommandPath(concretePath); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - - { - Status commandExists = mpCallback->CommandExists(concretePath); - if (commandExists != Status::Success) - { - ChipLogDetail(DataManagement, "No command " ChipLogFormatMEI " in Cluster " ChipLogFormatMEI " on Endpoint 0x%x", - ChipLogValueMEI(concretePath.mCommandId), ChipLogValueMEI(concretePath.mClusterId), - concretePath.mEndpointId); - return FallibleAddStatus(concretePath, commandExists) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - } - - { - Access::SubjectDescriptor subjectDescriptor = GetSubjectDescriptor(); - Access::RequestPath requestPath{ .cluster = concretePath.mClusterId, .endpoint = concretePath.mEndpointId }; - Access::Privilege requestPrivilege = RequiredPrivilege::ForInvokeCommand(concretePath); - err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege); - if (err != CHIP_NO_ERROR) - { - if (err != CHIP_ERROR_ACCESS_DENIED) - { - return FallibleAddStatus(concretePath, Status::Failure) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - // TODO: when wildcard invokes are supported, handle them to discard rather than fail with status - return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - } - - if (CommandNeedsTimedInvoke(concretePath.mClusterId, concretePath.mCommandId) && !IsTimedInvoke()) - { - // TODO: when wildcard invokes are supported, discard a - // wildcard-expanded path instead of returning a status. - return FallibleAddStatus(concretePath, Status::NeedsTimedInteraction) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - - if (CommandIsFabricScoped(concretePath.mClusterId, concretePath.mCommandId)) - { - // SPEC: Else if the command in the path is fabric-scoped and there is no accessing fabric, - // a CommandStatusIB SHALL be generated with the UNSUPPORTED_ACCESS Status Code. - - // Fabric-scoped commands are not allowed before a specific accessing fabric is available. - // This is mostly just during a PASE session before AddNOC. - if (GetAccessingFabricIndex() == kUndefinedFabricIndex) - { - // TODO: when wildcard invokes are supported, discard a - // wildcard-expanded path instead of returning a status. - return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - } - - err = aCommandElement.GetFields(&commandDataReader); - if (CHIP_END_OF_TLV == err) - { - ChipLogDetail(DataManagement, - "Received command without data for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId)); - commandDataReader.Init(sNoFields); - err = commandDataReader.Next(); - } - if (CHIP_NO_ERROR == err) - { - ChipLogDetail(DataManagement, "Received command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId)); - SuccessOrExit(err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())); - mpCallback->DispatchCommand(*this, concretePath, commandDataReader); - DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor()); - } - -exit: - if (err != CHIP_NO_ERROR) - { - return FallibleAddStatus(concretePath, Status::InvalidCommand) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - - // We have handled the error status above and put the error status in response, now return success status so we can process - // other commands in the invoke request. - return Status::Success; -} - -Status CommandHandler::ProcessGroupCommandDataIB(CommandDataIB::Parser & aCommandElement) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - CommandPathIB::Parser commandPath; - TLV::TLVReader commandDataReader; - ClusterId clusterId; - CommandId commandId; - GroupId groupId; - FabricIndex fabric; - - Credentials::GroupDataProvider::GroupEndpoint mapping; - Credentials::GroupDataProvider * groupDataProvider = Credentials::GetGroupDataProvider(); - Credentials::GroupDataProvider::EndpointIterator * iterator; - - err = aCommandElement.GetPath(&commandPath); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - - err = commandPath.GetGroupCommandPath(&clusterId, &commandId); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - - VerifyOrDie(mpResponder); - // The optionalGroupId must have a value, otherwise we wouldn't have reached this code path. - groupId = mpResponder->GetGroupId().Value(); - fabric = GetAccessingFabricIndex(); - - ChipLogDetail(DataManagement, "Received group command for Group=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - groupId, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); - - err = aCommandElement.GetFields(&commandDataReader); - if (CHIP_END_OF_TLV == err) - { - ChipLogDetail(DataManagement, - "Received command without data for Group=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, groupId, - ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); - commandDataReader.Init(sNoFields); - err = commandDataReader.Next(); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - } - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::Failure); - - // Per spec, we do the "is this a timed command?" check for every path, but - // since all paths that fail it just get silently discarded we can do it - // once up front and discard all the paths at once. Ordering with respect - // to ACL and command presence checks does not matter, because the behavior - // is the same for all of them: ignore the path. - if (CommandNeedsTimedInvoke(clusterId, commandId)) - { - // Group commands are never timed. - return Status::Success; - } - - // No check for `CommandIsFabricScoped` unlike in `ProcessCommandDataIB()` since group commands - // always have an accessing fabric, by definition. - - // Find which endpoints can process the command, and dispatch to them. - iterator = groupDataProvider->IterateEndpoints(fabric); - VerifyOrReturnError(iterator != nullptr, Status::Failure); - - while (iterator->Next(mapping)) - { - if (groupId != mapping.group_id) - { - continue; - } - - ChipLogDetail(DataManagement, - "Processing group command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - mapping.endpoint_id, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); - - const ConcreteCommandPath concretePath(mapping.endpoint_id, clusterId, commandId); - - if (mpCallback->CommandExists(concretePath) != Status::Success) - { - ChipLogDetail(DataManagement, "No command " ChipLogFormatMEI " in Cluster " ChipLogFormatMEI " on Endpoint 0x%x", - ChipLogValueMEI(commandId), ChipLogValueMEI(clusterId), mapping.endpoint_id); - - continue; - } - - { - Access::SubjectDescriptor subjectDescriptor = GetSubjectDescriptor(); - Access::RequestPath requestPath{ .cluster = concretePath.mClusterId, .endpoint = concretePath.mEndpointId }; - Access::Privilege requestPrivilege = RequiredPrivilege::ForInvokeCommand(concretePath); - err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege); - if (err != CHIP_NO_ERROR) - { - // NOTE: an expected error is CHIP_ERROR_ACCESS_DENIED, but there could be other unexpected errors; - // therefore, keep processing subsequent commands, and if any errors continue, those subsequent - // commands will likewise fail. - continue; - } - } - if ((err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())) == CHIP_NO_ERROR) - { - TLV::TLVReader dataReader(commandDataReader); - mpCallback->DispatchCommand(*this, concretePath, dataReader); - DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor()); - } - else - { - ChipLogError(DataManagement, - "Error when calling PreCommandReceived for Endpoint=%u Cluster=" ChipLogFormatMEI - " Command=" ChipLogFormatMEI " : %" CHIP_ERROR_FORMAT, - mapping.endpoint_id, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId), err.Format()); - continue; - } - } - iterator->Release(); - return Status::Success; -} - -CHIP_ERROR CommandHandler::TryAddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus) -{ - // Return early when response should not be sent out. - VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); - - ReturnErrorOnFailure(PrepareStatus(aCommandPath)); - CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); - StatusIB::Builder & statusIBBuilder = commandStatus.CreateErrorStatus(); - ReturnErrorOnFailure(commandStatus.GetError()); - statusIBBuilder.EncodeStatusIB(aStatus); - ReturnErrorOnFailure(statusIBBuilder.GetError()); - return FinishStatus(); -} - -CHIP_ERROR CommandHandler::AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus) -{ - return TryAddingResponse([&]() -> CHIP_ERROR { return TryAddStatusInternal(aCommandPath, aStatus); }); -} - -void CommandHandler::AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, - const char * context) -{ - - CHIP_ERROR error = FallibleAddStatus(aCommandPath, aStatus, context); - - if (error != CHIP_NO_ERROR) - { - ChipLogError(DataManagement, "Failed to add command status: %" CHIP_ERROR_FORMAT, error.Format()); - // TODO(#30453) we could call mpResponder->ResponseDropped() if err == CHIP_ERROR_NO_MEMORY. This should - // be done as a follow up so that change can be evaluated as a standalone PR. - - // Do not crash if the status has not been added due to running out of packet buffers or other resources. - // It is better to drop a single response than to go offline and lose all sessions and subscriptions. - VerifyOrDie(error == CHIP_ERROR_NO_MEMORY); - } -} - -CHIP_ERROR CommandHandler::FallibleAddStatus(const ConcreteCommandPath & path, const Protocols::InteractionModel::Status status, - const char * context) -{ - if (status != Status::Success) - { - if (context == nullptr) - { - context = "no additional context"; - } - - ChipLogError(DataManagement, - "Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI " status " ChipLogFormatIMStatus " (%s)", - path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mCommandId), - ChipLogValueIMStatus(status), context); - } - - return AddStatusInternal(path, StatusIB(status)); -} - -CHIP_ERROR CommandHandler::AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) -{ - return AddStatusInternal(aCommandPath, StatusIB(Status::Success, aClusterStatus)); -} - -CHIP_ERROR CommandHandler::AddClusterSpecificFailure(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) -{ - return AddStatusInternal(aCommandPath, StatusIB(Status::Failure, aClusterStatus)); -} - -CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const ConcreteCommandPath & aResponseCommandPath, - const CommandHandler::InvokeResponseParameters & aPrepareParameters) -{ - auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aPrepareParameters.mRequestCommandPath); - VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - - return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aPrepareParameters.mStartOrEndDataStruct); -} - -CHIP_ERROR CommandHandler::PrepareCommand(const ConcreteCommandPath & aResponseCommandPath, bool aStartDataStruct) -{ - // Legacy code is calling the deprecated version of PrepareCommand. If we are in a case where - // there was a single command in the request, we can just assume this response is triggered by - // the single command. - size_t countOfPathRegistryEntries = GetCommandPathRegistry().Count(); - - // At this point application supports Batch Invoke Commands since CommandPathRegistry has more than 1 entry, - // but application is calling the deprecated PrepareCommand. We have no way to determine the associated CommandRef - // to put into the InvokeResponse. - VerifyOrDieWithMsg(countOfPathRegistryEntries == 1, DataManagement, - "Seemingly device supports batch commands, but is calling the deprecated PrepareCommand API"); - - auto commandPathRegistryEntry = GetCommandPathRegistry().GetFirstEntry(); - VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - - return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aStartDataStruct); -} - -CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, - const ConcreteCommandPath & aCommandPath, bool aStartDataStruct) -{ - // Intentionally omitting the ResponsesAccepted early exit. Direct use of PrepareInvokeResponseCommand - // is discouraged, as it often indicates incorrect usage patterns (see GitHub issue #32486). - // If you're encountering CHIP_ERROR_INCORRECT_STATE, refactoring to use AddResponse is recommended. - ReturnErrorOnFailure(AllocateBuffer()); - - if (!mInternalCallToAddResponseData && mState == State::AddedCommand) - { - // An attempt is being made to add CommandData InvokeResponse using primitive - // CommandHandler APIs. While not recommended, as this potentially leaves the - // CommandHandler in an incorrect state upon failure, this approach is permitted - // for legacy reasons. To maximize the likelihood of success, particularly when - // handling large amounts of data, we try to obtain a new, completely empty - // InvokeResponseMessage, as the existing one already has space occupied. - ReturnErrorOnFailure(FinalizeInvokeResponseMessageAndPrepareNext()); - } - - CreateBackupForResponseRollback(); - // - // We must not be in the middle of preparing a command, or having prepared or sent one. - // - VerifyOrReturnError(mState == State::NewResponseMessage || mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); - - // TODO(#30453): See if we can pass this back up the stack so caller can provide this instead of taking up - // space in CommandHanlder. - mRefForResponse = apCommandPathRegistryEntry.ref; - - MoveToState(State::Preparing); - InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); - InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); - ReturnErrorOnFailure(invokeResponses.GetError()); - - CommandDataIB::Builder & commandData = invokeResponse.CreateCommand(); - ReturnErrorOnFailure(commandData.GetError()); - CommandPathIB::Builder & path = commandData.CreatePath(); - ReturnErrorOnFailure(commandData.GetError()); - ReturnErrorOnFailure(path.Encode(aCommandPath)); - if (aStartDataStruct) - { - ReturnErrorOnFailure(commandData.GetWriter()->StartContainer(TLV::ContextTag(CommandDataIB::Tag::kFields), - TLV::kTLVType_Structure, mDataElementContainerType)); - } - MoveToState(State::AddingCommand); - return CHIP_NO_ERROR; -} - -CHIP_ERROR CommandHandler::FinishCommand(bool aStartDataStruct) -{ - // Intentionally omitting the ResponsesAccepted early exit. Direct use of FinishCommand - // is discouraged, as it often indicates incorrect usage patterns (see GitHub issue #32486). - // If you're encountering CHIP_ERROR_INCORRECT_STATE, refactoring to use AddResponse is recommended. - VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); - CommandDataIB::Builder & commandData = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand(); - if (aStartDataStruct) - { - ReturnErrorOnFailure(commandData.GetWriter()->EndContainer(mDataElementContainerType)); - } - - if (mRefForResponse.has_value()) - { - ReturnErrorOnFailure(commandData.Ref(*mRefForResponse)); - } - - ReturnErrorOnFailure(commandData.EndOfCommandDataIB()); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB()); - MoveToState(State::AddedCommand); - return CHIP_NO_ERROR; -} - -CHIP_ERROR CommandHandler::PrepareStatus(const ConcreteCommandPath & aCommandPath) -{ - ReturnErrorOnFailure(AllocateBuffer()); - // - // We must not be in the middle of preparing a command, or having prepared or sent one. - // - VerifyOrReturnError(mState == State::NewResponseMessage || mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); - if (mState == State::AddedCommand) - { - CreateBackupForResponseRollback(); - } - - auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aCommandPath); - VerifyOrReturnError(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - mRefForResponse = commandPathRegistryEntry->ref; - - MoveToState(State::Preparing); - InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); - InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); - ReturnErrorOnFailure(invokeResponses.GetError()); - CommandStatusIB::Builder & commandStatus = invokeResponse.CreateStatus(); - ReturnErrorOnFailure(commandStatus.GetError()); - CommandPathIB::Builder & path = commandStatus.CreatePath(); - ReturnErrorOnFailure(commandStatus.GetError()); - ReturnErrorOnFailure(path.Encode(aCommandPath)); - MoveToState(State::AddingCommand); - return CHIP_NO_ERROR; -} - -CHIP_ERROR CommandHandler::FinishStatus() -{ - VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); - - CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); - if (mRefForResponse.has_value()) - { - ReturnErrorOnFailure(commandStatus.Ref(*mRefForResponse)); - } - - ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus().EndOfCommandStatusIB()); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB()); - MoveToState(State::AddedCommand); - return CHIP_NO_ERROR; -} - -void CommandHandler::CreateBackupForResponseRollback() -{ - VerifyOrReturn(mState == State::NewResponseMessage || mState == State::AddedCommand); - VerifyOrReturn(mInvokeResponseBuilder.GetInvokeResponses().GetError() == CHIP_NO_ERROR); - VerifyOrReturn(mInvokeResponseBuilder.GetError() == CHIP_NO_ERROR); - mInvokeResponseBuilder.Checkpoint(mBackupWriter); - mBackupState = mState; - mRollbackBackupValid = true; -} - -CHIP_ERROR CommandHandler::RollbackResponse() -{ - VerifyOrReturnError(mRollbackBackupValid, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mState == State::Preparing || mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); - ChipLogDetail(DataManagement, "Rolling back response"); - // TODO(#30453): Rollback of mInvokeResponseBuilder should handle resetting - // InvokeResponses. - mInvokeResponseBuilder.GetInvokeResponses().ResetError(); - mInvokeResponseBuilder.Rollback(mBackupWriter); - MoveToState(mBackupState); - mRollbackBackupValid = false; - return CHIP_NO_ERROR; -} - -TLV::TLVWriter * CommandHandler::GetCommandDataIBTLVWriter() -{ - if (mState != State::AddingCommand) - { - return nullptr; - } - - return mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand().GetWriter(); -} - -FabricIndex CommandHandler::GetAccessingFabricIndex() const -{ - VerifyOrDie(!mGoneAsync); - VerifyOrDie(mpResponder); - return mpResponder->GetAccessingFabricIndex(); -} void CommandHandler::Handle::Init(CommandHandler * handler) { @@ -825,7 +31,7 @@ void CommandHandler::Handle::Init(CommandHandler * handler) CommandHandler * CommandHandler::Handle::Get() { - // Not safe to work with CommandHandler in parallel with other Matter work. + // Not safe to work with CommandHandlerImpl in parallel with other Matter work. assertChipStackLockedByCurrentThread(); return mpHandler; @@ -845,216 +51,5 @@ CommandHandler::Handle::Handle(CommandHandler * handler) Init(handler); } -CHIP_ERROR CommandHandler::FinalizeInvokeResponseMessageAndPrepareNext() -{ - ReturnErrorOnFailure(FinalizeInvokeResponseMessage(/* aHasMoreChunks = */ true)); - // After successfully finalizing InvokeResponseMessage, no buffer should remain - // allocated. - VerifyOrDie(!mBufferAllocated); - CHIP_ERROR err = AllocateBuffer(); - if (err != CHIP_NO_ERROR) - { - // TODO(#30453): Improve ResponseDropped calls to occur only when dropping is - // definitively guaranteed. - // Response dropping is not yet definitive as a subsequent call - // to AllocateBuffer might succeed. - VerifyOrDie(mpResponder); - mpResponder->ResponseDropped(); - } - return err; -} - -CHIP_ERROR CommandHandler::FinalizeInvokeResponseMessage(bool aHasMoreChunks) -{ - System::PacketBufferHandle packet; - - VerifyOrReturnError(mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().EndOfInvokeResponses()); - if (aHasMoreChunks) - { - // Unreserving space previously reserved for MoreChunkedMessages is done - // in the call to mInvokeResponseBuilder.MoreChunkedMessages. - mInvokeResponseBuilder.MoreChunkedMessages(aHasMoreChunks); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); - } - ReturnErrorOnFailure(mInvokeResponseBuilder.EndOfInvokeResponseMessage()); - ReturnErrorOnFailure(mCommandMessageWriter.Finalize(&packet)); - VerifyOrDie(mpResponder); - mpResponder->AddInvokeResponseToSend(std::move(packet)); - mBufferAllocated = false; - mRollbackBackupValid = false; - return CHIP_NO_ERROR; -} - -void CommandHandler::SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder) -{ - VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "CommandResponseSender can only be set in idle state"); - mpResponder = commandResponder; -} - -const char * CommandHandler::GetStateStr() const -{ -#if CHIP_DETAIL_LOGGING - switch (mState) - { - case State::Idle: - return "Idle"; - - case State::NewResponseMessage: - return "NewResponseMessage"; - - case State::Preparing: - return "Preparing"; - - case State::AddingCommand: - return "AddingCommand"; - - case State::AddedCommand: - return "AddedCommand"; - - case State::DispatchResponses: - return "DispatchResponses"; - - case State::AwaitingDestruction: - return "AwaitingDestruction"; - } -#endif // CHIP_DETAIL_LOGGING - return "N/A"; -} - -void CommandHandler::MoveToState(const State aTargetState) -{ - mState = aTargetState; - ChipLogDetail(DataManagement, "Command handler moving to [%10.10s]", GetStateStr()); -} - -#if CHIP_WITH_NLFAULTINJECTION - -namespace { - -CHIP_ERROR TestOnlyExtractCommandPathFromNextInvokeRequest(TLV::TLVReader & invokeRequestsReader, - ConcreteCommandPath & concretePath) -{ - ReturnErrorOnFailure(invokeRequestsReader.Next(TLV::AnonymousTag())); - CommandDataIB::Parser commandData; - ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); - CommandPathIB::Parser commandPath; - ReturnErrorOnFailure(commandData.GetPath(&commandPath)); - return commandPath.GetConcreteCommandPath(concretePath); -} - -[[maybe_unused]] const char * GetFaultInjectionTypeStr(CommandHandler::NlFaultInjectionType faultType) -{ - switch (faultType) - { - case CommandHandler::NlFaultInjectionType::SeparateResponseMessages: - return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be the same as the " - "original request."; - case CommandHandler::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder: - return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be reversed from the " - "original request."; - case CommandHandler::NlFaultInjectionType::SkipSecondResponse: - return "Single InvokeResponseMessages. Dropping response to second request"; - } - ChipLogError(DataManagement, "TH Failure: Unexpected fault type"); - chipAbort(); -} - -} // anonymous namespace - -// This method intentionally duplicates code from other sections. While code consolidation -// is generally preferred, here we prioritize generating a clear crash message to aid in -// troubleshooting test failures. -void CommandHandler::TestOnlyInvokeCommandRequestWithFaultsInjected(CommandHandlerExchangeInterface & commandResponder, - System::PacketBufferHandle && payload, bool isTimedInvoke, - NlFaultInjectionType faultType) -{ - VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "TH Failure: state should be Idle, issue with TH"); - SetExchangeInterface(&commandResponder); - - ChipLogProgress(DataManagement, "Response to InvokeRequestMessage overridden by fault injection"); - ChipLogProgress(DataManagement, " Injecting the following response:%s", GetFaultInjectionTypeStr(faultType)); - - Handle workHandle(this); - VerifyOrDieWithMsg(!commandResponder.GetGroupId().HasValue(), DataManagement, "DUT Failure: Unexpected Group Command"); - - System::PacketBufferTLVReader reader; - InvokeRequestMessage::Parser invokeRequestMessage; - InvokeRequests::Parser invokeRequests; - reader.Init(std::move(payload)); - VerifyOrDieWithMsg(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, DataManagement, - "TH Failure: Failed 'invokeRequestMessage.Init(reader)'"); -#if CHIP_CONFIG_IM_PRETTY_PRINT - invokeRequestMessage.PrettyPrint(); -#endif - - VerifyOrDieWithMsg(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, DataManagement, - "DUT Failure: Mandatory SuppressResponse field missing"); - VerifyOrDieWithMsg(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, DataManagement, - "DUT Failure: Mandatory TimedRequest field missing"); - VerifyOrDieWithMsg(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, DataManagement, - "DUT Failure: Mandatory InvokeRequests field missing"); - VerifyOrDieWithMsg(mTimedRequest == isTimedInvoke, DataManagement, - "DUT Failure: TimedRequest value in message mismatches action"); - - { - InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; - VerifyOrDieWithMsg(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, - DataManagement, "DUT Failure: InvokeRequestMessage contents were invalid"); - } - - TLV::TLVReader invokeRequestsReader; - invokeRequests.GetReader(&invokeRequestsReader); - - size_t commandCount = 0; - VerifyOrDieWithMsg(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, - DataManagement, - "TH Failure: Failed to get the length of InvokeRequests after InvokeRequestMessage validation"); - - // The command count check (specifically for a count of 2) is tied to IDM_1_3. This may need adjustment for - // compatibility with future test plans. - VerifyOrDieWithMsg(commandCount == 2, DataManagement, "DUT failure: We were strictly expecting exactly 2 InvokeRequests"); - mReserveSpaceForMoreChunkMessages = true; - - { - // Response path is the same as request path since we are replying with a failure message. - ConcreteCommandPath concreteResponsePath1; - ConcreteCommandPath concreteResponsePath2; - VerifyOrDieWithMsg( - TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath1) == CHIP_NO_ERROR, - DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the first request"); - VerifyOrDieWithMsg( - TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath2) == CHIP_NO_ERROR, - DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the second request"); - - if (faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) - { - ConcreteCommandPath temp(concreteResponsePath1); - concreteResponsePath1 = concreteResponsePath2; - concreteResponsePath2 = temp; - } - - VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath1, Status::Failure) == CHIP_NO_ERROR, DataManagement, - "TH Failure: Error adding the first InvokeResponse"); - if (faultType == NlFaultInjectionType::SeparateResponseMessages || - faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) - { - VerifyOrDieWithMsg(FinalizeInvokeResponseMessageAndPrepareNext() == CHIP_NO_ERROR, DataManagement, - "TH Failure: Failed to create second InvokeResponseMessage"); - } - if (faultType != NlFaultInjectionType::SkipSecondResponse) - { - VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath2, Status::Failure) == CHIP_NO_ERROR, DataManagement, - "TH Failure: Error adding the second InvokeResponse"); - } - } - - VerifyOrDieWithMsg(invokeRequestsReader.Next() == CHIP_END_OF_TLV, DataManagement, - "DUT Failure: Unexpected TLV ending of InvokeRequests"); - VerifyOrDieWithMsg(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, DataManagement, - "DUT Failure: InvokeRequestMessage TLV is not properly terminated"); -} -#endif // CHIP_WITH_NLFAULTINJECTION - } // namespace app } // namespace chip diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index ae41ec1fe350fb..86f687c1c02466 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -15,78 +15,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * A handler for incoming Invoke interactions. - * - * Allows adding responses to be sent in an InvokeResponse: see the various - * "Add*" methods. - * - * Allows adding the responses asynchronously. See the documentation - * for the CommandHandler::Handle class below. - * - */ - #pragma once #include -#include #include #include #include #include -#include -#include -#include #include -#include #include -#include #include -#include -#include -#include -#include -#include -#include - -#include -#include namespace chip { namespace app { +/** + * A handler for incoming Invoke interactions. + * + * Allows adding responses to be sent in an InvokeResponse: see the various + * "Add*" methods. + * + * Allows adding the responses asynchronously when using `CommandHandler::Handle` + * (see documentation for `CommandHandler::Handle` for details) + * + * Upgrading notes: this class has moved to an interface from a previous more complex + * implementation. If upgrading code between versions, please see docs/upgrading.md + */ class CommandHandler { public: - class Callback - { - public: - virtual ~Callback() = default; - - /* - * Method that signals to a registered callback that this object - * has completed doing useful work and is now safe for release/destruction. - */ - virtual void OnDone(CommandHandler & apCommandObj) = 0; - - /* - * Upon processing of a CommandDataIB, this method is invoked to dispatch the command - * to the right server-side handler provided by the application. - */ - virtual void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, - TLV::TLVReader & apPayload) = 0; - - /* - * Check to see if a command implementation exists for a specific - * concrete command path. If it does, Success will be returned. If - * not, one of UnsupportedEndpoint, UnsupportedCluster, or - * UnsupportedCommand will be returned, depending on how the command - * fails to exist. - */ - virtual Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) = 0; - }; + virtual ~CommandHandler() = default; /** * Class that allows asynchronous command processing before sending a @@ -156,157 +114,23 @@ class CommandHandler CommandHandler * mpHandler = nullptr; }; - // Previously we kept adding arguments with default values individually as parameters. This is because there - // is legacy code outside of the SDK that would call PrepareCommand. With the new PrepareInvokeResponseCommand - // replacing PrepareCommand, we took this opportunity to create a new parameter structure to make it easier to - // add new parameters without there needing to be an ever increasing parameter list with defaults. - struct InvokeResponseParameters - { - InvokeResponseParameters(const ConcreteCommandPath & aRequestCommandPath) : mRequestCommandPath(aRequestCommandPath) {} - - InvokeResponseParameters & SetStartOrEndDataStruct(bool aStartOrEndDataStruct) - { - mStartOrEndDataStruct = aStartOrEndDataStruct; - return *this; - } - - ConcreteCommandPath mRequestCommandPath; - /** - * Whether the method this is being provided to should start/end the TLV container for the CommandFields element - * within CommandDataIB. - */ - bool mStartOrEndDataStruct = true; - }; - - struct TestOnlyOverrides - { - public: - CommandPathRegistry * commandPathRegistry = nullptr; - CommandHandlerExchangeInterface * commandResponder = nullptr; - }; - - /* - * Constructor. - * - * The callback passed in has to outlive this CommandHandler object. - */ - CommandHandler(Callback * apCallback); - - /* - * Destructor. - * - * The call will also invalidate all Handles created for this CommandHandler. - * - */ - ~CommandHandler(); - - /* - * Constructor to override the number of supported paths per invoke and command responder. - * - * The callback and any pointers passed via TestOnlyOverrides must outlive this - * CommandHandler object. - * - * For testing purposes. - */ - CommandHandler(TestOnlyOverrides & aTestOverride, Callback * apCallback); - - /* - * Main entrypoint for this class to handle an InvokeRequestMessage. - * - * This function MAY call the registered OnDone callback before returning. - * To prevent immediate OnDone invocation, callers can wrap their CommandHandler instance - * within a CommandHandler::Handle. - * - * isTimedInvoke is true if and only if this is part of a Timed Invoke - * transaction (i.e. was preceded by a Timed Request). If we reach here, - * the timer verification has already been done. - * - * commandResponder handles sending InvokeResponses, added by clusters, to the client. The - * command responder object must outlive this CommandHandler object. It is only safe to - * release after the caller of OnInvokeCommandRequest receives the OnDone callback. - */ - Protocols::InteractionModel::Status OnInvokeCommandRequest(CommandHandlerExchangeInterface & commandResponder, - System::PacketBufferHandle && payload, bool isTimedInvoke); - - /** - * Checks that all CommandDataIB within InvokeRequests satisfy the spec's general - * constraints for CommandDataIB. Additionally checks that InvokeRequestMessage is - * properly formatted. - * - * This also builds a registry to ensure that all commands can be responded - * to with the data required as per spec. - */ - CHIP_ERROR ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage); - /** * Adds the given command status and returns any failures in adding statuses (e.g. out * of buffer space) to the caller */ - CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aRequestCommandPath, const Protocols::InteractionModel::Status aStatus, - const char * context = nullptr); + virtual CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aRequestCommandPath, + const Protocols::InteractionModel::Status aStatus, const char * context = nullptr) = 0; /** * Adds a status when the caller is unable to handle any failures. Logging is performed * and failure to register the status is checked with VerifyOrDie. */ - void AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, - const char * context = nullptr); + virtual void AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, + const char * context = nullptr) = 0; - CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus); + virtual CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) = 0; - CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus); - - /** - * This adds a new CommandDataIB element into InvokeResponses for the associated - * aRequestCommandPath. This adds up until the `CommandFields` element within - * `CommandDataIB`. - * - * This call will fail if CommandHandler is already in the middle of building a - * CommandStatusIB or CommandDataIB (i.e. something has called Prepare*, without - * calling Finish*), or is already sending InvokeResponseMessage. - * - * Upon success, the caller is expected to call `FinishCommand` once they have added - * all the fields into the CommandFields element of CommandDataIB. - * - * @param [in] aResponseCommandPath the concrete response path that we are sending to Requester. - * @param [in] aPrepareParameters struct containing paramters needs for preparing a command. Data - * such as request path, and whether this method should start the CommandFields element within - * CommandDataIB. - */ - CHIP_ERROR PrepareInvokeResponseCommand(const ConcreteCommandPath & aResponseCommandPath, - const InvokeResponseParameters & aPrepareParameters); - - [[deprecated("PrepareCommand now needs the requested command path. Please use PrepareInvokeResponseCommand")]] CHIP_ERROR - PrepareCommand(const ConcreteCommandPath & aCommandPath, bool aStartDataStruct = true); - - /** - * Finishes the CommandDataIB element within the InvokeResponses. - * - * Caller must have first successfully called `PrepareInvokeResponseCommand`. - * - * @param [in] aEndDataStruct end the TLV container for the CommandFields element within - * CommandDataIB. This should match the boolean passed into Prepare*. - * - * @return CHIP_ERROR_INCORRECT_STATE - * If device has not previously successfully called - * `PrepareInvokeResponseCommand`. - * @return CHIP_ERROR_BUFFER_TOO_SMALL - * If writing the values needed to finish the InvokeReponseIB - * with the current contents of the InvokeResponseMessage - * would exceed the limit. When this error occurs, it is possible - * we have already closed some of the IB Builders that were - * previously started in `PrepareInvokeResponseCommand`. - * @return CHIP_ERROR_NO_MEMORY - * If TLVWriter attempted to allocate an output buffer failed due to - * lack of memory. - * @return other Other TLVWriter related errors. Typically occurs if - * `GetCommandDataIBTLVWriter()` was called and used incorrectly. - */ - // TODO(#30453): We should be able to eliminate the chances of OOM issues with reserve. - // This will be completed in a follow up PR. - CHIP_ERROR FinishCommand(bool aEndDataStruct = true); - - TLV::TLVWriter * GetCommandDataIBTLVWriter(); + virtual CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) = 0; /** * GetAccessingFabricIndex() may only be called during synchronous command @@ -314,24 +138,7 @@ class CommandHandler * CommandHandler::Handle or equivalent) must not call this method, because * it will not work right if the session we're using was evicted. */ - FabricIndex GetAccessingFabricIndex() const; - - /** - * API for adding a data response. The template parameter T is generally - * expected to be a ClusterName::Commands::CommandName::Type struct, but any - * object that can be encoded using the DataModel::Encode machinery and - * exposes the right command id will work. - * - * @param [in] aRequestCommandPath the concrete path of the command we are - * responding to. - * @param [in] aData the data for the response. - */ - template - CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) - { - DataModel::EncodableType encoder(aData); - return AddResponseData(aRequestCommandPath, CommandData::GetCommandId(), encoder); - } + virtual FabricIndex GetAccessingFabricIndex() const = 0; /** * API for adding a data response. The `aEncodable` is generally expected to encode @@ -343,58 +150,48 @@ class CommandHandler * @param [in] aEncodable - an encodable that places the command data structure * for `aResponseCommandId` into a TLV Writer. * - * Most applications are likely to use `AddResponseData` as a more convenient - * one-call that auto-sets command ID and creates the underlying encoders. + * If you have no great way of handling the returned CHIP_ERROR, consider + * using `AddResponse` which will automatically reply with `Failure` in + * case AddResponseData fails. */ - CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) - { - // Return early when response should not be sent out. - VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); - return TryAddingResponse( - [&]() -> CHIP_ERROR { return TryAddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); }); - } + virtual CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) = 0; /** - * API for adding a response. This will try to encode a data response (response command), and if that fails will encode a a - * Protocols::InteractionModel::Status::Failure status response instead. + * Attempts to encode a response to a command. * - * The template parameter T is generally expected to be a ClusterName::Commands::CommandName::Type struct, but any object that - * can be encoded using the DataModel::Encode machinery and exposes the right command id will work. + * `aRequestCommandPath` represents the request path (endpoint/cluster/commandid) and the reply + * will preserve the same path and switch the command id to aResponseCommandId. * - * Since the function will call AddStatus when it fails to encode the data, it cannot send any response when it fails to encode - * a status code since another AddStatus call will also fail. The error from AddStatus will just be logged. + * As this command does not return any error codes, it must try its best to encode the reply + * and if it fails, it MUST encode a `Protocols::InteractionModel::Status::Failure` as a + * reply (i.e. a reply is guaranteed to be sent). * - * @param [in] aRequestCommandPath the concrete path of the command we are - * responding to. - * @param [in] aData the data for the response. + * Above is the main difference from AddResponseData: AddResponse will auto-reply with failure while + * AddResponseData allows the caller to try to deal with any CHIP_ERRORs. */ - template - void AddResponse(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) - { - DataModel::EncodableType encodable(aData); - return AddResponse(aRequestCommandPath, CommandData::GetCommandId(), encodable); - } + virtual void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) = 0; /** - * API for adding a response with a given encodable of TLV data. - * - * The encodable would generally encode a ClusterName::Commands::CommandName::Type with - * the corresponding `GetCommandId` call. + * Check whether the InvokeRequest we are handling is a timed invoke. */ - void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) - { - if (AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable) != CHIP_NO_ERROR) - { - AddStatus(aRequestCommandPath, Protocols::InteractionModel::Status::Failure); - } - } + virtual bool IsTimedInvoke() const = 0; /** - * Check whether the InvokeRequest we are handling is a timed invoke. + * @brief Flush acks right away for a slow command + * + * Some commands that do heavy lifting of storage/crypto should + * ack right away to improve reliability and reduce needless retries. This + * method can be manually called in commands that are especially slow to + * immediately schedule an acknowledgement (if needed) since the delayed + * stand-alone ack timer may actually not hit soon enough due to blocking command + * execution. + * */ - bool IsTimedInvoke() const { return mTimedRequest; } + virtual void FlushAcksRightAwayOnSlowCommand() = 0; + + virtual Access::SubjectDescriptor GetSubjectDescriptor() const = 0; /** * Gets the inner exchange context object, without ownership. @@ -407,310 +204,74 @@ class CommandHandler * exchange context has been assigned or the context * has been released. */ - Messaging::ExchangeContext * GetExchangeContext() const - { - VerifyOrDie(mpResponder); - return mpResponder->GetExchangeContext(); - } + virtual Messaging::ExchangeContext * GetExchangeContext() const = 0; /** - * @brief Flush acks right away for a slow command + * API for adding a data response. The template parameter T is generally + * expected to be a ClusterName::Commands::CommandName::Type struct, but any + * object that can be encoded using the DataModel::Encode machinery and + * exposes the right command id will work. * - * Some commands that do heavy lifting of storage/crypto should - * ack right away to improve reliability and reduce needless retries. This - * method can be manually called in commands that are especially slow to - * immediately schedule an acknowledgement (if needed) since the delayed - * stand-alone ack timer may actually not hit soon enough due to blocking command - * execution. + * If you have no great way of handling the returned CHIP_ERROR, consider + * using `AddResponse` which will automatically reply with `Failure` in + * case AddResponseData fails. + * + * @param [in] aRequestCommandPath the concrete path of the command we are + * responding to. * + * The response path will be the same as the request, except the + * reply command ID used will be `CommandData::GetCommandId()` assumed + * to be a member of the templated type + * + * @param [in] aData the data for the response. It is expected to provide + * `GetCommandData` as a STATIC on its type as well as encode the + * correct data structure for building a reply. */ - void FlushAcksRightAwayOnSlowCommand() + template + CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) { - if (mpResponder) - { - mpResponder->HandlingSlowCommand(); - } + DataModel::EncodableType encoder(aData); + return AddResponseData(aRequestCommandPath, CommandData::GetCommandId(), encoder); } /** - * GetSubjectDescriptor() may only be called during synchronous command - * processing. Anything that runs async (while holding a - * CommandHandler::Handle or equivalent) must not call this method, because - * it might not work right if the session we're using was evicted. - */ - Access::SubjectDescriptor GetSubjectDescriptor() const - { - VerifyOrDie(!mGoneAsync); - VerifyOrDie(mpResponder); - return mpResponder->GetSubjectDescriptor(); - } - -#if CHIP_WITH_NLFAULTINJECTION - - enum class NlFaultInjectionType : uint8_t - { - SeparateResponseMessages, - SeparateResponseMessagesAndInvertedResponseOrder, - SkipSecondResponse - }; - - /** - * @brief Sends InvokeResponseMessages with injected faults for certification testing. - * - * The Test Harness (TH) uses this to simulate various server response behaviors, - * ensuring the Device Under Test (DUT) handles responses per specification. + * API for adding a response. This will try to encode a data response (response command), and if that fails + * it will encode a Protocols::InteractionModel::Status::Failure status response instead. * - * This function strictly validates the DUT's InvokeRequestMessage against the test plan. - * If deviations occur, the TH terminates with a detailed error message. + * Above is the main difference from AddResponseData: AddResponse will auto-reply with failure while + * AddResponseData allows the caller to try to deal with any CHIP_ERRORs. * - * @param commandResponder commandResponder that will send the InvokeResponseMessages to the client. - * @param payload Payload of the incoming InvokeRequestMessage from the client. - * @param isTimedInvoke Indicates whether the interaction is timed. - * @param faultType The specific type of fault to inject into the response. - */ - // TODO(#30453): After refactoring CommandHandler for better unit testability, create a - // unit test specifically for the fault injection behavior. - void TestOnlyInvokeCommandRequestWithFaultsInjected(CommandHandlerExchangeInterface & commandResponder, - System::PacketBufferHandle && payload, bool isTimedInvoke, - NlFaultInjectionType faultType); -#endif // CHIP_WITH_NLFAULTINJECTION - -private: - friend class TestCommandInteraction; - friend class CommandHandler::Handle; - - enum class State : uint8_t - { - Idle, ///< Default state that the object starts out in, where no work has commenced - NewResponseMessage, ///< mInvokeResponseBuilder is ready, with no responses added. - Preparing, ///< We are prepaing the command or status header. - AddingCommand, ///< In the process of adding a command. - AddedCommand, ///< A command has been completely encoded and is awaiting transmission. - DispatchResponses, ///< The command response(s) are being dispatched. - AwaitingDestruction, ///< The object has completed its work and is awaiting destruction by the application. - }; - - /** - * @brief Best effort to add InvokeResponse to InvokeResponseMessage. + * The template parameter T is generally expected to be a ClusterName::Commands::CommandName::Type struct, but any object that + * can be encoded using the DataModel::Encode machinery and exposes the right command id will work. * - * Tries to add response using lambda. Upon failure to add response, attempts - * to rollback the InvokeResponseMessage to a known good state. If failure is due - * to insufficient space in the current InvokeResponseMessage: - * - Finalizes the current InvokeResponseMessage. - * - Allocates a new InvokeResponseMessage. - * - Reattempts to add the InvokeResponse to the new InvokeResponseMessage. + * Since the function will call AddStatus when it fails to encode the data, it cannot send any response when it fails to encode + * a status code since another AddStatus call will also fail. The error from AddStatus will just be logged. * - * @param [in] addResponseFunction A lambda function responsible for adding the - * response to the current InvokeResponseMessage. + * @param [in] aRequestCommandPath the concrete path of the command we are + * responding to. + * @param [in] aData the data for the response. */ - template - CHIP_ERROR TryAddingResponse(Function && addResponseFunction) + template + void AddResponse(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) { - // Invalidate any existing rollback backups. The addResponseFunction is - // expected to create a new backup during either PrepareInvokeResponseCommand - // or PrepareStatus execution. Direct invocation of - // CreateBackupForResponseRollback is avoided since the buffer used by - // InvokeResponseMessage might not be allocated until a Prepare* function - // is called. - mRollbackBackupValid = false; - CHIP_ERROR err = addResponseFunction(); - if (err == CHIP_NO_ERROR) - { - return CHIP_NO_ERROR; - } - ReturnErrorOnFailure(RollbackResponse()); - // If we failed to add a command due to lack of space in the - // packet, we will make another attempt to add the response using - // an additional InvokeResponseMessage. - if (mState != State::AddedCommand || err != CHIP_ERROR_NO_MEMORY) - { - return err; - } - ReturnErrorOnFailure(FinalizeInvokeResponseMessageAndPrepareNext()); - err = addResponseFunction(); - if (err != CHIP_NO_ERROR) - { - // The return value of RollbackResponse is ignored, as we prioritize - // conveying the error generated by addResponseFunction to the - // caller. - RollbackResponse(); - } - return err; + DataModel::EncodableType encodable(aData); + AddResponse(aRequestCommandPath, CommandData::GetCommandId(), encodable); } - void MoveToState(const State aTargetState); - const char * GetStateStr() const; - - /** - * Create a backup to enable rolling back to the state prior to ResponseData encoding in the event of failure. - */ - void CreateBackupForResponseRollback(); - - /** - * Rollback the state to before encoding the current ResponseData (before calling PrepareInvokeResponseCommand / PrepareStatus) - * - * Requires CreateBackupForResponseRollback to be called at the start of PrepareInvokeResponseCommand / PrepareStatus - */ - CHIP_ERROR RollbackResponse(); - - /* - * This forcibly closes the exchange context if a valid one is pointed to. Such a situation does - * not arise during normal message processing flows that all normally call Close() above. This can only - * arise due to application-initiated destruction of the object when this object is handling receiving/sending - * message payloads. - */ - void Abort(); - +protected: /** * IncrementHoldOff will increase the inner refcount of the CommandHandler. * * Users should use CommandHandler::Handle for management the lifespan of the CommandHandler. * DefRef should be released in reasonable time, and Close() should only be called when the refcount reached 0. */ - void IncrementHoldOff(Handle * apHandle); + virtual void IncrementHoldOff(Handle * apHandle) {} /** * DecrementHoldOff is used by CommandHandler::Handle for decreasing the refcount of the CommandHandler. * When refcount reached 0, CommandHandler will send the response to the peer and shutdown. */ - void DecrementHoldOff(Handle * apHandle); - - /* - * Allocates a packet buffer used for encoding an invoke response payload. - * - * This can be called multiple times safely, as it will only allocate the buffer once for the lifetime - * of this object. - */ - CHIP_ERROR AllocateBuffer(); - - /** - * This will add a new CommandStatusIB element into InvokeResponses. It will put the - * aCommandPath into the CommandPath element within CommandStatusIB. - * - * This call will fail if CommandHandler is already in the middle of building a - * CommandStatusIB or CommandDataIB (i.e. something has called Prepare*, without - * calling Finish*), or is already sending InvokeResponseMessage. - * - * Upon success, the caller is expected to call `FinishStatus` once they have encoded - * StatusIB. - * - * @param [in] aCommandPath the concrete path of the command we are responding to. - */ - CHIP_ERROR PrepareStatus(const ConcreteCommandPath & aCommandPath); - - /** - * Finishes the CommandStatusIB element within the InvokeResponses. - * - * Caller must have first successfully called `PrepareStatus`. - */ - CHIP_ERROR FinishStatus(); - - CHIP_ERROR PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, - const ConcreteCommandPath & aCommandPath, bool aStartDataStruct); - - CHIP_ERROR FinalizeLastInvokeResponseMessage() { return FinalizeInvokeResponseMessage(/* aHasMoreChunks = */ false); } - - CHIP_ERROR FinalizeInvokeResponseMessageAndPrepareNext(); - - CHIP_ERROR FinalizeInvokeResponseMessage(bool aHasMoreChunks); - - Protocols::InteractionModel::Status ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke); - - /** - * Called internally to signal the completion of all work on this object, gracefully close the - * exchange (by calling into the base class) and finally, signal to a registerd callback that it's - * safe to release this object. - */ - void Close(); - - /** - * ProcessCommandDataIB is only called when a unicast invoke command request is received - * It requires the endpointId in its command path to be able to dispatch the command - */ - Protocols::InteractionModel::Status ProcessCommandDataIB(CommandDataIB::Parser & aCommandElement); - - /** - * ProcessGroupCommandDataIB is only called when a group invoke command request is received - * It doesn't need the endpointId in it's command path since it uses the GroupId in message metadata to find it - */ - Protocols::InteractionModel::Status ProcessGroupCommandDataIB(CommandDataIB::Parser & aCommandElement); - - CHIP_ERROR TryAddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); - - CHIP_ERROR AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); - - /** - * If this function fails, it may leave our TLV buffer in an inconsistent state. - * Callers should snapshot as needed before calling this function, and roll back - * as needed afterward. - * - * @param [in] aRequestCommandPath the concrete path of the command we are responding to - * @param [in] aResponseCommandId the id of the command to encode - * @param [in] aEncodable the data to encode for the given aResponseCommandId - */ - CHIP_ERROR TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable); - - void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder); - - /** - * Check whether the InvokeRequest we are handling is targeted to a group. - */ - bool IsGroupRequest() { return mGroupRequest; } - - bool ResponsesAccepted() { return !(mGroupRequest || mpResponder == nullptr); } - - /** - * Sets the state flag to keep the information that request we are handling is targeted to a group. - */ - void SetGroupRequest(bool isGroupRequest) { mGroupRequest = isGroupRequest; } - - CommandPathRegistry & GetCommandPathRegistry() const { return *mCommandPathRegistry; } - - size_t MaxPathsPerInvoke() const { return mMaxPathsPerInvoke; } - - void AddToHandleList(Handle * handle); - - void RemoveFromHandleList(Handle * handle); - - void InvalidateHandles(); - - bool TestOnlyIsInIdleState() const { return mState == State::Idle; } - - Callback * mpCallback = nullptr; - InvokeResponseMessage::Builder mInvokeResponseBuilder; - TLV::TLVType mDataElementContainerType = TLV::kTLVType_NotSpecified; - size_t mPendingWork = 0; - /* List to store all currently-outstanding Handles for this Command Handler.*/ - IntrusiveList mpHandleList; - - chip::System::PacketBufferTLVWriter mCommandMessageWriter; - TLV::TLVWriter mBackupWriter; - size_t mMaxPathsPerInvoke = CHIP_CONFIG_MAX_PATHS_PER_INVOKE; - // TODO(#30453): See if we can reduce this size for the default cases - // TODO Allow flexibility in registration. - BasicCommandPathRegistry mBasicCommandPathRegistry; - CommandPathRegistry * mCommandPathRegistry = &mBasicCommandPathRegistry; - std::optional mRefForResponse; - - CommandHandlerExchangeInterface * mpResponder = nullptr; - - State mState = State::Idle; - State mBackupState; - ScopedChangeOnly mInternalCallToAddResponseData{ false }; - bool mSuppressResponse = false; - bool mTimedRequest = false; - bool mGroupRequest = false; - bool mBufferAllocated = false; - bool mReserveSpaceForMoreChunkMessages = false; - // TODO(#32486): We should introduce breaking change where calls to add CommandData - // need to use AddResponse, and not CommandHandler primitives directly using - // GetCommandDataIBTLVWriter. - bool mRollbackBackupValid = false; - // If mGoneAsync is true, we have finished out initial processing of the - // incoming invoke. After this point, our session could go away at any - // time. - bool mGoneAsync = false; + virtual void DecrementHoldOff(Handle * apHandle) {} }; } // namespace app diff --git a/src/app/CommandHandlerImpl.cpp b/src/app/CommandHandlerImpl.cpp new file mode 100644 index 00000000000000..f32d6bebd49455 --- /dev/null +++ b/src/app/CommandHandlerImpl.cpp @@ -0,0 +1,1057 @@ +/* + * + * 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. + */ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +using Status = Protocols::InteractionModel::Status; + +CommandHandlerImpl::CommandHandlerImpl(Callback * apCallback) : mpCallback(apCallback), mSuppressResponse(false) {} + +CommandHandlerImpl::CommandHandlerImpl(TestOnlyOverrides & aTestOverride, Callback * apCallback) : CommandHandlerImpl(apCallback) +{ + if (aTestOverride.commandPathRegistry) + { + mMaxPathsPerInvoke = aTestOverride.commandPathRegistry->MaxSize(); + mCommandPathRegistry = aTestOverride.commandPathRegistry; + } + if (aTestOverride.commandResponder) + { + SetExchangeInterface(aTestOverride.commandResponder); + } +} + +CommandHandlerImpl::~CommandHandlerImpl() +{ + InvalidateHandles(); +} + +CHIP_ERROR CommandHandlerImpl::AllocateBuffer() +{ + // We should only allocate a buffer if we will be sending out a response. + VerifyOrReturnError(ResponsesAccepted(), CHIP_ERROR_INCORRECT_STATE); + + if (!mBufferAllocated) + { + mCommandMessageWriter.Reset(); + + System::PacketBufferHandle commandPacket = System::PacketBufferHandle::New(chip::app::kMaxSecureSduLengthBytes); + VerifyOrReturnError(!commandPacket.IsNull(), CHIP_ERROR_NO_MEMORY); + + mCommandMessageWriter.Init(std::move(commandPacket)); + ReturnErrorOnFailure(mInvokeResponseBuilder.InitWithEndBufferReserved(&mCommandMessageWriter)); + + if (mReserveSpaceForMoreChunkMessages) + { + ReturnErrorOnFailure(mInvokeResponseBuilder.ReserveSpaceForMoreChunkedMessages()); + } + + // Sending an InvokeResponse to an InvokeResponse is going to be removed from the spec soon. + // It was never implemented in the SDK, and there are no command responses that expect a + // command response. This means we will never receive an InvokeResponse Message in response + // to an InvokeResponse Message that we are sending. This means that the only response + // we are expecting to receive in response to an InvokeResponse Message that we are + // sending-out is a status when we are chunking multiple responses. As a result, to satisfy the + // condition that we don't set SuppressResponse to true while also setting + // MoreChunkedMessages to true, we are hardcoding the value to false here. + mInvokeResponseBuilder.SuppressResponse(/* aSuppressResponse = */ false); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); + + mInvokeResponseBuilder.CreateInvokeResponses(/* aReserveEndBuffer = */ true); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); + + mBufferAllocated = true; + MoveToState(State::NewResponseMessage); + } + + return CHIP_NO_ERROR; +} + +Status CommandHandlerImpl::OnInvokeCommandRequest(CommandHandlerExchangeInterface & commandResponder, + System::PacketBufferHandle && payload, bool isTimedInvoke) +{ + VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "state should be Idle"); + + SetExchangeInterface(&commandResponder); + + // Using RAII here: if this is the only handle remaining, DecrementHoldOff will + // call the CommandHandlerImpl::OnDone callback when this function returns. + Handle workHandle(this); + + Status status = ProcessInvokeRequest(std::move(payload), isTimedInvoke); + mGoneAsync = true; + return status; +} + +CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) +{ + ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId, + aResponseCommandId }; + + InvokeResponseParameters prepareParams(aRequestCommandPath); + prepareParams.SetStartOrEndDataStruct(false); + + { + ScopedChange internalCallToAddResponse(mInternalCallToAddResponseData, true); + ReturnErrorOnFailure(PrepareInvokeResponseCommand(responseCommandPath, prepareParams)); + } + + TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); + VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(aEncodable.EncodeTo(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields))); + return FinishCommand(/* aEndDataStruct = */ false); +} + +CHIP_ERROR CommandHandlerImpl::AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) +{ + // Return early when response should not be sent out. + VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); + return TryAddingResponse( + [&]() -> CHIP_ERROR { return TryAddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); }); +} + +CHIP_ERROR CommandHandlerImpl::ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + size_t commandCount = 0; + bool commandRefExpected = false; + InvokeRequests::Parser invokeRequests; + + ReturnErrorOnFailure(invokeRequestMessage.GetInvokeRequests(&invokeRequests)); + TLV::TLVReader invokeRequestsReader; + invokeRequests.GetReader(&invokeRequestsReader); + + ReturnErrorOnFailure(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */)); + + // If this is a GroupRequest the only thing to check is that there is only one + // CommandDataIB. + if (IsGroupRequest()) + { + VerifyOrReturnError(commandCount == 1, CHIP_ERROR_INVALID_ARGUMENT); + return CHIP_NO_ERROR; + } + // While technically any commandCount == 1 should already be unique and does not need + // any further validation, we do need to read and populate the registry to help + // in building the InvokeResponse. + + VerifyOrReturnError(commandCount <= MaxPathsPerInvoke(), CHIP_ERROR_INVALID_ARGUMENT); + + // If there is more than one CommandDataIB, spec states that CommandRef must be provided. + commandRefExpected = commandCount > 1; + + while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) + { + VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), CHIP_ERROR_INVALID_ARGUMENT); + CommandDataIB::Parser commandData; + ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); + + // First validate that we can get a ConcreteCommandPath. + CommandPathIB::Parser commandPath; + ConcreteCommandPath concretePath(0, 0, 0); + ReturnErrorOnFailure(commandData.GetPath(&commandPath)); + ReturnErrorOnFailure(commandPath.GetConcreteCommandPath(concretePath)); + + // Grab the CommandRef if there is one, and validate that it's there when it + // has to be. + std::optional commandRef; + uint16_t ref; + err = commandData.GetRef(&ref); + VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_END_OF_TLV, err); + if (err == CHIP_END_OF_TLV && commandRefExpected) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + if (err == CHIP_NO_ERROR) + { + commandRef.emplace(ref); + } + + // Adding can fail if concretePath is not unique, or if commandRef is a value + // and is not unique, or if we have already added more paths than we support. + ReturnErrorOnFailure(GetCommandPathRegistry().Add(concretePath, commandRef)); + } + + // It's OK/expected to have reached the end of the container without failure. + if (CHIP_END_OF_TLV == err) + { + err = CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + return invokeRequestMessage.ExitContainer(); +} + +Status CommandHandlerImpl::ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + System::PacketBufferTLVReader reader; + InvokeRequestMessage::Parser invokeRequestMessage; + InvokeRequests::Parser invokeRequests; + reader.Init(std::move(payload)); + VerifyOrReturnError(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, Status::InvalidAction); +#if CHIP_CONFIG_IM_PRETTY_PRINT + invokeRequestMessage.PrettyPrint(); +#endif + VerifyOrDie(mpResponder); + if (mpResponder->GetGroupId().HasValue()) + { + SetGroupRequest(true); + } + + // When updating this code, please remember to make corresponding changes to TestOnlyInvokeCommandRequestWithFaultsInjected. + VerifyOrReturnError(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, Status::InvalidAction); + VerifyOrReturnError(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, Status::InvalidAction); + VerifyOrReturnError(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, Status::InvalidAction); + VerifyOrReturnError(mTimedRequest == isTimedInvoke, Status::TimedRequestMismatch); + + { + InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; + VerifyOrReturnError(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, + Status::InvalidAction); + } + + TLV::TLVReader invokeRequestsReader; + invokeRequests.GetReader(&invokeRequestsReader); + + size_t commandCount = 0; + VerifyOrReturnError(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, + Status::InvalidAction); + if (commandCount > 1) + { + mReserveSpaceForMoreChunkMessages = true; + } + + while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) + { + VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), Status::InvalidAction); + CommandDataIB::Parser commandData; + VerifyOrReturnError(commandData.Init(invokeRequestsReader) == CHIP_NO_ERROR, Status::InvalidAction); + Status status = Status::Success; + if (IsGroupRequest()) + { + status = ProcessGroupCommandDataIB(commandData); + } + else + { + status = ProcessCommandDataIB(commandData); + } + if (status != Status::Success) + { + return status; + } + } + + // if we have exhausted this container + if (CHIP_END_OF_TLV == err) + { + err = CHIP_NO_ERROR; + } + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + VerifyOrReturnError(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, Status::InvalidAction); + return Status::Success; +} + +void CommandHandlerImpl::Close() +{ + mSuppressResponse = false; + mpResponder = nullptr; + MoveToState(State::AwaitingDestruction); + + // We must finish all async work before we can shut down a CommandHandlerImpl. The actual CommandHandlerImpl MUST finish their + // work in reasonable time or there is a bug. The only case for releasing CommandHandlerImpl without CommandHandler::Handle + // releasing its reference is the stack shutting down, in which case Close() is not called. So the below check should always + // pass. + VerifyOrDieWithMsg(mPendingWork == 0, DataManagement, "CommandHandlerImpl::Close() called with %u unfinished async work items", + static_cast(mPendingWork)); + InvalidateHandles(); + + if (mpCallback) + { + mpCallback->OnDone(*this); + } +} + +void CommandHandlerImpl::AddToHandleList(Handle * apHandle) +{ + mpHandleList.PushBack(apHandle); +} + +void CommandHandlerImpl::RemoveFromHandleList(Handle * apHandle) +{ + VerifyOrDie(mpHandleList.Contains(apHandle)); + mpHandleList.Remove(apHandle); +} + +void CommandHandlerImpl::InvalidateHandles() +{ + for (auto handle = mpHandleList.begin(); handle != mpHandleList.end(); ++handle) + { + handle->Invalidate(); + } +} + +void CommandHandlerImpl::IncrementHoldOff(Handle * apHandle) +{ + mPendingWork++; + AddToHandleList(apHandle); +} + +void CommandHandlerImpl::DecrementHoldOff(Handle * apHandle) +{ + + mPendingWork--; + ChipLogDetail(DataManagement, "Decreasing reference count for CommandHandlerImpl, remaining %u", + static_cast(mPendingWork)); + + RemoveFromHandleList(apHandle); + + if (mPendingWork != 0) + { + return; + } + + if (mpResponder == nullptr) + { + ChipLogProgress(DataManagement, "Skipping command response: response sender is null"); + } + else if (!IsGroupRequest()) + { + CHIP_ERROR err = FinalizeLastInvokeResponseMessage(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DataManagement, "Failed to finalize command response: %" CHIP_ERROR_FORMAT, err.Format()); + } + } + + Close(); +} + +namespace { +// We use this when the sender did not actually provide a CommandFields struct, +// to avoid downstream consumers having to worry about cases when there is or is +// not a struct available. We use an empty struct with anonymous tag, since we +// can't use a context tag at top level, and consumers should not care about the +// tag here). +constexpr uint8_t sNoFields[] = { + CHIP_TLV_STRUCTURE(CHIP_TLV_TAG_ANONYMOUS), + CHIP_TLV_END_OF_CONTAINER, +}; +} // anonymous namespace + +Status CommandHandlerImpl::ProcessCommandDataIB(CommandDataIB::Parser & aCommandElement) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + CommandPathIB::Parser commandPath; + ConcreteCommandPath concretePath(0, 0, 0); + TLV::TLVReader commandDataReader; + + // NOTE: errors may occur before the concrete command path is even fully decoded. + + err = aCommandElement.GetPath(&commandPath); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + + err = commandPath.GetConcreteCommandPath(concretePath); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + + { + Status commandExists = mpCallback->CommandExists(concretePath); + if (commandExists != Status::Success) + { + ChipLogDetail(DataManagement, "No command " ChipLogFormatMEI " in Cluster " ChipLogFormatMEI " on Endpoint 0x%x", + ChipLogValueMEI(concretePath.mCommandId), ChipLogValueMEI(concretePath.mClusterId), + concretePath.mEndpointId); + return FallibleAddStatus(concretePath, commandExists) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + } + + { + Access::SubjectDescriptor subjectDescriptor = GetSubjectDescriptor(); + Access::RequestPath requestPath{ .cluster = concretePath.mClusterId, .endpoint = concretePath.mEndpointId }; + Access::Privilege requestPrivilege = RequiredPrivilege::ForInvokeCommand(concretePath); + err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege); + if (err != CHIP_NO_ERROR) + { + if (err != CHIP_ERROR_ACCESS_DENIED) + { + return FallibleAddStatus(concretePath, Status::Failure) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + // TODO: when wildcard invokes are supported, handle them to discard rather than fail with status + return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + } + + if (CommandNeedsTimedInvoke(concretePath.mClusterId, concretePath.mCommandId) && !IsTimedInvoke()) + { + // TODO: when wildcard invokes are supported, discard a + // wildcard-expanded path instead of returning a status. + return FallibleAddStatus(concretePath, Status::NeedsTimedInteraction) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + + if (CommandIsFabricScoped(concretePath.mClusterId, concretePath.mCommandId)) + { + // SPEC: Else if the command in the path is fabric-scoped and there is no accessing fabric, + // a CommandStatusIB SHALL be generated with the UNSUPPORTED_ACCESS Status Code. + + // Fabric-scoped commands are not allowed before a specific accessing fabric is available. + // This is mostly just during a PASE session before AddNOC. + if (GetAccessingFabricIndex() == kUndefinedFabricIndex) + { + // TODO: when wildcard invokes are supported, discard a + // wildcard-expanded path instead of returning a status. + return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + } + + err = aCommandElement.GetFields(&commandDataReader); + if (CHIP_END_OF_TLV == err) + { + ChipLogDetail(DataManagement, + "Received command without data for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId)); + commandDataReader.Init(sNoFields); + err = commandDataReader.Next(); + } + if (CHIP_NO_ERROR == err) + { + ChipLogDetail(DataManagement, "Received command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId)); + SuccessOrExit(err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())); + mpCallback->DispatchCommand(*this, concretePath, commandDataReader); + DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor()); + } + +exit: + if (err != CHIP_NO_ERROR) + { + return FallibleAddStatus(concretePath, Status::InvalidCommand) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + + // We have handled the error status above and put the error status in response, now return success status so we can process + // other commands in the invoke request. + return Status::Success; +} + +Status CommandHandlerImpl::ProcessGroupCommandDataIB(CommandDataIB::Parser & aCommandElement) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + CommandPathIB::Parser commandPath; + TLV::TLVReader commandDataReader; + ClusterId clusterId; + CommandId commandId; + GroupId groupId; + FabricIndex fabric; + + Credentials::GroupDataProvider::GroupEndpoint mapping; + Credentials::GroupDataProvider * groupDataProvider = Credentials::GetGroupDataProvider(); + Credentials::GroupDataProvider::EndpointIterator * iterator; + + err = aCommandElement.GetPath(&commandPath); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + + err = commandPath.GetGroupCommandPath(&clusterId, &commandId); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + + VerifyOrDie(mpResponder); + // The optionalGroupId must have a value, otherwise we wouldn't have reached this code path. + groupId = mpResponder->GetGroupId().Value(); + fabric = GetAccessingFabricIndex(); + + ChipLogDetail(DataManagement, "Received group command for Group=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + groupId, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); + + err = aCommandElement.GetFields(&commandDataReader); + if (CHIP_END_OF_TLV == err) + { + ChipLogDetail(DataManagement, + "Received command without data for Group=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, groupId, + ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); + commandDataReader.Init(sNoFields); + err = commandDataReader.Next(); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + } + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::Failure); + + // Per spec, we do the "is this a timed command?" check for every path, but + // since all paths that fail it just get silently discarded we can do it + // once up front and discard all the paths at once. Ordering with respect + // to ACL and command presence checks does not matter, because the behavior + // is the same for all of them: ignore the path. + if (CommandNeedsTimedInvoke(clusterId, commandId)) + { + // Group commands are never timed. + return Status::Success; + } + + // No check for `CommandIsFabricScoped` unlike in `ProcessCommandDataIB()` since group commands + // always have an accessing fabric, by definition. + + // Find which endpoints can process the command, and dispatch to them. + iterator = groupDataProvider->IterateEndpoints(fabric); + VerifyOrReturnError(iterator != nullptr, Status::Failure); + + while (iterator->Next(mapping)) + { + if (groupId != mapping.group_id) + { + continue; + } + + ChipLogDetail(DataManagement, + "Processing group command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + mapping.endpoint_id, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); + + const ConcreteCommandPath concretePath(mapping.endpoint_id, clusterId, commandId); + + if (mpCallback->CommandExists(concretePath) != Status::Success) + { + ChipLogDetail(DataManagement, "No command " ChipLogFormatMEI " in Cluster " ChipLogFormatMEI " on Endpoint 0x%x", + ChipLogValueMEI(commandId), ChipLogValueMEI(clusterId), mapping.endpoint_id); + + continue; + } + + { + Access::SubjectDescriptor subjectDescriptor = GetSubjectDescriptor(); + Access::RequestPath requestPath{ .cluster = concretePath.mClusterId, .endpoint = concretePath.mEndpointId }; + Access::Privilege requestPrivilege = RequiredPrivilege::ForInvokeCommand(concretePath); + err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege); + if (err != CHIP_NO_ERROR) + { + // NOTE: an expected error is CHIP_ERROR_ACCESS_DENIED, but there could be other unexpected errors; + // therefore, keep processing subsequent commands, and if any errors continue, those subsequent + // commands will likewise fail. + continue; + } + } + if ((err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())) == CHIP_NO_ERROR) + { + TLV::TLVReader dataReader(commandDataReader); + mpCallback->DispatchCommand(*this, concretePath, dataReader); + DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor()); + } + else + { + ChipLogError(DataManagement, + "Error when calling PreCommandReceived for Endpoint=%u Cluster=" ChipLogFormatMEI + " Command=" ChipLogFormatMEI " : %" CHIP_ERROR_FORMAT, + mapping.endpoint_id, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId), err.Format()); + continue; + } + } + iterator->Release(); + return Status::Success; +} + +CHIP_ERROR CommandHandlerImpl::TryAddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus) +{ + // Return early when response should not be sent out. + VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); + + ReturnErrorOnFailure(PrepareStatus(aCommandPath)); + CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); + StatusIB::Builder & statusIBBuilder = commandStatus.CreateErrorStatus(); + ReturnErrorOnFailure(commandStatus.GetError()); + statusIBBuilder.EncodeStatusIB(aStatus); + ReturnErrorOnFailure(statusIBBuilder.GetError()); + return FinishStatus(); +} + +CHIP_ERROR CommandHandlerImpl::AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus) +{ + return TryAddingResponse([&]() -> CHIP_ERROR { return TryAddStatusInternal(aCommandPath, aStatus); }); +} + +void CommandHandlerImpl::AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, + const char * context) +{ + + CHIP_ERROR error = FallibleAddStatus(aCommandPath, aStatus, context); + + if (error != CHIP_NO_ERROR) + { + ChipLogError(DataManagement, "Failed to add command status: %" CHIP_ERROR_FORMAT, error.Format()); + // TODO(#30453) we could call mpResponder->ResponseDropped() if err == CHIP_ERROR_NO_MEMORY. This should + // be done as a follow up so that change can be evaluated as a standalone PR. + + // Do not crash if the status has not been added due to running out of packet buffers or other resources. + // It is better to drop a single response than to go offline and lose all sessions and subscriptions. + VerifyOrDie(error == CHIP_ERROR_NO_MEMORY); + } +} + +CHIP_ERROR CommandHandlerImpl::FallibleAddStatus(const ConcreteCommandPath & path, const Protocols::InteractionModel::Status status, + const char * context) +{ + if (status != Status::Success) + { + if (context == nullptr) + { + context = "no additional context"; + } + + ChipLogError(DataManagement, + "Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI " status " ChipLogFormatIMStatus " (%s)", + path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mCommandId), + ChipLogValueIMStatus(status), context); + } + + return AddStatusInternal(path, StatusIB(status)); +} + +CHIP_ERROR CommandHandlerImpl::AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) +{ + return AddStatusInternal(aCommandPath, StatusIB(Status::Success, aClusterStatus)); +} + +CHIP_ERROR CommandHandlerImpl::AddClusterSpecificFailure(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) +{ + return AddStatusInternal(aCommandPath, StatusIB(Status::Failure, aClusterStatus)); +} + +CHIP_ERROR CommandHandlerImpl::PrepareInvokeResponseCommand(const ConcreteCommandPath & aResponseCommandPath, + const CommandHandlerImpl::InvokeResponseParameters & aPrepareParameters) +{ + auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aPrepareParameters.mRequestCommandPath); + VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); + + return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aPrepareParameters.mStartOrEndDataStruct); +} + +CHIP_ERROR CommandHandlerImpl::PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, + const ConcreteCommandPath & aCommandPath, bool aStartDataStruct) +{ + // Intentionally omitting the ResponsesAccepted early exit. Direct use of PrepareInvokeResponseCommand + // is discouraged, as it often indicates incorrect usage patterns (see GitHub issue #32486). + // If you're encountering CHIP_ERROR_INCORRECT_STATE, refactoring to use AddResponse is recommended. + ReturnErrorOnFailure(AllocateBuffer()); + + if (!mInternalCallToAddResponseData && mState == State::AddedCommand) + { + // An attempt is being made to add CommandData InvokeResponse using primitive + // CommandHandlerImpl APIs. While not recommended, as this potentially leaves the + // CommandHandlerImpl in an incorrect state upon failure, this approach is permitted + // for legacy reasons. To maximize the likelihood of success, particularly when + // handling large amounts of data, we try to obtain a new, completely empty + // InvokeResponseMessage, as the existing one already has space occupied. + ReturnErrorOnFailure(FinalizeInvokeResponseMessageAndPrepareNext()); + } + + CreateBackupForResponseRollback(); + // + // We must not be in the middle of preparing a command, or having prepared or sent one. + // + VerifyOrReturnError(mState == State::NewResponseMessage || mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + + // TODO(#30453): See if we can pass this back up the stack so caller can provide this instead of taking up + // space in CommandHanlder. + mRefForResponse = apCommandPathRegistryEntry.ref; + + MoveToState(State::Preparing); + InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); + InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); + ReturnErrorOnFailure(invokeResponses.GetError()); + + CommandDataIB::Builder & commandData = invokeResponse.CreateCommand(); + ReturnErrorOnFailure(commandData.GetError()); + CommandPathIB::Builder & path = commandData.CreatePath(); + ReturnErrorOnFailure(commandData.GetError()); + ReturnErrorOnFailure(path.Encode(aCommandPath)); + if (aStartDataStruct) + { + ReturnErrorOnFailure(commandData.GetWriter()->StartContainer(TLV::ContextTag(CommandDataIB::Tag::kFields), + TLV::kTLVType_Structure, mDataElementContainerType)); + } + MoveToState(State::AddingCommand); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommandHandlerImpl::FinishCommand(bool aStartDataStruct) +{ + // Intentionally omitting the ResponsesAccepted early exit. Direct use of FinishCommand + // is discouraged, as it often indicates incorrect usage patterns (see GitHub issue #32486). + // If you're encountering CHIP_ERROR_INCORRECT_STATE, refactoring to use AddResponse is recommended. + VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); + CommandDataIB::Builder & commandData = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand(); + if (aStartDataStruct) + { + ReturnErrorOnFailure(commandData.GetWriter()->EndContainer(mDataElementContainerType)); + } + + if (mRefForResponse.has_value()) + { + ReturnErrorOnFailure(commandData.Ref(*mRefForResponse)); + } + + ReturnErrorOnFailure(commandData.EndOfCommandDataIB()); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB()); + MoveToState(State::AddedCommand); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommandHandlerImpl::PrepareStatus(const ConcreteCommandPath & aCommandPath) +{ + ReturnErrorOnFailure(AllocateBuffer()); + // + // We must not be in the middle of preparing a command, or having prepared or sent one. + // + VerifyOrReturnError(mState == State::NewResponseMessage || mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + if (mState == State::AddedCommand) + { + CreateBackupForResponseRollback(); + } + + auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aCommandPath); + VerifyOrReturnError(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); + mRefForResponse = commandPathRegistryEntry->ref; + + MoveToState(State::Preparing); + InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); + InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); + ReturnErrorOnFailure(invokeResponses.GetError()); + CommandStatusIB::Builder & commandStatus = invokeResponse.CreateStatus(); + ReturnErrorOnFailure(commandStatus.GetError()); + CommandPathIB::Builder & path = commandStatus.CreatePath(); + ReturnErrorOnFailure(commandStatus.GetError()); + ReturnErrorOnFailure(path.Encode(aCommandPath)); + MoveToState(State::AddingCommand); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommandHandlerImpl::FinishStatus() +{ + VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); + + CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); + if (mRefForResponse.has_value()) + { + ReturnErrorOnFailure(commandStatus.Ref(*mRefForResponse)); + } + + ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus().EndOfCommandStatusIB()); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB()); + MoveToState(State::AddedCommand); + return CHIP_NO_ERROR; +} + +void CommandHandlerImpl::CreateBackupForResponseRollback() +{ + VerifyOrReturn(mState == State::NewResponseMessage || mState == State::AddedCommand); + VerifyOrReturn(mInvokeResponseBuilder.GetInvokeResponses().GetError() == CHIP_NO_ERROR); + VerifyOrReturn(mInvokeResponseBuilder.GetError() == CHIP_NO_ERROR); + mInvokeResponseBuilder.Checkpoint(mBackupWriter); + mBackupState = mState; + mRollbackBackupValid = true; +} + +CHIP_ERROR CommandHandlerImpl::RollbackResponse() +{ + VerifyOrReturnError(mRollbackBackupValid, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::Preparing || mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); + ChipLogDetail(DataManagement, "Rolling back response"); + // TODO(#30453): Rollback of mInvokeResponseBuilder should handle resetting + // InvokeResponses. + mInvokeResponseBuilder.GetInvokeResponses().ResetError(); + mInvokeResponseBuilder.Rollback(mBackupWriter); + MoveToState(mBackupState); + mRollbackBackupValid = false; + return CHIP_NO_ERROR; +} + +TLV::TLVWriter * CommandHandlerImpl::GetCommandDataIBTLVWriter() +{ + if (mState != State::AddingCommand) + { + return nullptr; + } + + return mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand().GetWriter(); +} + +FabricIndex CommandHandlerImpl::GetAccessingFabricIndex() const +{ + VerifyOrDie(!mGoneAsync); + VerifyOrDie(mpResponder); + return mpResponder->GetAccessingFabricIndex(); +} + +CHIP_ERROR CommandHandlerImpl::FinalizeInvokeResponseMessageAndPrepareNext() +{ + ReturnErrorOnFailure(FinalizeInvokeResponseMessage(/* aHasMoreChunks = */ true)); + // After successfully finalizing InvokeResponseMessage, no buffer should remain + // allocated. + VerifyOrDie(!mBufferAllocated); + CHIP_ERROR err = AllocateBuffer(); + if (err != CHIP_NO_ERROR) + { + // TODO(#30453): Improve ResponseDropped calls to occur only when dropping is + // definitively guaranteed. + // Response dropping is not yet definitive as a subsequent call + // to AllocateBuffer might succeed. + VerifyOrDie(mpResponder); + mpResponder->ResponseDropped(); + } + return err; +} + +CHIP_ERROR CommandHandlerImpl::FinalizeInvokeResponseMessage(bool aHasMoreChunks) +{ + System::PacketBufferHandle packet; + + VerifyOrReturnError(mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().EndOfInvokeResponses()); + if (aHasMoreChunks) + { + // Unreserving space previously reserved for MoreChunkedMessages is done + // in the call to mInvokeResponseBuilder.MoreChunkedMessages. + mInvokeResponseBuilder.MoreChunkedMessages(aHasMoreChunks); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); + } + ReturnErrorOnFailure(mInvokeResponseBuilder.EndOfInvokeResponseMessage()); + ReturnErrorOnFailure(mCommandMessageWriter.Finalize(&packet)); + VerifyOrDie(mpResponder); + mpResponder->AddInvokeResponseToSend(std::move(packet)); + mBufferAllocated = false; + mRollbackBackupValid = false; + return CHIP_NO_ERROR; +} + +void CommandHandlerImpl::SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder) +{ + VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "CommandResponseSender can only be set in idle state"); + mpResponder = commandResponder; +} + +const char * CommandHandlerImpl::GetStateStr() const +{ +#if CHIP_DETAIL_LOGGING + switch (mState) + { + case State::Idle: + return "Idle"; + + case State::NewResponseMessage: + return "NewResponseMessage"; + + case State::Preparing: + return "Preparing"; + + case State::AddingCommand: + return "AddingCommand"; + + case State::AddedCommand: + return "AddedCommand"; + + case State::DispatchResponses: + return "DispatchResponses"; + + case State::AwaitingDestruction: + return "AwaitingDestruction"; + } +#endif // CHIP_DETAIL_LOGGING + return "N/A"; +} + +void CommandHandlerImpl::MoveToState(const State aTargetState) +{ + mState = aTargetState; + ChipLogDetail(DataManagement, "Command handler moving to [%10.10s]", GetStateStr()); +} + +void CommandHandlerImpl::FlushAcksRightAwayOnSlowCommand() +{ + if (mpResponder) + { + mpResponder->HandlingSlowCommand(); + } +} + +Access::SubjectDescriptor CommandHandlerImpl::GetSubjectDescriptor() const +{ + VerifyOrDie(!mGoneAsync); + VerifyOrDie(mpResponder); + return mpResponder->GetSubjectDescriptor(); +} + +bool CommandHandlerImpl::IsTimedInvoke() const +{ + return mTimedRequest; +} + +void CommandHandlerImpl::AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) +{ + CHIP_ERROR err = AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DataManagement, "Adding response failed: %" CHIP_ERROR_FORMAT ". Returning failure instead.", err.Format()); + AddStatus(aRequestCommandPath, Protocols::InteractionModel::Status::Failure); + } +} + +Messaging::ExchangeContext * CommandHandlerImpl::GetExchangeContext() const +{ + VerifyOrDie(mpResponder); + return mpResponder->GetExchangeContext(); +} + +#if CHIP_WITH_NLFAULTINJECTION + +namespace { + +CHIP_ERROR TestOnlyExtractCommandPathFromNextInvokeRequest(TLV::TLVReader & invokeRequestsReader, + ConcreteCommandPath & concretePath) +{ + ReturnErrorOnFailure(invokeRequestsReader.Next(TLV::AnonymousTag())); + CommandDataIB::Parser commandData; + ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); + CommandPathIB::Parser commandPath; + ReturnErrorOnFailure(commandData.GetPath(&commandPath)); + return commandPath.GetConcreteCommandPath(concretePath); +} + +[[maybe_unused]] const char * GetFaultInjectionTypeStr(CommandHandlerImpl::NlFaultInjectionType faultType) +{ + switch (faultType) + { + case CommandHandlerImpl::NlFaultInjectionType::SeparateResponseMessages: + return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be the same as the " + "original request."; + case CommandHandlerImpl::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder: + return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be reversed from the " + "original request."; + case CommandHandlerImpl::NlFaultInjectionType::SkipSecondResponse: + return "Single InvokeResponseMessages. Dropping response to second request"; + } + ChipLogError(DataManagement, "TH Failure: Unexpected fault type"); + chipAbort(); +} + +} // anonymous namespace + +// This method intentionally duplicates code from other sections. While code consolidation +// is generally preferred, here we prioritize generating a clear crash message to aid in +// troubleshooting test failures. +void CommandHandlerImpl::TestOnlyInvokeCommandRequestWithFaultsInjected(CommandHandlerExchangeInterface & commandResponder, + System::PacketBufferHandle && payload, bool isTimedInvoke, + NlFaultInjectionType faultType) +{ + VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "TH Failure: state should be Idle, issue with TH"); + SetExchangeInterface(&commandResponder); + + ChipLogProgress(DataManagement, "Response to InvokeRequestMessage overridden by fault injection"); + ChipLogProgress(DataManagement, " Injecting the following response:%s", GetFaultInjectionTypeStr(faultType)); + + Handle workHandle(this); + VerifyOrDieWithMsg(!commandResponder.GetGroupId().HasValue(), DataManagement, "DUT Failure: Unexpected Group Command"); + + System::PacketBufferTLVReader reader; + InvokeRequestMessage::Parser invokeRequestMessage; + InvokeRequests::Parser invokeRequests; + reader.Init(std::move(payload)); + VerifyOrDieWithMsg(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Failed 'invokeRequestMessage.Init(reader)'"); +#if CHIP_CONFIG_IM_PRETTY_PRINT + invokeRequestMessage.PrettyPrint(); +#endif + + VerifyOrDieWithMsg(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory SuppressResponse field missing"); + VerifyOrDieWithMsg(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory TimedRequest field missing"); + VerifyOrDieWithMsg(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory InvokeRequests field missing"); + VerifyOrDieWithMsg(mTimedRequest == isTimedInvoke, DataManagement, + "DUT Failure: TimedRequest value in message mismatches action"); + + { + InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; + VerifyOrDieWithMsg(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: InvokeRequestMessage contents were invalid"); + } + + TLV::TLVReader invokeRequestsReader; + invokeRequests.GetReader(&invokeRequestsReader); + + size_t commandCount = 0; + VerifyOrDieWithMsg(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, + DataManagement, + "TH Failure: Failed to get the length of InvokeRequests after InvokeRequestMessage validation"); + + // The command count check (specifically for a count of 2) is tied to IDM_1_3. This may need adjustment for + // compatibility with future test plans. + VerifyOrDieWithMsg(commandCount == 2, DataManagement, "DUT failure: We were strictly expecting exactly 2 InvokeRequests"); + mReserveSpaceForMoreChunkMessages = true; + + { + // Response path is the same as request path since we are replying with a failure message. + ConcreteCommandPath concreteResponsePath1; + ConcreteCommandPath concreteResponsePath2; + VerifyOrDieWithMsg( + TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath1) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the first request"); + VerifyOrDieWithMsg( + TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath2) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the second request"); + + if (faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) + { + ConcreteCommandPath temp(concreteResponsePath1); + concreteResponsePath1 = concreteResponsePath2; + concreteResponsePath2 = temp; + } + + VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath1, Status::Failure) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Error adding the first InvokeResponse"); + if (faultType == NlFaultInjectionType::SeparateResponseMessages || + faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) + { + VerifyOrDieWithMsg(FinalizeInvokeResponseMessageAndPrepareNext() == CHIP_NO_ERROR, DataManagement, + "TH Failure: Failed to create second InvokeResponseMessage"); + } + if (faultType != NlFaultInjectionType::SkipSecondResponse) + { + VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath2, Status::Failure) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Error adding the second InvokeResponse"); + } + } + + VerifyOrDieWithMsg(invokeRequestsReader.Next() == CHIP_END_OF_TLV, DataManagement, + "DUT Failure: Unexpected TLV ending of InvokeRequests"); + VerifyOrDieWithMsg(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, DataManagement, + "DUT Failure: InvokeRequestMessage TLV is not properly terminated"); +} +#endif // CHIP_WITH_NLFAULTINJECTION + +} // namespace app +} // namespace chip diff --git a/src/app/CommandHandlerImpl.h b/src/app/CommandHandlerImpl.h new file mode 100644 index 00000000000000..fd85f35440f7cc --- /dev/null +++ b/src/app/CommandHandlerImpl.h @@ -0,0 +1,476 @@ +/* + * Copyright (c) 2020-2024 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 +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { + +class CommandHandlerImpl : public CommandHandler +{ +public: + class Callback + { + public: + virtual ~Callback() = default; + + /* + * Method that signals to a registered callback that this object + * has completed doing useful work and is now safe for release/destruction. + */ + virtual void OnDone(CommandHandlerImpl & apCommandObj) = 0; + + /* + * Upon processing of a CommandDataIB, this method is invoked to dispatch the command + * to the right server-side handler provided by the application. + */ + virtual void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, + TLV::TLVReader & apPayload) = 0; + + /* + * Check to see if a command implementation exists for a specific + * concrete command path. If it does, Success will be returned. If + * not, one of UnsupportedEndpoint, UnsupportedCluster, or + * UnsupportedCommand will be returned, depending on how the command + * fails to exist. + */ + virtual Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) = 0; + }; + + struct InvokeResponseParameters + { + InvokeResponseParameters(const ConcreteCommandPath & aRequestCommandPath) : mRequestCommandPath(aRequestCommandPath) {} + + InvokeResponseParameters & SetStartOrEndDataStruct(bool aStartOrEndDataStruct) + { + mStartOrEndDataStruct = aStartOrEndDataStruct; + return *this; + } + + ConcreteCommandPath mRequestCommandPath; + /** + * Whether the method this is being provided to should start/end the TLV container for the CommandFields element + * within CommandDataIB. + */ + bool mStartOrEndDataStruct = true; + }; + + struct TestOnlyOverrides + { + public: + CommandPathRegistry * commandPathRegistry = nullptr; + CommandHandlerExchangeInterface * commandResponder = nullptr; + }; + + /* + * The callback passed in has to outlive this CommandHandler object. + */ + CommandHandlerImpl(Callback * apCallback); + + /* + * The destructor will also invalidate all Handles created for this CommandHandlerImpl. + */ + virtual ~CommandHandlerImpl(); + + /* + * Constructor to override the number of supported paths per invoke and command responder. + * + * The callback and any pointers passed via TestOnlyOverrides must outlive this + * CommandHandlerImpl object. + * + * For testing purposes. + */ + CommandHandlerImpl(TestOnlyOverrides & aTestOverride, Callback * apCallback); + + /**************** CommandHandler interface implementation ***********************/ + + using CommandHandler::AddResponseData; + + void FlushAcksRightAwayOnSlowCommand() override; + + CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aRequestCommandPath, const Protocols::InteractionModel::Status aStatus, + const char * context = nullptr) override; + void AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, + const char * context = nullptr) override; + CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) override; + CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) override; + + CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) override; + void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) override; + + Access::SubjectDescriptor GetSubjectDescriptor() const override; + FabricIndex GetAccessingFabricIndex() const override; + bool IsTimedInvoke() const override; + Messaging::ExchangeContext * GetExchangeContext() const override; + + /**************** Implementation-specific logic ***********************/ + + /* + * Main entrypoint for this class to handle an InvokeRequestMessage. + * + * This function MAY call the registered OnDone callback before returning. + * To prevent immediate OnDone invocation, callers can wrap their CommandHandlerImpl instance + * within a CommandHandler::Handle. + * + * isTimedInvoke is true if and only if this is part of a Timed Invoke + * transaction (i.e. was preceded by a Timed Request). If we reach here, + * the timer verification has already been done. + * + * commandResponder handles sending InvokeResponses, added by clusters, to the client. The + * command responder object must outlive this CommandHandler object. It is only safe to + * release after the caller of OnInvokeCommandRequest receives the OnDone callback. + */ + Protocols::InteractionModel::Status OnInvokeCommandRequest(CommandHandlerExchangeInterface & commandResponder, + System::PacketBufferHandle && payload, bool isTimedInvoke); + + /** + * Checks that all CommandDataIB within InvokeRequests satisfy the spec's general + * constraints for CommandDataIB. Additionally checks that InvokeRequestMessage is + * properly formatted. + * + * This also builds a registry to ensure that all commands can be responded + * to with the data required as per spec. + */ + CHIP_ERROR ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage); + + /** + * This adds a new CommandDataIB element into InvokeResponses for the associated + * aRequestCommandPath. This adds up until the `CommandFields` element within + * `CommandDataIB`. + * + * This call will fail if CommandHandler is already in the middle of building a + * CommandStatusIB or CommandDataIB (i.e. something has called Prepare*, without + * calling Finish*), or is already sending InvokeResponseMessage. + * + * Upon success, the caller is expected to call `FinishCommand` once they have added + * all the fields into the CommandFields element of CommandDataIB. + * + * @param [in] aResponseCommandPath the concrete response path that we are sending to Requester. + * @param [in] aPrepareParameters struct containing paramters needs for preparing a command. Data + * such as request path, and whether this method should start the CommandFields element within + * CommandDataIB. + */ + CHIP_ERROR PrepareInvokeResponseCommand(const ConcreteCommandPath & aResponseCommandPath, + const InvokeResponseParameters & aPrepareParameters); + + /** + * Finishes the CommandDataIB element within the InvokeResponses. + * + * Caller must have first successfully called `PrepareInvokeResponseCommand`. + * + * @param [in] aEndDataStruct end the TLV container for the CommandFields element within + * CommandDataIB. This should match the boolean passed into Prepare*. + * + * @return CHIP_ERROR_INCORRECT_STATE + * If device has not previously successfully called + * `PrepareInvokeResponseCommand`. + * @return CHIP_ERROR_BUFFER_TOO_SMALL + * If writing the values needed to finish the InvokeReponseIB + * with the current contents of the InvokeResponseMessage + * would exceed the limit. When this error occurs, it is possible + * we have already closed some of the IB Builders that were + * previously started in `PrepareInvokeResponseCommand`. + * @return CHIP_ERROR_NO_MEMORY + * If TLVWriter attempted to allocate an output buffer failed due to + * lack of memory. + * @return other Other TLVWriter related errors. Typically occurs if + * `GetCommandDataIBTLVWriter()` was called and used incorrectly. + */ + // TODO(#30453): We should be able to eliminate the chances of OOM issues with reserve. + // This will be completed in a follow up PR. + CHIP_ERROR FinishCommand(bool aEndDataStruct = true); + + TLV::TLVWriter * GetCommandDataIBTLVWriter(); + +#if CHIP_WITH_NLFAULTINJECTION + + enum class NlFaultInjectionType : uint8_t + { + SeparateResponseMessages, + SeparateResponseMessagesAndInvertedResponseOrder, + SkipSecondResponse + }; + + /** + * @brief Sends InvokeResponseMessages with injected faults for certification testing. + * + * The Test Harness (TH) uses this to simulate various server response behaviors, + * ensuring the Device Under Test (DUT) handles responses per specification. + * + * This function strictly validates the DUT's InvokeRequestMessage against the test plan. + * If deviations occur, the TH terminates with a detailed error message. + * + * @param commandResponder commandResponder that will send the InvokeResponseMessages to the client. + * @param payload Payload of the incoming InvokeRequestMessage from the client. + * @param isTimedInvoke Indicates whether the interaction is timed. + * @param faultType The specific type of fault to inject into the response. + */ + // TODO(#30453): After refactoring CommandHandler for better unit testability, create a + // unit test specifically for the fault injection behavior. + void TestOnlyInvokeCommandRequestWithFaultsInjected(CommandHandlerExchangeInterface & commandResponder, + System::PacketBufferHandle && payload, bool isTimedInvoke, + NlFaultInjectionType faultType); +#endif // CHIP_WITH_NLFAULTINJECTION + +protected: + // Lifetime management for CommandHandler::Handle + + void IncrementHoldOff(Handle * apHandle) override; + void DecrementHoldOff(Handle * apHandle) override; + +private: + friend class TestCommandInteraction; + friend class CommandHandler::Handle; + + enum class State : uint8_t + { + Idle, ///< Default state that the object starts out in, where no work has commenced + NewResponseMessage, ///< mInvokeResponseBuilder is ready, with no responses added. + Preparing, ///< We are prepaing the command or status header. + AddingCommand, ///< In the process of adding a command. + AddedCommand, ///< A command has been completely encoded and is awaiting transmission. + DispatchResponses, ///< The command response(s) are being dispatched. + AwaitingDestruction, ///< The object has completed its work and is awaiting destruction by the application. + }; + + /** + * @brief Best effort to add InvokeResponse to InvokeResponseMessage. + * + * Tries to add response using lambda. Upon failure to add response, attempts + * to rollback the InvokeResponseMessage to a known good state. If failure is due + * to insufficient space in the current InvokeResponseMessage: + * - Finalizes the current InvokeResponseMessage. + * - Allocates a new InvokeResponseMessage. + * - Reattempts to add the InvokeResponse to the new InvokeResponseMessage. + * + * @param [in] addResponseFunction A lambda function responsible for adding the + * response to the current InvokeResponseMessage. + */ + template + CHIP_ERROR TryAddingResponse(Function && addResponseFunction) + { + // Invalidate any existing rollback backups. The addResponseFunction is + // expected to create a new backup during either PrepareInvokeResponseCommand + // or PrepareStatus execution. Direct invocation of + // CreateBackupForResponseRollback is avoided since the buffer used by + // InvokeResponseMessage might not be allocated until a Prepare* function + // is called. + mRollbackBackupValid = false; + CHIP_ERROR err = addResponseFunction(); + if (err == CHIP_NO_ERROR) + { + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(RollbackResponse()); + // If we failed to add a command due to lack of space in the + // packet, we will make another attempt to add the response using + // an additional InvokeResponseMessage. + if (mState != State::AddedCommand || err != CHIP_ERROR_NO_MEMORY) + { + return err; + } + ReturnErrorOnFailure(FinalizeInvokeResponseMessageAndPrepareNext()); + err = addResponseFunction(); + if (err != CHIP_NO_ERROR) + { + // The return value of RollbackResponse is ignored, as we prioritize + // conveying the error generated by addResponseFunction to the + // caller. + RollbackResponse(); + } + return err; + } + + void MoveToState(const State aTargetState); + const char * GetStateStr() const; + + /** + * Create a backup to enable rolling back to the state prior to ResponseData encoding in the event of failure. + */ + void CreateBackupForResponseRollback(); + + /** + * Rollback the state to before encoding the current ResponseData (before calling PrepareInvokeResponseCommand / PrepareStatus) + * + * Requires CreateBackupForResponseRollback to be called at the start of PrepareInvokeResponseCommand / PrepareStatus + */ + CHIP_ERROR RollbackResponse(); + + /* + * This forcibly closes the exchange context if a valid one is pointed to. Such a situation does + * not arise during normal message processing flows that all normally call Close() above. This can only + * arise due to application-initiated destruction of the object when this object is handling receiving/sending + * message payloads. + */ + void Abort(); + + /* + * Allocates a packet buffer used for encoding an invoke response payload. + * + * This can be called multiple times safely, as it will only allocate the buffer once for the lifetime + * of this object. + */ + CHIP_ERROR AllocateBuffer(); + + /** + * This will add a new CommandStatusIB element into InvokeResponses. It will put the + * aCommandPath into the CommandPath element within CommandStatusIB. + * + * This call will fail if CommandHandler is already in the middle of building a + * CommandStatusIB or CommandDataIB (i.e. something has called Prepare*, without + * calling Finish*), or is already sending InvokeResponseMessage. + * + * Upon success, the caller is expected to call `FinishStatus` once they have encoded + * StatusIB. + * + * @param [in] aCommandPath the concrete path of the command we are responding to. + */ + CHIP_ERROR PrepareStatus(const ConcreteCommandPath & aCommandPath); + + /** + * Finishes the CommandStatusIB element within the InvokeResponses. + * + * Caller must have first successfully called `PrepareStatus`. + */ + CHIP_ERROR FinishStatus(); + + CHIP_ERROR PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, + const ConcreteCommandPath & aCommandPath, bool aStartDataStruct); + + CHIP_ERROR FinalizeLastInvokeResponseMessage() { return FinalizeInvokeResponseMessage(/* aHasMoreChunks = */ false); } + + CHIP_ERROR FinalizeInvokeResponseMessageAndPrepareNext(); + + CHIP_ERROR FinalizeInvokeResponseMessage(bool aHasMoreChunks); + + Protocols::InteractionModel::Status ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke); + + /** + * Called internally to signal the completion of all work on this object, gracefully close the + * exchange (by calling into the base class) and finally, signal to a registerd callback that it's + * safe to release this object. + */ + void Close(); + + /** + * ProcessCommandDataIB is only called when a unicast invoke command request is received + * It requires the endpointId in its command path to be able to dispatch the command + */ + Protocols::InteractionModel::Status ProcessCommandDataIB(CommandDataIB::Parser & aCommandElement); + + /** + * ProcessGroupCommandDataIB is only called when a group invoke command request is received + * It doesn't need the endpointId in it's command path since it uses the GroupId in message metadata to find it + */ + Protocols::InteractionModel::Status ProcessGroupCommandDataIB(CommandDataIB::Parser & aCommandElement); + + CHIP_ERROR TryAddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); + + CHIP_ERROR AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); + + /** + * If this function fails, it may leave our TLV buffer in an inconsistent state. + * Callers should snapshot as needed before calling this function, and roll back + * as needed afterward. + * + * @param [in] aRequestCommandPath the concrete path of the command we are responding to + * @param [in] aResponseCommandId the id of the command to encode + * @param [in] aEncodable the data to encode for the given aResponseCommandId + */ + CHIP_ERROR TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable); + + void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder); + + /** + * Check whether the InvokeRequest we are handling is targeted to a group. + */ + bool IsGroupRequest() { return mGroupRequest; } + + bool ResponsesAccepted() { return !(mGroupRequest || mpResponder == nullptr); } + + /** + * Sets the state flag to keep the information that request we are handling is targeted to a group. + */ + void SetGroupRequest(bool isGroupRequest) { mGroupRequest = isGroupRequest; } + + CommandPathRegistry & GetCommandPathRegistry() const { return *mCommandPathRegistry; } + + size_t MaxPathsPerInvoke() const { return mMaxPathsPerInvoke; } + + void AddToHandleList(Handle * handle); + + void RemoveFromHandleList(Handle * handle); + + void InvalidateHandles(); + + bool TestOnlyIsInIdleState() const { return mState == State::Idle; } + + Callback * mpCallback = nullptr; + InvokeResponseMessage::Builder mInvokeResponseBuilder; + TLV::TLVType mDataElementContainerType = TLV::kTLVType_NotSpecified; + size_t mPendingWork = 0; + /* List to store all currently-outstanding Handles for this Command Handler.*/ + IntrusiveList mpHandleList; + + chip::System::PacketBufferTLVWriter mCommandMessageWriter; + TLV::TLVWriter mBackupWriter; + size_t mMaxPathsPerInvoke = CHIP_CONFIG_MAX_PATHS_PER_INVOKE; + // TODO(#30453): See if we can reduce this size for the default cases + // TODO Allow flexibility in registration. + BasicCommandPathRegistry mBasicCommandPathRegistry; + CommandPathRegistry * mCommandPathRegistry = &mBasicCommandPathRegistry; + std::optional mRefForResponse; + + CommandHandlerExchangeInterface * mpResponder = nullptr; + + State mState = State::Idle; + State mBackupState; + ScopedChangeOnly mInternalCallToAddResponseData{ false }; + bool mSuppressResponse = false; + bool mTimedRequest = false; + bool mGroupRequest = false; + bool mBufferAllocated = false; + bool mReserveSpaceForMoreChunkMessages = false; + // TODO(#32486): We should introduce breaking change where calls to add CommandData + // need to use AddResponse, and not CommandHandler primitives directly using + // GetCommandDataIBTLVWriter. + bool mRollbackBackupValid = false; + // If mGoneAsync is true, we have finished out initial processing of the + // incoming invoke. After this point, our session could go away at any + // time. + bool mGoneAsync = false; +}; +} // namespace app +} // namespace chip diff --git a/src/app/CommandResponseSender.cpp b/src/app/CommandResponseSender.cpp index d7f40caa476c8e..430fa5f0fa523b 100644 --- a/src/app/CommandResponseSender.cpp +++ b/src/app/CommandResponseSender.cpp @@ -113,7 +113,7 @@ void CommandResponseSender::StartSendingCommandResponses() } } -void CommandResponseSender::OnDone(CommandHandler & apCommandObj) +void CommandResponseSender::OnDone(CommandHandlerImpl & apCommandObj) { if (mState == State::ErrorSentDelayCloseUntilOnDone) { @@ -125,7 +125,7 @@ void CommandResponseSender::OnDone(CommandHandler & apCommandObj) StartSendingCommandResponses(); } -void CommandResponseSender::DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, +void CommandResponseSender::DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) { VerifyOrReturn(mpCommandHandlerCallback); @@ -231,7 +231,7 @@ void CommandResponseSender::OnInvokeCommandRequest(Messaging::ExchangeContext * void CommandResponseSender::TestOnlyInvokeCommandRequestWithFaultsInjected(Messaging::ExchangeContext * ec, System::PacketBufferHandle && payload, bool isTimedInvoke, - CommandHandler::NlFaultInjectionType faultType) + CommandHandlerImpl::NlFaultInjectionType faultType) { VerifyOrDieWithMsg(ec != nullptr, DataManagement, "TH Failure: Incoming exchange context should not be null"); VerifyOrDieWithMsg(mState == State::ReadyForInvokeResponses, DataManagement, diff --git a/src/app/CommandResponseSender.h b/src/app/CommandResponseSender.h index a89970ddec6c92..1925f01b54bf8c 100644 --- a/src/app/CommandResponseSender.h +++ b/src/app/CommandResponseSender.h @@ -17,8 +17,8 @@ #pragma once -#include #include +#include #include #include #include @@ -35,7 +35,7 @@ namespace app { * CommandHandlerExchangeInterface implementation to enable sending InvokeResponseMessage(s). */ class CommandResponseSender : public Messaging::ExchangeDelegate, - public CommandHandler::Callback, + public CommandHandlerImpl::Callback, public CommandHandlerExchangeInterface { public: @@ -50,7 +50,7 @@ class CommandResponseSender : public Messaging::ExchangeDelegate, virtual void OnDone(CommandResponseSender & apResponderObj) = 0; }; - CommandResponseSender(Callback * apCallback, CommandHandler::Callback * apDispatchCallback) : + CommandResponseSender(Callback * apCallback, CommandHandlerImpl::Callback * apDispatchCallback) : mpCallback(apCallback), mpCommandHandlerCallback(apDispatchCallback), mCommandHandler(this), mExchangeCtx(*this) {} @@ -59,9 +59,9 @@ class CommandResponseSender : public Messaging::ExchangeDelegate, void OnResponseTimeout(Messaging::ExchangeContext * ec) override; - void OnDone(CommandHandler & apCommandObj) override; + void OnDone(CommandHandlerImpl & apCommandObj) override; - void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, + void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) override; Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) override; @@ -149,7 +149,7 @@ class CommandResponseSender : public Messaging::ExchangeDelegate, * @param faultType The specific type of fault to inject into the response. */ void TestOnlyInvokeCommandRequestWithFaultsInjected(Messaging::ExchangeContext * ec, System::PacketBufferHandle && payload, - bool isTimedInvoke, CommandHandler::NlFaultInjectionType faultType); + bool isTimedInvoke, CommandHandlerImpl::NlFaultInjectionType faultType); #endif // CHIP_WITH_NLFAULTINJECTION private: @@ -182,8 +182,8 @@ class CommandResponseSender : public Messaging::ExchangeDelegate, System::PacketBufferHandle mChunks; Callback * mpCallback; - CommandHandler::Callback * mpCommandHandlerCallback; - CommandHandler mCommandHandler; + CommandHandlerImpl::Callback * mpCommandHandlerCallback; + CommandHandlerImpl mCommandHandler; Messaging::ExchangeHolder mExchangeCtx; State mState = State::ReadyForInvokeResponses; diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 6ee2a1134594b5..132e8cdf108a72 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -389,8 +389,8 @@ void InteractionModelEngine::OnDone(CommandResponseSender & apResponderObj) mCommandResponderObjs.ReleaseObject(&apResponderObj); } -// TODO(#30453): Follow up refactor. Remove need for InteractionModelEngine::OnDone(CommandHandler). -void InteractionModelEngine::OnDone(CommandHandler & apCommandObj) +// TODO(#30453): Follow up refactor. Remove need for InteractionModelEngine::OnDone(CommandHandlerImpl). +void InteractionModelEngine::OnDone(CommandHandlerImpl & apCommandObj) { // We are no longer expecting to receive this callback. With the introduction of CommandResponseSender, it is now // responsible for receiving this callback. @@ -437,20 +437,20 @@ Status InteractionModelEngine::OnInvokeCommandRequest(Messaging::ExchangeContext ChipLogProgress(InteractionModel, "no resource for Invoke interaction"); return Status::Busy; } - CHIP_FAULT_INJECT( - FaultInjection::kFault_IMInvoke_SeparateResponses, - commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected( - apExchangeContext, std::move(aPayload), aIsTimedInvoke, CommandHandler::NlFaultInjectionType::SeparateResponseMessages); - return Status::Success;); + CHIP_FAULT_INJECT(FaultInjection::kFault_IMInvoke_SeparateResponses, + commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected( + apExchangeContext, std::move(aPayload), aIsTimedInvoke, + CommandHandlerImpl::NlFaultInjectionType::SeparateResponseMessages); + return Status::Success;); CHIP_FAULT_INJECT(FaultInjection::kFault_IMInvoke_SeparateResponsesInvertResponseOrder, commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected( apExchangeContext, std::move(aPayload), aIsTimedInvoke, - CommandHandler::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder); + CommandHandlerImpl::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder); return Status::Success;); CHIP_FAULT_INJECT( FaultInjection::kFault_IMInvoke_SkipSecondResponse, - commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected(apExchangeContext, std::move(aPayload), aIsTimedInvoke, - CommandHandler::NlFaultInjectionType::SkipSecondResponse); + commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected( + apExchangeContext, std::move(aPayload), aIsTimedInvoke, CommandHandlerImpl::NlFaultInjectionType::SkipSecondResponse); return Status::Success;); commandResponder->OnInvokeCommandRequest(apExchangeContext, std::move(aPayload), aIsTimedInvoke); return Status::Success; @@ -1674,7 +1674,7 @@ CHIP_ERROR InteractionModelEngine::PushFront(SingleLinkedListNode *& aObjectL return CHIP_NO_ERROR; } -void InteractionModelEngine::DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, +void InteractionModelEngine::DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) { CommandHandlerInterface * handler = FindCommandHandler(aCommandPath.mEndpointId, aCommandPath.mClusterId); @@ -1901,7 +1901,7 @@ void InteractionModelEngine::OnFabricRemoved(const FabricTable & fabricTable, Fa } } - // Applications may hold references to CommandHandler instances for async command processing. + // Applications may hold references to CommandHandlerImpl instances for async command processing. // Therefore we can't forcible destroy CommandHandlers here. Their exchanges will get closed by // the fabric removal, though, so they will fail when they try to actually send their command response // and will close at that point. diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index 4f61cb4e464a27..69c565254f96f0 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -87,7 +87,7 @@ namespace app { class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, public Messaging::ExchangeDelegate, public CommandResponseSender::Callback, - public CommandHandler::Callback, + public CommandHandlerImpl::Callback, public ReadHandler::ManagementCallback, public FabricTable::Delegate, public SubscriptionsInfoProvider, @@ -419,7 +419,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, using Status = Protocols::InteractionModel::Status; void OnDone(CommandResponseSender & apResponderObj) override; - void OnDone(CommandHandler & apCommandObj) override; + void OnDone(CommandHandlerImpl & apCommandObj) override; void OnDone(ReadHandler & apReadObj) override; void TryToResumeSubscriptions(); @@ -499,7 +499,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, Status OnUnsolicitedReportData(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload); - void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, + void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) override; Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) override; diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index dc6b6132341a63..2a5791ba839423 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -310,11 +311,12 @@ class MockCommandResponder : public CommandHandlerExchangeInterface bool mResponseDropped = false; }; -class MockCommandHandlerCallback : public CommandHandler::Callback +class MockCommandHandlerCallback : public CommandHandlerImpl::Callback { public: - void OnDone(CommandHandler & apCommandHandler) final { onFinalCalledTimes++; } - void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) final + void OnDone(CommandHandlerImpl & apCommandHandler) final { onFinalCalledTimes++; } + void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, + TLV::TLVReader & apPayload) final { DispatchSingleClusterCommand(aCommandPath, apPayload, &apCommandObj); } @@ -395,17 +397,19 @@ class TestCommandInteraction * we want to test APIs that cluster code uses, we need to inject entries into the * CommandPathRegistry directly. */ - class CommandHandlerWithUnrespondedCommand : public app::CommandHandler + class CommandHandlerWithUnrespondedCommand : public app::CommandHandlerImpl { public: - CommandHandlerWithUnrespondedCommand(CommandHandler::Callback * apCallback, const ConcreteCommandPath & aRequestCommandPath, - const Optional & aRef) : - CommandHandler(apCallback) + CommandHandlerWithUnrespondedCommand(CommandHandlerImpl::Callback * apCallback, + const ConcreteCommandPath & aRequestCommandPath, const Optional & aRef) : + CommandHandlerImpl(apCallback) { GetCommandPathRegistry().Add(aRequestCommandPath, aRef.std_optional()); SetExchangeInterface(&mMockCommandResponder); } MockCommandResponder mMockCommandResponder; + + using app::CommandHandler::AddResponse; }; // Generate an invoke request. If aCommandId is kTestCommandIdWithData, a @@ -428,7 +432,7 @@ class TestCommandInteraction CommandId aRequestCommandId = kTestCommandIdWithData); static uint32_t GetAddResponseDataOverheadSizeForPath(nlTestSuite * apSuite, const ConcreteCommandPath & aRequestCommandPath, ForcedSizeBufferLengthHint aBufferSizeHint); - static void FillCurrentInvokeResponseBuffer(nlTestSuite * apSuite, CommandHandler * apCommandHandler, + static void FillCurrentInvokeResponseBuffer(nlTestSuite * apSuite, CommandHandlerImpl * apCommandHandler, const ConcreteCommandPath & aRequestCommandPath, uint32_t aSizeToLeaveInBuffer); static void ValidateCommandHandlerEncodeInvokeResponseMessage(nlTestSuite * apSuite, void * apContext, bool aNeedStatusCode); }; @@ -627,8 +631,8 @@ uint32_t TestCommandInteraction::GetAddResponseDataOverheadSizeForPath(nlTestSui { BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); commandHandler.mReserveSpaceForMoreChunkMessages = true; ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; ConcreteCommandPath requestCommandPath2 = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; @@ -653,7 +657,7 @@ uint32_t TestCommandInteraction::GetAddResponseDataOverheadSizeForPath(nlTestSui return delta; } -void TestCommandInteraction::FillCurrentInvokeResponseBuffer(nlTestSuite * apSuite, CommandHandler * apCommandHandler, +void TestCommandInteraction::FillCurrentInvokeResponseBuffer(nlTestSuite * apSuite, CommandHandlerImpl * apCommandHandler, const ConcreteCommandPath & aRequestCommandPath, uint32_t aSizeToLeaveInBuffer) { @@ -705,7 +709,7 @@ void TestCommandInteraction::TestCommandHandlerWithWrongState(nlTestSuite * apSu // be handle already acquired on the callers behalf. CommandHandler::Handle handle(&commandHandler); - const CommandHandler::InvokeResponseParameters prepareParams(requestCommandPath); + const CommandHandlerImpl::InvokeResponseParameters prepareParams(requestCommandPath); err = commandHandler.PrepareInvokeResponseCommand(responseCommandPath, prepareParams); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } @@ -748,7 +752,7 @@ void TestCommandInteraction::TestCommandHandlerWithSendEmptyCommand(nlTestSuite // be handle already acquired on the callers behalf. CommandHandler::Handle handle(&commandHandler); - const CommandHandler::InvokeResponseParameters prepareParams(requestCommandPath); + const CommandHandlerImpl::InvokeResponseParameters prepareParams(requestCommandPath); err = commandHandler.PrepareInvokeResponseCommand(responseCommandPath, prepareParams); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = commandHandler.FinishCommand(); @@ -892,8 +896,8 @@ struct BadFields void TestCommandInteraction::TestCommandHandlerCommandDataEncoding(nlTestSuite * apSuite, void * apContext) { - auto path = MakeTestCommandPath(); - auto requestCommandPath = ConcreteCommandPath(path.mEndpointId, path.mClusterId, path.mCommandId); + auto path = MakeTestCommandPath(); + ConcreteCommandPath requestCommandPath(path.mEndpointId, path.mClusterId, path.mCommandId); CommandHandlerWithUnrespondedCommand commandHandler(nullptr, requestCommandPath, /* aRef = */ NullOptional); { @@ -1295,7 +1299,7 @@ void TestCommandInteraction::TestCommandHandlerEncodeSimpleStatusCode(nlTestSuit void TestCommandInteraction::TestCommandHandlerWithoutResponderCallingAddStatus(nlTestSuite * apSuite, void * apContext) { chip::app::ConcreteCommandPath requestCommandPath(kTestEndpointId, kTestClusterId, kTestCommandIdWithData); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); commandHandler.AddStatus(requestCommandPath, Protocols::InteractionModel::Status::Failure); @@ -1307,7 +1311,7 @@ void TestCommandInteraction::TestCommandHandlerWithoutResponderCallingAddStatus( void TestCommandInteraction::TestCommandHandlerWithoutResponderCallingAddResponse(nlTestSuite * apSuite, void * apContext) { chip::app::ConcreteCommandPath requestCommandPath(kTestEndpointId, kTestClusterId, kTestCommandIdWithData); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); uint32_t sizeToFill = 50; // This is an arbitrary number, we need to select a non-zero value. CHIP_ERROR err = commandHandler.AddResponseData(requestCommandPath, ForcedSizeBuffer(sizeToFill)); @@ -1322,13 +1326,13 @@ void TestCommandInteraction::TestCommandHandlerWithoutResponderCallingDirectPrep void * apContext) { chip::app::ConcreteCommandPath requestCommandPath(kTestEndpointId, kTestClusterId, kTestCommandIdWithData); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); // We intentionally prevent successful calls to PrepareInvokeResponseCommand and FinishCommand when no // responder is present. This aligns with the design decision to promote AddStatus and AddResponseData // usage in such scenarios. See GitHub issue #32486 for discussions on phasing out external use of // these primitives. - const CommandHandler::InvokeResponseParameters prepareParams(requestCommandPath); + const CommandHandlerImpl::InvokeResponseParameters prepareParams(requestCommandPath); ConcreteCommandPath responseCommandPath = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; CHIP_ERROR err = commandHandler.PrepareInvokeResponseCommand(responseCommandPath, prepareParams); NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_INCORRECT_STATE); @@ -1347,7 +1351,7 @@ void TestCommandInteraction::TestCommandHandlerWithOnInvokeReceivedNotExistComma // Use some invalid endpoint / cluster / command. GenerateInvokeRequest(apSuite, apContext, commandDatabuf, /* aIsTimedRequest = */ false, 0xEF /* command */, 0xADBE /* cluster */, 0xDE /* endpoint */); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); chip::isCommandDispatched = false; mockCommandHandlerDelegate.ResetCounter(); @@ -1368,7 +1372,7 @@ void TestCommandInteraction::TestCommandHandlerWithOnInvokeReceivedEmptyDataMsg( for (auto transactionIsTimed : allBooleans) { mockCommandHandlerDelegate.ResetCounter(); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); System::PacketBufferHandle commandDatabuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); chip::isCommandDispatched = false; @@ -1800,8 +1804,8 @@ void TestCommandInteraction::TestCommandHandlerRejectsMultipleCommandsWithIdenti BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); // Hackery to steal the InvokeRequest buffer from commandSender. System::PacketBufferHandle commandDatabuf; @@ -1867,7 +1871,7 @@ void TestCommandInteraction::TestCommandHandlerRejectMultipleCommandsWhenHandler sendResponse = true; commandDispatchedCount = 0; - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); MockCommandResponder mockCommandResponder; InteractionModel::Status status = commandHandler.OnInvokeCommandRequest(mockCommandResponder, std::move(commandDatabuf), false); NL_TEST_ASSERT(apSuite, status == InteractionModel::Status::InvalidAction); @@ -1918,8 +1922,8 @@ void TestCommandInteraction::TestCommandHandlerAcceptMultipleCommands(nlTestSuit BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); // Hackery to steal the InvokeRequest buffer from commandSender. System::PacketBufferHandle commandDatabuf; @@ -1941,8 +1945,8 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere { BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); commandHandler.mReserveSpaceForMoreChunkMessages = true; ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; @@ -1970,8 +1974,8 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere { BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); commandHandler.mReserveSpaceForMoreChunkMessages = true; ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; @@ -1999,8 +2003,8 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere { BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); commandHandler.mReserveSpaceForMoreChunkMessages = true; ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; ConcreteCommandPath requestCommandPath2 = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; @@ -2049,9 +2053,8 @@ void TestCommandInteraction::TestCommandHandlerReleaseWithExchangeClosed(nlTestS // Mimic closure of the exchange that would happen on a session release and verify that releasing the handle there-after // is handled gracefully. - asyncCommandHandle.Get()->mpResponder->GetExchangeContext()->GetSessionHolder().Release(); - asyncCommandHandle.Get()->mpResponder->GetExchangeContext()->OnSessionReleased(); - + asyncCommandHandle.Get()->GetExchangeContext()->GetSessionHolder().Release(); + asyncCommandHandle.Get()->GetExchangeContext()->OnSessionReleased(); asyncCommandHandle = nullptr; } #endif diff --git a/src/controller/java/OTAProviderDelegateBridge.cpp b/src/controller/java/OTAProviderDelegateBridge.cpp index 4565d42416c19a..77bf3572e0f65c 100644 --- a/src/controller/java/OTAProviderDelegateBridge.cpp +++ b/src/controller/java/OTAProviderDelegateBridge.cpp @@ -18,6 +18,7 @@ #include "OTAProviderDelegateBridge.h" +#include #include #include #include From a2a25fbdd76072f27928acb97fcb06761fbcd249 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 6 Jun 2024 13:55:18 -0400 Subject: [PATCH 071/162] Make removeDevice drop the subscription for an MTRDevice. (#33767) MTRDevice uses auto-resubscribe subscriptions. We had tests that set up a device, then did removeDevice, but that did not clear the subscription, and any attempts to clear it on the server side would cause it to try to re-subscribe if the subscription drop was detected. When invalidating an MTRDevice, we should tear down its subscription. --- src/darwin/Framework/CHIP/MTRDevice.mm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 8d808324fe9765..9a9b2eb340d107 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -788,9 +788,18 @@ - (void)invalidate // attempt, since we now have no delegate. _reattemptingSubscription = NO; - // We do not change _internalDeviceState here, because we might still have a - // subscription. In that case, _internalDeviceState will update when the - // subscription is actually terminated. + [_deviceController asyncDispatchToMatterQueue:^{ + // Destroy the read client and callback (has to happen on the Matter + // queue, to avoid deleting objects that are being referenced), to + // tear down the subscription. We will get no more callbacks from + // the subscrption after this point. + std::lock_guard lock(self->_lock); + self->_currentReadClient = nullptr; + self->_currentSubscriptionCallback = nullptr; + + [self _changeInternalState:MTRInternalDeviceStateUnsubscribed]; + } + errorHandler:nil]; [self _stopConnectivityMonitoring]; From 2b6969e4a683405ff76a52bab025d2c9842cc2e5 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 6 Jun 2024 16:22:22 -0400 Subject: [PATCH 072/162] Make EncodableToTLV arguments const (#33785) --- src/app/CommandHandler.h | 4 ++-- src/app/CommandHandlerImpl.cpp | 6 +++--- src/app/CommandHandlerImpl.h | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index 86f687c1c02466..6c2af0e8cf1e1e 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -155,7 +155,7 @@ class CommandHandler * case AddResponseData fails. */ virtual CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) = 0; + const DataModel::EncodableToTLV & aEncodable) = 0; /** * Attempts to encode a response to a command. @@ -171,7 +171,7 @@ class CommandHandler * AddResponseData allows the caller to try to deal with any CHIP_ERRORs. */ virtual void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) = 0; + const DataModel::EncodableToTLV & aEncodable) = 0; /** * Check whether the InvokeRequest we are handling is a timed invoke. diff --git a/src/app/CommandHandlerImpl.cpp b/src/app/CommandHandlerImpl.cpp index f32d6bebd49455..926e5b3877c6bd 100644 --- a/src/app/CommandHandlerImpl.cpp +++ b/src/app/CommandHandlerImpl.cpp @@ -114,7 +114,7 @@ Status CommandHandlerImpl::OnInvokeCommandRequest(CommandHandlerExchangeInterfac } CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) + const DataModel::EncodableToTLV & aEncodable) { ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId, aResponseCommandId }; @@ -134,7 +134,7 @@ CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aR } CHIP_ERROR CommandHandlerImpl::AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) + const DataModel::EncodableToTLV & aEncodable) { // Return early when response should not be sent out. VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); @@ -909,7 +909,7 @@ bool CommandHandlerImpl::IsTimedInvoke() const } void CommandHandlerImpl::AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) + const DataModel::EncodableToTLV & aEncodable) { CHIP_ERROR err = AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); if (err != CHIP_NO_ERROR) diff --git a/src/app/CommandHandlerImpl.h b/src/app/CommandHandlerImpl.h index fd85f35440f7cc..db7c8516bc5510 100644 --- a/src/app/CommandHandlerImpl.h +++ b/src/app/CommandHandlerImpl.h @@ -125,9 +125,9 @@ class CommandHandlerImpl : public CommandHandler CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) override; CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) override; + const DataModel::EncodableToTLV & aEncodable) override; void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) override; + const DataModel::EncodableToTLV & aEncodable) override; Access::SubjectDescriptor GetSubjectDescriptor() const override; FabricIndex GetAccessingFabricIndex() const override; @@ -409,7 +409,7 @@ class CommandHandlerImpl : public CommandHandler * @param [in] aEncodable the data to encode for the given aResponseCommandId */ CHIP_ERROR TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable); + const DataModel::EncodableToTLV & aEncodable); void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder); From d84f13e9bf71688a21a75d160521fce3435c0102 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Thu, 6 Jun 2024 16:29:23 -0400 Subject: [PATCH 073/162] Python testing: Conformance support for device type conditions (#33622) * Python testing: Conformance support for device type conditions * fix type * strings * simplify exception * Restyled by isort * address review comments --------- Co-authored-by: Restyled.io --- src/python_testing/TestConformanceSupport.py | 147 ++++++++++++++----- src/python_testing/conformance_support.py | 132 ++++++++++++----- 2 files changed, 206 insertions(+), 73 deletions(-) diff --git a/src/python_testing/TestConformanceSupport.py b/src/python_testing/TestConformanceSupport.py index f71eb3ed1d531f..1405e5c8c791cc 100644 --- a/src/python_testing/TestConformanceSupport.py +++ b/src/python_testing/TestConformanceSupport.py @@ -16,15 +16,23 @@ # import xml.etree.ElementTree as ElementTree +from typing import Callable -from conformance_support import ConformanceDecision, ConformanceException, ConformanceParseParameters, parse_callable_from_xml -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from conformance_support import (ConformanceDecision, ConformanceException, ConformanceParseParameters, deprecated, disallowed, + mandatory, optional, parse_basic_callable_from_xml, parse_callable_from_xml, + parse_device_type_callable_from_xml, provisional, zigbee) +from matter_testing_support import MatterBaseTest, default_matter_test_main from mobly import asserts +def basic_test(xml: str, cls: Callable) -> None: + et = ElementTree.fromstring(xml) + xml_callable = parse_basic_callable_from_xml(et) + asserts.assert_true(isinstance(xml_callable, cls), "Unexpected class parsed from basic conformance") + + class TestConformanceSupport(MatterBaseTest): - @async_test_body - async def setup_class(self): + def setup_class(self): super().setup_class() # a small feature map self.feature_names_to_bits = {'AB': 0x01, 'CD': 0x02} @@ -46,8 +54,7 @@ async def setup_class(self): self.params = ConformanceParseParameters( feature_map=self.feature_names_to_bits, attribute_map=self.attribute_names_to_values, command_map=self.command_names_to_values) - @async_test_body - async def test_conformance_mandatory(self): + def test_conformance_mandatory(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -55,8 +62,7 @@ async def test_conformance_mandatory(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) asserts.assert_equal(str(xml_callable), 'M') - @async_test_body - async def test_conformance_optional(self): + def test_conformance_optional(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -64,8 +70,7 @@ async def test_conformance_optional(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) asserts.assert_equal(str(xml_callable), 'O') - @async_test_body - async def test_conformance_disallowed(self): + def test_conformance_disallowed(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -80,8 +85,7 @@ async def test_conformance_disallowed(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.DISALLOWED) asserts.assert_equal(str(xml_callable), 'D') - @async_test_body - async def test_conformance_provisional(self): + def test_conformance_provisional(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -89,8 +93,7 @@ async def test_conformance_provisional(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.PROVISIONAL) asserts.assert_equal(str(xml_callable), 'P') - @async_test_body - async def test_conformance_zigbee(self): + def test_conformance_zigbee(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -98,8 +101,7 @@ async def test_conformance_zigbee(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'Zigbee') - @async_test_body - async def test_conformance_mandatory_on_condition(self): + def test_conformance_mandatory_on_condition(self): xml = ('' '' '') @@ -151,8 +153,7 @@ async def test_conformance_mandatory_on_condition(self): # test command in optional and in boolean - this is the same as attribute essentially, so testing every permutation is overkill - @async_test_body - async def test_conformance_optional_on_condition(self): + def test_conformance_optional_on_condition(self): # single feature optional xml = ('' '' @@ -228,8 +229,7 @@ async def test_conformance_optional_on_condition(self): asserts.assert_equal(xml_callable(0x00, [], c), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[cmd2]') - @async_test_body - async def test_conformance_not_term_mandatory(self): + def test_conformance_not_term_mandatory(self): # single feature not mandatory xml = ('' '' @@ -288,8 +288,7 @@ async def test_conformance_not_term_mandatory(self): asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '!attr2') - @async_test_body - async def test_conformance_not_term_optional(self): + def test_conformance_not_term_optional(self): # single feature not optional xml = ('' '' @@ -319,8 +318,7 @@ async def test_conformance_not_term_optional(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!CD]') - @async_test_body - async def test_conformance_and_term(self): + def test_conformance_and_term(self): # and term for features only xml = ('' '' @@ -370,8 +368,7 @@ async def test_conformance_and_term(self): asserts.assert_equal(xml_callable(f, a, []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB & attr2') - @async_test_body - async def test_conformance_or_term(self): + def test_conformance_or_term(self): # or term feature only xml = ('' '' @@ -421,8 +418,7 @@ async def test_conformance_or_term(self): asserts.assert_equal(xml_callable(f, a, []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB | attr2') - @async_test_body - async def test_conformance_and_term_with_not(self): + def test_conformance_and_term_with_not(self): # and term with not xml = ('' '' @@ -441,8 +437,7 @@ async def test_conformance_and_term_with_not(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!AB & CD]') - @async_test_body - async def test_conformance_or_term_with_not(self): + def test_conformance_or_term_with_not(self): # or term with not on second feature xml = ('' '' @@ -479,8 +474,7 @@ async def test_conformance_or_term_with_not(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!(AB | CD)]') - @async_test_body - async def test_conformance_and_term_with_three_terms(self): + def test_conformance_and_term_with_three_terms(self): # and term with three features xml = ('' '' @@ -519,8 +513,7 @@ async def test_conformance_and_term_with_three_terms(self): asserts.assert_equal(xml_callable(f, a, c), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[AB & attr1 & cmd1]') - @async_test_body - async def test_conformance_or_term_with_three_terms(self): + def test_conformance_or_term_with_three_terms(self): # or term with three features xml = ('' '' @@ -671,6 +664,92 @@ def test_conformance_greater(self): except ConformanceException: pass + def test_basic_conformance(self): + basic_test('', mandatory) + basic_test('', optional) + basic_test('', disallowed) + basic_test('', deprecated) + basic_test('', provisional) + basic_test('', zigbee) + + # feature is not basic so we should get an exception + xml = '' + et = ElementTree.fromstring(xml) + try: + parse_basic_callable_from_xml(et) + asserts.fail("Unexpected success parsing non-basic conformance") + except ConformanceException: + pass + + # mandatory tag is basic, but this one is a wrapper, so we should get a TypeError + xml = ('' + '' + '' + '' + '' + '' + '' + '') + et = ElementTree.fromstring(xml) + try: + parse_basic_callable_from_xml(et) + asserts.fail("Unexpected success parsing mandatory wrapper") + except ConformanceException: + pass + + def test_device_type_conformance(self): + msg = "Unexpected conformance returned for device type" + xml = ('' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + asserts.assert_equal(str(xml_callable), 'Zigbee', msg) + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.NOT_APPLICABLE, msg) + + xml = ('' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + # expect no exception here + asserts.assert_equal(str(xml_callable), '[Zigbee]', msg) + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.NOT_APPLICABLE, msg) + + # otherwise conforms are allowed + xml = ('' + '' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + # expect no exception here + asserts.assert_equal(str(xml_callable), 'Zigbee, P', msg) + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.PROVISIONAL, msg) + + # Device type conditions or features don't correspond to anything in the spec, so the XML takes a best + # guess as to what they are. We should be able to parse features, conditions, attributes as the same + # thing. + # TODO: allow querying conformance for conditional device features + # TODO: adjust conformance call function to accept a list of features and evaluate based on that + xml = ('' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + asserts.assert_equal(str(xml_callable), 'CD', msg) + # Device features are always optional (at least for now), even though we didn't pass this feature in + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.OPTIONAL) + + xml = ('' + '' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + asserts.assert_equal(str(xml_callable), 'CD, testy', msg) + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.OPTIONAL) + if __name__ == "__main__": default_matter_test_main() diff --git a/src/python_testing/conformance_support.py b/src/python_testing/conformance_support.py index 025c1afa678995..c9bdb5830c884b 100644 --- a/src/python_testing/conformance_support.py +++ b/src/python_testing/conformance_support.py @@ -39,6 +39,7 @@ COMMAND_TAG = 'command' CONDITION_TAG = 'condition' LITERAL_TAG = 'literal' +ZIGBEE_CONDITION = 'zigbee' class ConformanceException(Exception): @@ -137,6 +138,16 @@ def __str__(self): return str(self.value) +# Conformance options that apply regardless of the element set of the cluster or device +BASIC_CONFORMANCE: dict[str, Callable] = { + MANDATORY_CONFORM: mandatory(), + OPTIONAL_CONFORM: optional(), + PROVISIONAL_CONFORM: provisional(), + DEPRECATE_CONFORM: deprecated(), + DISALLOW_CONFORM: disallowed() +} + + class feature: def __init__(self, requiredFeature: uint, code: str): self.requiredFeature = requiredFeature @@ -148,7 +159,20 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li return ConformanceDecision.NOT_APPLICABLE def __str__(self): - return f'{self.code}' + return self.code + + +class device_feature: + ''' This is different than element feature because device types use "features" that aren't reported anywhere''' + + def __init__(self, feature: str): + self.feature = feature + + def __call__(self, feature_map: uint = 0, attribute_list: list[uint] = [], all_command_list: list[uint] = []) -> ConformanceDecision: + return ConformanceDecision.OPTIONAL + + def __str__(self): + return self.feature class attribute: @@ -162,7 +186,7 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li return ConformanceDecision.NOT_APPLICABLE def __str__(self): - return f'{self.name}' + return self.name class command: @@ -176,7 +200,7 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li return ConformanceDecision.NOT_APPLICABLE def __str__(self): - return f'{self.name}' + return self.name def strip_outer_parentheses(inner: str) -> str: @@ -222,8 +246,11 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li # not operations also can't be used with things that are optional # ie, ![AB] doesn't make sense, nor does !O decision = self.op(feature_map, attribute_list, all_command_list) - if decision == ConformanceDecision.OPTIONAL or decision == ConformanceDecision.DISALLOWED or decision == ConformanceDecision.PROVISIONAL: + if decision == ConformanceDecision.DISALLOWED or decision == ConformanceDecision.PROVISIONAL: raise ConformanceException('NOT operation on optional or disallowed item') + # Features in device types degrade to optional so a not operation here is still optional because we don't have any way to verify the features since they're not exposed anywhere + elif decision == ConformanceDecision.OPTIONAL: + return ConformanceDecision.OPTIONAL elif decision == ConformanceDecision.NOT_APPLICABLE: return ConformanceDecision.MANDATORY elif decision == ConformanceDecision.MANDATORY: @@ -325,48 +352,23 @@ def __str__(self): return ', '.join(op_strs) -def parse_callable_from_xml(element: ElementTree.Element, params: ConformanceParseParameters) -> Callable: - if len(list(element)) == 0: - # no subchildren here, so this can only be mandatory, optional, provisional, deprecated, disallowed, feature or attribute - if element.tag == MANDATORY_CONFORM: - return mandatory() - elif element.tag == OPTIONAL_CONFORM: - return optional() - elif element.tag == PROVISIONAL_CONFORM: - return provisional() - elif element.tag == DEPRECATE_CONFORM: - return deprecated() - elif element.tag == DISALLOW_CONFORM: - return disallowed() - elif element.tag == FEATURE_TAG: - try: - return feature(params.feature_map[element.get('name')], element.get('name')) - except KeyError: - raise ConformanceException(f'Conformance specifies feature not in feature table: {element.get("name")}') - elif element.tag == ATTRIBUTE_TAG: - # Some command conformance tags are marked as attribute, so if this key isn't in attribute, try command - name = element.get('name') - if name in params.attribute_map: - return attribute(params.attribute_map[name], name) - elif name in params.command_map: - return command(params.command_map[name], name) - else: - raise ConformanceException(f'Conformance specifies attribute or command not in table: {name}') - elif element.tag == COMMAND_TAG: - return command(params.command_map[element.get('name')], element.get('name')) - elif element.tag == CONDITION_TAG and element.get('name').lower() == 'zigbee': +def parse_basic_callable_from_xml(element: ElementTree.Element) -> Callable: + if list(element): + raise ConformanceException("parse_basic_callable_from_xml called for XML element with children") + # This will throw a key error if this is not a basic element key. + try: + return BASIC_CONFORMANCE[element.tag] + except KeyError: + if element.tag == CONDITION_TAG and element.get('name').lower() == ZIGBEE_CONDITION: return zigbee() elif element.tag == LITERAL_TAG: return literal(element.get('value')) else: raise ConformanceException( - f'Unexpected xml conformance element with no children {str(element.tag)} {str(element.attrib)}') + f'parse_basic_callable_from_xml called for unknown element {str(element.tag)} {str(element.attrib)}') - # First build the list, then create the callable for this element - ops = [] - for sub in element: - ops.append(parse_callable_from_xml(sub, params)) +def parse_wrapper_callable_from_xml(element: ElementTree.Element, ops: list[Callable]) -> Callable: # optional can be a wrapper as well as a standalone # This can be any of the boolean operations, optional or otherwise if element.tag == OPTIONAL_CONFORM: @@ -393,3 +395,55 @@ def parse_callable_from_xml(element: ElementTree.Element, params: ConformancePar return greater_operation(ops[0], ops[1]) else: raise ConformanceException(f'Unexpected conformance tag with children {element}') + + +def parse_device_type_callable_from_xml(element: ElementTree.Element) -> Callable: + ''' Only allows basic, or wrappers over things that degrade to basic.''' + if not list(element): + try: + return parse_basic_callable_from_xml(element) + # For device types ONLY, there are conformances called "attributes" that are essentially just placeholders for conditions in the device library. + # For example, temperature controlled cabinet has conditions called "heating" and "cooling". The cluster conditions are dependent on them, but they're not + # actually exposed anywhere ON the device other than through the presence of the cluster. So for now, treat any attribute conditions that are cluster conditions + # as just optional, because it's optional to implement any device type feature. + # Device types also have some marked as "condition" that are similarly optional + except ConformanceException: + if element.tag == ATTRIBUTE_TAG or element.tag == CONDITION_TAG or element.tag == FEATURE_TAG: + return device_feature(element.attrib['name']) + raise + + ops = [parse_device_type_callable_from_xml(sub) for sub in element] + return parse_wrapper_callable_from_xml(element, ops) + + +def parse_callable_from_xml(element: ElementTree.Element, params: ConformanceParseParameters) -> Callable: + if not list(element): + try: + return parse_basic_callable_from_xml(element) + except ConformanceException: + # If we get an exception here, it wasn't a basic type, so move on and check if its + # something else. + pass + if element.tag == FEATURE_TAG: + try: + return feature(params.feature_map[element.get('name')], element.get('name')) + except KeyError: + raise ConformanceException(f'Conformance specifies feature not in feature table: {element.get("name")}') + elif element.tag == ATTRIBUTE_TAG: + # Some command conformance tags are marked as attribute, so if this key isn't in attribute, try command + name = element.get('name') + if name in params.attribute_map: + return attribute(params.attribute_map[name], name) + elif name in params.command_map: + return command(params.command_map[name], name) + else: + raise ConformanceException(f'Conformance specifies attribute or command not in table: {name}') + elif element.tag == COMMAND_TAG: + return command(params.command_map[element.get('name')], element.get('name')) + else: + raise ConformanceException( + f'Unexpected xml conformance element with no children {str(element.tag)} {str(element.attrib)}') + + # First build the list, then create the callable for this element + ops = [parse_callable_from_xml(sub, params) for sub in element] + return parse_wrapper_callable_from_xml(element, ops) From 3d7e23e8f610adcf93b40fe3d94f86f7d3819a1c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 6 Jun 2024 18:02:38 -0400 Subject: [PATCH 074/162] Add better APIs for handling FeatureMap in MTRServerAttribute. (#33760) * Add better APIs for handling FeatureMap in MTRServerAttribute. Do more sanity checks when using the initializer, and provide a factory method that makes creating FeatureMap attributes easier. * Apply suggestions from code review Co-authored-by: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> --------- Co-authored-by: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> --- .../CHIP/ServerEndpoint/MTRServerAttribute.h | 12 ++++++- .../CHIP/ServerEndpoint/MTRServerAttribute.mm | 28 ++++++++++++++- .../CHIPTests/MTRServerEndpointTests.m | 35 +++++++++++++++++++ 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h index efbbf35013c8c0..144a00c97da2af 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h @@ -41,7 +41,9 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) * Will fail if the attribute ID is not valid per the Matter specification or * the attribute value is not a valid data-value. * - * requiredPrivilege is the privilege required to read the attribute. + * requiredPrivilege is the privilege required to read the attribute. This + * initializer may fail if the provided attributeID is a global attribute and + * the provided requiredPrivilege value is not correct for that attribute ID. */ - (nullable instancetype)initReadonlyAttributeWithID:(NSNumber *)attributeID initialValue:(NSDictionary *)value requiredPrivilege:(MTRAccessControlEntryPrivilege)requiredPrivilege; @@ -53,6 +55,14 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) */ - (BOOL)setValue:(NSDictionary *)value; +/** + * Create an attribute description for a FeatureMap attribute with the provided + * value (expected to be an unsigned integer representing the value of the + * bitmap). This will automatically set requiredPrivilege to the right value + * for FeatureMap. + */ ++ (MTRServerAttribute *)newFeatureMapAttributeWithInitialValue:(NSNumber *)value; + @property (atomic, copy, readonly) NSNumber * attributeID; @property (atomic, copy, readonly) NSDictionary * value; /** diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.mm index 619ca98b2f4b47..359bbe1362b403 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.mm @@ -23,6 +23,7 @@ #import "MTRUnfairLock.h" #import "NSDataSpanConversion.h" +#import #import #include @@ -57,6 +58,20 @@ - (nullable instancetype)initAttributeWithID:(NSNumber *)attributeID initialValu return nil; } + if (attrId == MTRAttributeIDTypeGlobalAttributeFeatureMapID) { + // Some sanity checks: value should be an unsigned-integer NSNumber, and + // requiredReadPrivilege should be View. + if (requiredReadPrivilege != MTRAccessControlEntryPrivilegeView) { + MTR_LOG_ERROR("MTRServerAttribute for FeatureMap provided with invalid read privilege %d", requiredReadPrivilege); + return nil; + } + + if (![MTRUnsignedIntegerValueType isEqual:value[MTRTypeKey]]) { + MTR_LOG_ERROR("MTRServerAttribute for FeatureMap provided with value that is not an unsigned integer: %@", value); + return nil; + } + } + return [self initWithAttributeID:[attributeID copy] value:[value copy] requiredReadPrivilege:requiredReadPrivilege writable:writable]; } @@ -80,7 +95,8 @@ - (nullable instancetype)initWithAttributeID:(NSNumber *)attributeID value:(NSDi _writable = writable; _parentCluster = app::ConcreteClusterPath(kInvalidEndpointId, kInvalidClusterId); - // Now call setValue to store the value and its serialization. + // Now store the value and its serialization. This will also check that the + // value is serializable to TLV. if ([self setValueInternal:value logIfNotAssociated:NO] == NO) { return nil; } @@ -93,6 +109,16 @@ - (BOOL)setValue:(NSDictionary *)value return [self setValueInternal:value logIfNotAssociated:YES]; } ++ (MTRServerAttribute *)newFeatureMapAttributeWithInitialValue:(NSNumber *)value +{ + return [[MTRServerAttribute alloc] initReadonlyAttributeWithID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID) + initialValue:@{ + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : value, + } + requiredPrivilege:MTRAccessControlEntryPrivilegeView]; +} + - (BOOL)setValueInternal:(NSDictionary *)value logIfNotAssociated:(BOOL)logIfNotAssociated { id serializedValue; diff --git a/src/darwin/Framework/CHIPTests/MTRServerEndpointTests.m b/src/darwin/Framework/CHIPTests/MTRServerEndpointTests.m index 4a7c31a25a8b02..e2b070d43b76a8 100644 --- a/src/darwin/Framework/CHIPTests/MTRServerEndpointTests.m +++ b/src/darwin/Framework/CHIPTests/MTRServerEndpointTests.m @@ -126,6 +126,11 @@ - (void)testServerAttribute MTRValueKey : @(5), }; + __auto_type * signedIntValue = @{ + MTRTypeKey : MTRSignedIntegerValueType, + MTRValueKey : @(5), + }; + __auto_type * listOfStringsValue = @{ MTRTypeKey : MTRArrayValueType, MTRValueKey : @[ @@ -192,6 +197,36 @@ - (void)testServerAttribute __auto_type * attr = [[MTRServerAttribute alloc] initReadonlyAttributeWithID:invalidID initialValue:unsignedIntValue requiredPrivilege:MTRAccessControlEntryPrivilegeView]; XCTAssertNil(attr); } + + // Valid FeatureMap attribute + { + __auto_type * attr = [[MTRServerAttribute alloc] initReadonlyAttributeWithID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID) initialValue:unsignedIntValue requiredPrivilege:MTRAccessControlEntryPrivilegeView]; + XCTAssertNotNil(attr); + XCTAssertEqualObjects(attr.attributeID, @(MTRAttributeIDTypeGlobalAttributeFeatureMapID)); + XCTAssertEqualObjects(attr.value, unsignedIntValue); + XCTAssertEqual(attr.writable, NO); + } + + // FeatureMap attribute with wrong value type + { + __auto_type * attr = [[MTRServerAttribute alloc] initReadonlyAttributeWithID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID) initialValue:signedIntValue requiredPrivilege:MTRAccessControlEntryPrivilegeView]; + XCTAssertNil(attr); + } + + // FeatureMap attribute with wrong permissions + { + __auto_type * attr = [[MTRServerAttribute alloc] initReadonlyAttributeWithID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID) initialValue:unsignedIntValue requiredPrivilege:MTRAccessControlEntryPrivilegeOperate]; + XCTAssertNil(attr); + } + + // FeatureMap attribute via factory + { + __auto_type * attr = [MTRServerAttribute newFeatureMapAttributeWithInitialValue:@(5)]; + XCTAssertNotNil(attr); + XCTAssertEqualObjects(attr.attributeID, @(MTRAttributeIDTypeGlobalAttributeFeatureMapID)); + XCTAssertEqualObjects(attr.value, unsignedIntValue); + XCTAssertEqual(attr.writable, NO); + } } - (void)testDeviceType From 4239c887d5751da766a866f63385d2ef8bc44452 Mon Sep 17 00:00:00 2001 From: Pradip De Date: Thu, 6 Jun 2024 20:05:42 -0700 Subject: [PATCH 075/162] Close TCP connection when received message size is too large. (#33768) When the framing length value of a received message is larger than what the local node can process, abort the connection with the peer. Sending a StatusResponse message back to the peer as a notification may not be feasible in all circumstances for reasons, such as: 1) It would require a cross-layered feedback up to the Exchange layer to generate such a message in response to a failure at the transport layer. 2) A Status Response is sent in response to a message on an ExchangeContext and that may not be the case in scnearios where this message is the first unsolicited message. The receiver could drain out the bits from the offending message and move on to the next message in the stream but that may not guarantee correct behavior and would consume resources unnecessarily. Given that the peer was already aware of the max length this node was willing to receive during its TCP advertisement, it seems prudent to fail fast and close the connection. Fixes #33307. --- src/transport/raw/TCP.cpp | 5 ++++- src/transport/raw/tests/TestTCP.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/transport/raw/TCP.cpp b/src/transport/raw/TCP.cpp index b928c3e91cccae..3c3e6da15c2b58 100644 --- a/src/transport/raw/TCP.cpp +++ b/src/transport/raw/TCP.cpp @@ -331,7 +331,10 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe uint32_t messageSize = LittleEndian::Get32(messageSizeBuf); if (messageSize >= kMaxTCPMessageSize) { - // This message is too long for upper layers. + // Message is too big for this node to process. Disconnect from peer. + ChipLogError(Inet, "Received TCP message of length %" PRIu32 " exceeds limit.", messageSize); + CloseConnectionInternal(state, CHIP_ERROR_MESSAGE_TOO_LONG, SuppressCallback::No); + return CHIP_ERROR_MESSAGE_TOO_LONG; } // The subtraction will not underflow because we successfully read kPacketSizeBytes. diff --git a/src/transport/raw/tests/TestTCP.cpp b/src/transport/raw/tests/TestTCP.cpp index dbce3b8ce5ef43..4f78da5dcdce86 100644 --- a/src/transport/raw/tests/TestTCP.cpp +++ b/src/transport/raw/tests/TestTCP.cpp @@ -682,7 +682,9 @@ TEST_F(TestTCP, CheckProcessReceivedBuffer) EXPECT_EQ(err, CHIP_ERROR_MESSAGE_TOO_LONG); EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 0); - gMockTransportMgrDelegate.DisconnectTest(tcp, addr); + // The receipt of a message exceeding the allowed size should have + // closed the connection. + EXPECT_EQ(TestAccess::GetEndpoint(state), nullptr); } } // namespace From d65f85c5b25df69a7d8f08714b6c0719473d7409 Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:46:54 +0800 Subject: [PATCH 076/162] [Ameba] cleanup platform config (#33629) * Cleanup and allow redefinition of macro --- src/platform/Ameba/CHIPDevicePlatformConfig.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/Ameba/CHIPDevicePlatformConfig.h b/src/platform/Ameba/CHIPDevicePlatformConfig.h index 647466b5970102..e10c8ddf9aefaf 100644 --- a/src/platform/Ameba/CHIPDevicePlatformConfig.h +++ b/src/platform/Ameba/CHIPDevicePlatformConfig.h @@ -25,8 +25,13 @@ #pragma once // ==================== Platform Adaptations ==================== -#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0 +#ifndef CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION +#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1 +#endif + +#ifndef CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 +#endif #if CHIP_ENABLE_OPENTHREAD #define CHIP_DEVICE_CONFIG_ENABLE_THREAD 1 From 27abfb68d4056c3dea9b5c1e436eebb86fe4c884 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 7 Jun 2024 15:50:34 +0200 Subject: [PATCH 077/162] [Python] Add TriggerResubscribeIfScheduled to SubscriptionTransaction (#33774) Add TriggerResubscribeIfScheduled to SubscriptionTransaction. If the ReadClient currently has a resubscription attempt scheduled, This function allows to trigger that attempt immediately. This is useful when the server side is up and communicating, and it's a good time to try to resubscribe. --- src/controller/python/chip/clusters/Attribute.py | 7 +++++++ src/controller/python/chip/clusters/attribute.cpp | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index a1a341ed46614a..5bb8e7c8eebbc7 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -465,6 +465,13 @@ def OverrideLivenessTimeoutMs(self, timeoutMs: int): lambda: handle.pychip_ReadClient_OverrideLivenessTimeout(self._readTransaction._pReadClient, timeoutMs) ) + async def TriggerResubscribeIfScheduled(self, reason: str): + handle = chip.native.GetLibraryHandle() + await builtins.chipStack.CallAsync( + lambda: handle.pychip_ReadClient_TriggerResubscribeIfScheduled( + self._readTransaction._pReadClient, reason.encode("utf-8")) + ) + def GetReportingIntervalsSeconds(self) -> Tuple[int, int]: ''' Retrieve the reporting intervals associated with an active subscription. diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index b73b4a49b44d1f..7c5b2c906ab69c 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -464,6 +464,12 @@ void pychip_ReadClient_OverrideLivenessTimeout(ReadClient * pReadClient, uint32_ pReadClient->OverrideLivenessTimeout(System::Clock::Milliseconds32(livenessTimeoutMs)); } +void pychip_ReadClient_TriggerResubscribeIfScheduled(ReadClient * pReadClient, const char * reason) +{ + VerifyOrDie(pReadClient != nullptr); + pReadClient->TriggerResubscribeIfScheduled(reason); +} + PyChipError pychip_ReadClient_GetReportingIntervals(ReadClient * pReadClient, uint16_t * minIntervalSec, uint16_t * maxIntervalSec) { VerifyOrDie(pReadClient != nullptr); From a30f9f82df034a72ddfcefaf596696fc971b5028 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Fri, 7 Jun 2024 16:01:06 +0200 Subject: [PATCH 078/162] [Tizen] Improve memory management in BLE module (#33800) * Simplify memory management of BLE device scanner * Pass values via const refs if possible * Decouple BLE scanner and scanning timeout * Restyled by clang-format * Forward scan error to delegate * Forward BLE disconnection to CHIPoBLE layer --------- Co-authored-by: Restyled.io --- src/platform/Tizen/BLEManagerImpl.cpp | 127 ++++++++++++----------- src/platform/Tizen/BLEManagerImpl.h | 19 ++-- src/platform/Tizen/ChipDeviceScanner.cpp | 89 ++++++---------- src/platform/Tizen/ChipDeviceScanner.h | 41 +++----- 4 files changed, 123 insertions(+), 153 deletions(-) diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index 247719a9199b76..31cfe3456bb934 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -401,16 +401,16 @@ void BLEManagerImpl::NotifyBLEIndicationConfirmation(BLE_CONNECTION_OBJECT conId PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error) +void BLEManagerImpl::NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId) { ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionEstablished }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error) +void BLEManagerImpl::NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId) { ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionError, - .CHIPoBLEConnectionError = { .ConId = conId, .Reason = error } }; + .CHIPoBLEConnectionError = { .ConId = conId, .Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED } }; PlatformMgr().PostEventOrDie(&event); } @@ -479,44 +479,50 @@ CHIP_ERROR BLEManagerImpl::ConnectChipThing(const char * address) return err; } -void BLEManagerImpl::OnChipDeviceScanned(void * device, const Ble::ChipBLEDeviceIdentificationInfo & info) +void BLEManagerImpl::OnDeviceScanned(const bt_adapter_le_device_scan_result_info_s & scanInfo, + const Ble::ChipBLEDeviceIdentificationInfo & info) { - auto deviceInfo = reinterpret_cast(device); - VerifyOrReturn(deviceInfo != nullptr, ChipLogError(DeviceLayer, "Invalid Device Info")); - - ChipLogProgress(DeviceLayer, "New device scanned: %s", deviceInfo->remote_address); + ChipLogProgress(Ble, "New device scanned: %s", scanInfo.remote_address); if (mBLEScanConfig.mBleScanState == BleScanState::kScanForDiscriminator) { - if (!mBLEScanConfig.mDiscriminator.MatchesLongDiscriminator(info.GetDeviceDiscriminator())) - { - return; - } - ChipLogProgress(DeviceLayer, "Device discriminator match. Attempting to connect."); + auto isMatch = mBLEScanConfig.mDiscriminator.MatchesLongDiscriminator(info.GetDeviceDiscriminator()); + VerifyOrReturn( + isMatch, + ChipLogError(Ble, "Skip connection: Device discriminator does not match: %u != %u", info.GetDeviceDiscriminator(), + mBLEScanConfig.mDiscriminator.IsShortDiscriminator() ? mBLEScanConfig.mDiscriminator.GetShortValue() + : mBLEScanConfig.mDiscriminator.GetLongValue())); + ChipLogProgress(Ble, "Device discriminator match. Attempting to connect."); } else if (mBLEScanConfig.mBleScanState == BleScanState::kScanForAddress) { - if (strcmp(deviceInfo->remote_address, mBLEScanConfig.mAddress.c_str()) != 0) - { - return; - } - ChipLogProgress(DeviceLayer, "Device address match. Attempting to connect."); + auto isMatch = strcmp(scanInfo.remote_address, mBLEScanConfig.mAddress.c_str()) == 0; + VerifyOrReturn(isMatch, + ChipLogError(Ble, "Skip connection: Device address does not match: %s != %s", scanInfo.remote_address, + mBLEScanConfig.mAddress.c_str())); + ChipLogProgress(Ble, "Device address match. Attempting to connect."); } else { - ChipLogError(DeviceLayer, "Unknown discovery type. Ignoring scanned device."); + ChipLogError(Ble, "Unknown discovery type. Ignoring scanned device."); return; } /* Set CHIP Connecting state */ mBLEScanConfig.mBleScanState = BleScanState::kConnecting; + chip::DeviceLayer::PlatformMgr().LockChipStack(); + // We StartScan in the ChipStack thread. + // StopScan should also be performed in the ChipStack thread. + // At the same time, the scan timer also needs to be canceled in the ChipStack thread. + DeviceLayer::SystemLayer().CancelTimer(HandleScanTimeout, this); + mDeviceScanner.StopScan(); + // Stop scanning and then start connecting timer DeviceLayer::SystemLayer().StartTimer(kConnectTimeout, HandleConnectionTimeout, this); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - mDeviceScanner->StopChipScan(); /* Initiate Connect */ - auto params = std::make_pair(this, deviceInfo->remote_address); + auto params = std::make_pair(this, scanInfo.remote_address); PlatformMgrImpl().GLibMatterContextInvokeSync( +[](typeof(params) * aParams) { return aParams->first->ConnectChipThing(aParams->second); }, ¶ms); } @@ -540,6 +546,7 @@ void BLEManagerImpl::OnScanComplete() void BLEManagerImpl::OnScanError(CHIP_ERROR err) { + BleConnectionDelegate::OnConnectionError(mBLEScanConfig.mAppState, err); ChipLogDetail(Ble, "BLE scan error: %" CHIP_ERROR_FORMAT, err.Format()); } @@ -866,6 +873,7 @@ void BLEManagerImpl::RemoveConnectionData(const char * remoteAddr) VerifyOrReturn(conn != nullptr, ChipLogError(DeviceLayer, "Connection does not exist for [%s]", StringOrNullMarker(remoteAddr))); + BLEManagerImpl::NotifyBLEDisconnection(conn); g_hash_table_remove(mConnectionMap, remoteAddr); ChipLogProgress(DeviceLayer, "Connection Removed"); @@ -918,7 +926,7 @@ void BLEManagerImpl::HandleConnectionEvent(bool connected, const char * remoteAd } else { - ChipLogProgress(DeviceLayer, "Device DisConnected [%s]", StringOrNullMarker(remoteAddress)); + ChipLogProgress(DeviceLayer, "Device Disconnected [%s]", StringOrNullMarker(remoteAddress)); RemoveConnectionData(remoteAddress); } } @@ -1008,6 +1016,11 @@ CHIP_ERROR BLEManagerImpl::_Init() void BLEManagerImpl::_Shutdown() { + // Make sure that timers are stopped before shutting down the BLE layer. + DeviceLayer::SystemLayer().CancelTimer(HandleScanTimeout, this); + DeviceLayer::SystemLayer().CancelTimer(HandleAdvertisingTimeout, this); + DeviceLayer::SystemLayer().CancelTimer(HandleConnectionTimeout, this); + int ret = bt_deinitialize(); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_deinitialize() failed: %s", get_error_message(ret))); } @@ -1119,11 +1132,10 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv CleanScanConfig(); } break; - case DeviceEventType::kPlatformTizenBLEWriteComplete: { + case DeviceEventType::kPlatformTizenBLEWriteComplete: HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; - } - case DeviceEventType::kPlatformTizenBLESubscribeOpComplete: { + case DeviceEventType::kPlatformTizenBLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, &chip::Ble::CHIP_BLE_CHAR_2_UUID); @@ -1131,13 +1143,11 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, &chip::Ble::CHIP_BLE_CHAR_2_UUID); break; - } - case DeviceEventType::kPlatformTizenBLEIndicationReceived: { + case DeviceEventType::kPlatformTizenBLEIndicationReceived: HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &Ble::CHIP_BLE_SVC_ID, &chip::Ble::CHIP_BLE_CHAR_2_UUID, System::PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; - } default: break; } @@ -1151,7 +1161,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipLogProgress(DeviceLayer, "CHIPoBLESubscribe"); HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); - NotifyBLEConnectionEstablished(event->CHIPoBLESubscribe.ConId, CHIP_NO_ERROR); + NotifyBLEConnectionEstablished(event->CHIPoBLESubscribe.ConId); break; case DeviceEventType::kCHIPoBLEUnsubscribe: ChipLogProgress(DeviceLayer, "CHIPoBLEUnsubscribe"); @@ -1357,55 +1367,48 @@ void BLEManagerImpl::NewConnection(BleLayer * bleLayer, void * appState, const S void BLEManagerImpl::InitiateScan(BleScanState scanType) { - CHIP_ERROR err = CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_ERROR_INCORRECT_STATE; ScanFilterData data = {}; - ChipLogProgress(DeviceLayer, "Initiate scan"); - - /* Check Scanning state */ - if (scanType == BleScanState::kNotScanning) - { - err = CHIP_ERROR_INCORRECT_STATE; - ChipLogError(DeviceLayer, "Invalid scan type requested"); - goto exit; - } - /* Check Tizen BLE layer is initialized or not */ - if (!mFlags.Has(Flags::kTizenBLELayerInitialized)) - { - err = CHIP_ERROR_INCORRECT_STATE; - ChipLogError(DeviceLayer, "Tizen BLE layer is not yet initialized"); - goto exit; - } - - /* Acquire Chip Device Scanner */ - if (!mDeviceScanner) - mDeviceScanner = Internal::ChipDeviceScanner::Create(this); + VerifyOrExit(scanType != BleScanState::kNotScanning, + ChipLogError(Ble, "Invalid scan type requested: %d", to_underlying(scanType))); + VerifyOrExit(mFlags.Has(Flags::kTizenBLELayerInitialized), ChipLogError(Ble, "Tizen BLE layer is not yet initialized")); - if (!mDeviceScanner) - { - err = CHIP_ERROR_INTERNAL; - ChipLogError(DeviceLayer, "Failed to create BLE device scanner"); - goto exit; - } + ChipLogProgress(Ble, "Start CHIP BLE scan: timeout=%ums", System::Clock::Milliseconds32(kNewConnectionScanTimeout).count()); - /* Send StartChipScan Request to Scanner Class */ + /* Send StartScan Request to Scanner Class */ strcpy(data.service_uuid, Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR); - err = mDeviceScanner->StartChipScan(kNewConnectionScanTimeout, ScanFilterType::kServiceData, data); - VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Failed to start BLE scan")); + err = mDeviceScanner.StartScan(ScanFilterType::kServiceData, data); + VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Ble, "Failed to start BLE scan: %" CHIP_ERROR_FORMAT, err.Format())); + + err = DeviceLayer::SystemLayer().StartTimer(kNewConnectionScanTimeout, HandleScanTimeout, this); + VerifyOrExit(err == CHIP_NO_ERROR, mDeviceScanner.StopScan(); + ChipLogError(Ble, "Failed to start BLE scan timeout: %" CHIP_ERROR_FORMAT, err.Format())); - ChipLogProgress(DeviceLayer, "BLE scan initiation successful"); mBLEScanConfig.mBleScanState = scanType; return; exit: - ChipLogError(DeviceLayer, "BLE scan initiation failed: %" CHIP_ERROR_FORMAT, err.Format()); mBLEScanConfig.mBleScanState = BleScanState::kNotScanning; BleConnectionDelegate::OnConnectionError(mBLEScanConfig.mAppState, err); } +void BLEManagerImpl::HandleScanTimeout(chip::System::Layer *, void * appState) +{ + auto * manager = static_cast(appState); + manager->OnScanError(CHIP_ERROR_TIMEOUT); + manager->mDeviceScanner.StopScan(); +} + CHIP_ERROR BLEManagerImpl::CancelConnection() { - return CHIP_ERROR_NOT_IMPLEMENTED; + // If in discovery mode, stop scan. + if (mBLEScanConfig.mBleScanState != BleScanState::kNotScanning) + { + DeviceLayer::SystemLayer().CancelTimer(HandleScanTimeout, this); + mDeviceScanner.StopScan(); + } + return CHIP_NO_ERROR; } } // namespace Internal diff --git a/src/platform/Tizen/BLEManagerImpl.h b/src/platform/Tizen/BLEManagerImpl.h index 5dfee7fba75c83..c63b68aec48ae4 100644 --- a/src/platform/Tizen/BLEManagerImpl.h +++ b/src/platform/Tizen/BLEManagerImpl.h @@ -90,6 +90,9 @@ class BLEManagerImpl final : public BLEManager, friend BLEManager; public: + BLEManagerImpl() : mDeviceScanner(this) {} + ~BLEManagerImpl() = default; + CHIP_ERROR ConfigureBle(uint32_t aAdapterId, bool aIsCentral); private: @@ -137,7 +140,8 @@ class BLEManagerImpl final : public BLEManager, CHIP_ERROR CancelConnection() override; // ===== Members that implement virtual methods on ChipDeviceScannerDelegate - void OnChipDeviceScanned(void * device, const Ble::ChipBLEDeviceIdentificationInfo & info) override; + void OnDeviceScanned(const bt_adapter_le_device_scan_result_info_s & scanInfo, + const Ble::ChipBLEDeviceIdentificationInfo & info) override; void OnScanComplete() override; void OnScanError(CHIP_ERROR err) override; @@ -171,8 +175,6 @@ class BLEManagerImpl final : public BLEManager, void DriveBLEState(); - void InitiateScan(BleScanState scanType); - void AdapterStateChangedCb(int result, bt_adapter_state_e adapterState); void AdvertisingStateChangedCb(int result, bt_advertiser_h advertiser, bt_adapter_le_advertising_state_e advState); void NotificationStateChangedCb(bool notify, bt_gatt_server_h server, bt_gatt_h gattHandle); @@ -185,6 +187,10 @@ class BLEManagerImpl final : public BLEManager, static void WriteCompletedCb(int result, bt_gatt_h gattHandle, void * userData); static void CharacteristicNotificationCb(bt_gatt_h characteristic, char * value, int len, void * userData); + // ==== BLE Scan. + void InitiateScan(BleScanState scanType); + static void HandleScanTimeout(chip::System::Layer *, void * appState); + // ==== Connection. void AddConnectionData(const char * remoteAddr); void RemoveConnectionData(const char * remoteAddr); @@ -208,8 +214,8 @@ class BLEManagerImpl final : public BLEManager, // ==== Connection. CHIP_ERROR ConnectChipThing(const char * address); - void NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error); - void NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error); + void NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId); + void NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId); void NotifyHandleNewConnection(BLE_CONNECTION_OBJECT conId); void NotifyHandleConnectFailed(CHIP_ERROR error); void NotifyHandleWriteComplete(BLE_CONNECTION_OBJECT conId); @@ -232,8 +238,9 @@ class BLEManagerImpl final : public BLEManager, /* Connection Hash Table Map */ GHashTable * mConnectionMap = nullptr; + ChipDeviceScanner mDeviceScanner; BLEScanConfig mBLEScanConfig; - std::unique_ptr mDeviceScanner; + bt_gatt_client_h mGattClient = nullptr; }; diff --git a/src/platform/Tizen/ChipDeviceScanner.cpp b/src/platform/Tizen/ChipDeviceScanner.cpp index 5f334535d904fc..98018bfd88c6ef 100644 --- a/src/platform/Tizen/ChipDeviceScanner.cpp +++ b/src/platform/Tizen/ChipDeviceScanner.cpp @@ -38,24 +38,12 @@ #include #include +#include "ErrorUtils.h" + namespace chip { namespace DeviceLayer { namespace Internal { -ChipDeviceScanner::ChipDeviceScanner(ChipDeviceScannerDelegate * delegate) : mDelegate(delegate) {} - -ChipDeviceScanner::~ChipDeviceScanner() -{ - // In case scan is ongoing - StopChipScan(); - mDelegate = nullptr; -} - -std::unique_ptr ChipDeviceScanner::Create(ChipDeviceScannerDelegate * delegate) -{ - return std::make_unique(delegate); -} - static void __PrintLEScanData(const bt_adapter_le_service_data_s & data) { // Print Service UUID in the Service Data @@ -68,16 +56,15 @@ static void __PrintLEScanData(const bt_adapter_le_service_data_s & data) ChipLogByteSpan(DeviceLayer, ByteSpan(reinterpret_cast(data.service_data), data.service_data_len)); } -static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, - chip::Ble::ChipBLEDeviceIdentificationInfo & aDeviceInfo) +static bool __IsChipThingDevice(const bt_adapter_le_device_scan_result_info_s & scanInfo, + chip::Ble::ChipBLEDeviceIdentificationInfo & info) { - VerifyOrReturnError(info != nullptr, false); - int count = 0; bt_adapter_le_service_data_s * dataList = nullptr; bool isChipDevice = false; - if (bt_adapter_le_get_scan_result_service_data_list(info, BT_ADAPTER_LE_PACKET_ADVERTISING, &dataList, &count) == BT_ERROR_NONE) + if (bt_adapter_le_get_scan_result_service_data_list(&scanInfo, BT_ADAPTER_LE_PACKET_ADVERTISING, &dataList, &count) == + BT_ERROR_NONE) { for (int i = 0; i < count; i++) { @@ -85,7 +72,7 @@ static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, strcasecmp(dataList[i].service_uuid, chip::Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR) == 0) { __PrintLEScanData(dataList[i]); - memcpy(&aDeviceInfo, dataList[i].service_data, dataList[i].service_data_len); + memcpy(&info, dataList[i].service_data, dataList[i].service_data_len); isChipDevice = true; break; } @@ -96,46 +83,31 @@ static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, return isChipDevice; } -void ChipDeviceScanner::LeScanResultCb(int result, bt_adapter_le_device_scan_result_info_s * info, void * userData) +void ChipDeviceScanner::LeScanResultCb(int result, bt_adapter_le_device_scan_result_info_s * scanInfo) { - VerifyOrReturn(info != nullptr); + VerifyOrReturn(result == BT_ERROR_NONE, mDelegate->OnScanError(TizenToChipError(result))); + VerifyOrReturn(scanInfo != nullptr, mDelegate->OnScanError(CHIP_ERROR_INTERNAL)); - auto self = reinterpret_cast(userData); - chip::Ble::ChipBLEDeviceIdentificationInfo deviceInfo; + ChipLogProgress(DeviceLayer, "LE device reported: %s", scanInfo->remote_address); - ChipLogProgress(DeviceLayer, "LE device reported: %s", info->remote_address); - VerifyOrReturn(__IsChipThingDevice(info, deviceInfo), - ChipLogDetail(Ble, "Device %s does not look like a CHIP device", info->remote_address)); + chip::Ble::ChipBLEDeviceIdentificationInfo info; + VerifyOrReturn(__IsChipThingDevice(*scanInfo, info), + ChipLogDetail(Ble, "Device %s does not look like a CHIP device", scanInfo->remote_address)); // Report probable CHIP device to BLEMgrImp class - self->mDelegate->OnChipDeviceScanned(info, deviceInfo); -} - -gboolean ChipDeviceScanner::TimerExpiredCb(gpointer userData) -{ - auto self = reinterpret_cast(userData); - ChipLogProgress(DeviceLayer, "Scan Timer expired!!"); - self->StopChipScan(); - return G_SOURCE_REMOVE; + mDelegate->OnDeviceScanned(*scanInfo, info); } -CHIP_ERROR ChipDeviceScanner::TriggerScan(ChipDeviceScanner * self) +CHIP_ERROR ChipDeviceScanner::StartScanImpl() { - GAutoPtr idleSource; - int ret; - - // Trigger LE Scan - ret = bt_adapter_le_start_scan(LeScanResultCb, self); + int ret = bt_adapter_le_start_scan( + +[](int result, bt_adapter_le_device_scan_result_info_s * scanInfo, void * self) { + return reinterpret_cast(self)->LeScanResultCb(result, scanInfo); + }, + this); VerifyOrReturnValue(ret == BT_ERROR_NONE, CHIP_ERROR_INTERNAL, ChipLogError(DeviceLayer, "bt_adapter_le_start_scan() failed: %s", get_error_message(ret))); - self->mIsScanning = true; - - // Setup timer for scan timeout - idleSource = GAutoPtr(g_timeout_source_new(self->mScanTimeoutMs)); - g_source_set_callback(idleSource.get(), TimerExpiredCb, self, nullptr); - g_source_set_priority(idleSource.get(), G_PRIORITY_HIGH_IDLE); - g_source_attach(idleSource.get(), g_main_context_get_thread_default()); - + mIsScanning = true; return CHIP_NO_ERROR; } @@ -167,35 +139,32 @@ int ChipDeviceScanner::SetupScanFilter(ScanFilterType filterType, const ScanFilt return ret; } -CHIP_ERROR ChipDeviceScanner::StartChipScan(System::Clock::Timeout timeout, ScanFilterType filterType, - const ScanFilterData & filterData) +CHIP_ERROR ChipDeviceScanner::StartScan(ScanFilterType filterType, const ScanFilterData & filterData) { CHIP_ERROR err = CHIP_NO_ERROR; - ReturnErrorCodeIf(mIsScanning, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(!mIsScanning, CHIP_ERROR_INCORRECT_STATE); // Scan Filter Setup if supported: silently bypass error & do filterless scan in case of error SetupScanFilter(filterType, filterData); - mScanTimeoutMs = System::Clock::Milliseconds32(timeout).count(); - // All set to trigger LE Scan - ChipLogProgress(DeviceLayer, "Start CHIP BLE scan: timeout=%ums", mScanTimeoutMs); - err = PlatformMgrImpl().GLibMatterContextInvokeSync(TriggerScan, this); + err = PlatformMgrImpl().GLibMatterContextInvokeSync( + +[](ChipDeviceScanner * self) { return self->StartScanImpl(); }, this); SuccessOrExit(err); return CHIP_NO_ERROR; exit: ChipLogError(DeviceLayer, "Start CHIP Scan could not succeed fully! Stop Scan..."); - StopChipScan(); + StopScan(); UnRegisterScanFilter(); return err; } -CHIP_ERROR ChipDeviceScanner::StopChipScan() +CHIP_ERROR ChipDeviceScanner::StopScan() { int ret = BT_ERROR_NONE; - ReturnErrorCodeIf(!mIsScanning, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mIsScanning, CHIP_ERROR_INCORRECT_STATE); ret = bt_adapter_le_stop_scan(); if (ret != BT_ERROR_NONE) diff --git a/src/platform/Tizen/ChipDeviceScanner.h b/src/platform/Tizen/ChipDeviceScanner.h index c8ecc5bfa8e81a..ac48176be3df1d 100644 --- a/src/platform/Tizen/ChipDeviceScanner.h +++ b/src/platform/Tizen/ChipDeviceScanner.h @@ -60,16 +60,17 @@ struct ScanFilterData class ChipDeviceScannerDelegate { public: - virtual ~ChipDeviceScannerDelegate(void) {} + virtual ~ChipDeviceScannerDelegate() {} // Called when a CHIP device was found - virtual void OnChipDeviceScanned(void * device, const chip::Ble::ChipBLEDeviceIdentificationInfo & info) = 0; + virtual void OnDeviceScanned(const bt_adapter_le_device_scan_result_info_s & scanInfo, + const Ble::ChipBLEDeviceIdentificationInfo & info) = 0; // Called when a scan was completed (stopped or timed out) - virtual void OnScanComplete(void) = 0; + virtual void OnScanComplete() = 0; // Called on scan error - virtual void OnScanError(CHIP_ERROR err) = 0; + virtual void OnScanError(CHIP_ERROR) = 0; }; /// Allows scanning for CHIP devices @@ -78,38 +79,28 @@ class ChipDeviceScannerDelegate class ChipDeviceScanner { public: - ChipDeviceScanner(void){}; + ChipDeviceScanner(ChipDeviceScannerDelegate * delegate) : mDelegate(delegate){}; + ~ChipDeviceScanner() { StopScan(); } - /// NOTE: prefer to use the ::Create method instead direct constructor calling. - ChipDeviceScanner(ChipDeviceScannerDelegate * delegate); - - ~ChipDeviceScanner(void); - - /// Initiate a scan for devices, with the given timeout & scan filter data - CHIP_ERROR StartChipScan(System::Clock::Timeout timeout, ScanFilterType filterType, const ScanFilterData & filterData); + /// Initiate a scan for devices, with the given scan filter data + CHIP_ERROR StartScan(ScanFilterType filterType, const ScanFilterData & filterData); /// Stop any currently running scan - CHIP_ERROR StopChipScan(void); - - /// Create a new device scanner - /// Convenience method to allocate any required variables. - static std::unique_ptr Create(ChipDeviceScannerDelegate * delegate); + CHIP_ERROR StopScan(); private: - static void LeScanResultCb(int result, bt_adapter_le_device_scan_result_info_s * info, void * userData); - static gboolean TimerExpiredCb(gpointer user_data); - static CHIP_ERROR TriggerScan(ChipDeviceScanner * userData); + void LeScanResultCb(int result, bt_adapter_le_device_scan_result_info_s * scanInfo); + CHIP_ERROR StartScanImpl(); int CreateLEScanFilter(ScanFilterType filterType); int RegisterScanFilter(ScanFilterType filterType, const ScanFilterData & filterData); int SetupScanFilter(ScanFilterType filterType, const ScanFilterData & filterData); void UnRegisterScanFilter(); - ChipDeviceScannerDelegate * mDelegate = nullptr; - bool mIsScanning = false; - bool mIsStopping = false; - unsigned int mScanTimeoutMs = 10000; - bt_scan_filter_h mScanFilter = nullptr; + ChipDeviceScannerDelegate * mDelegate; + bool mIsScanning = false; + bool mIsStopping = false; + bt_scan_filter_h mScanFilter = nullptr; }; } // namespace Internal From dad61543ed6e53f38182db01a9cc6d9ea2dd51ad Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 7 Jun 2024 10:10:19 -0400 Subject: [PATCH 079/162] Stop using MSEC_PER_SEC without directly including relevant headers. (#33795) And stop doing time math by hand, use duration_cast. Fixes https://github.com/project-chip/connectedhomeip/issues/33793 --- src/darwin/Framework/CHIP/MTRConversion.h | 7 +++++++ src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRConversion.h b/src/darwin/Framework/CHIP/MTRConversion.h index b14f4c240f9f67..b0cf1afea40ad1 100644 --- a/src/darwin/Framework/CHIP/MTRConversion.h +++ b/src/darwin/Framework/CHIP/MTRConversion.h @@ -19,6 +19,7 @@ #import +#include #include #include #include @@ -40,6 +41,12 @@ inline NSDate * MatterEpochSecondsAsDate(uint32_t matterEpochSeconds) return [NSDate dateWithTimeIntervalSince1970:(chip::kChipEpochSecondsSinceUnixEpoch + (NSTimeInterval) matterEpochSeconds)]; } +template +inline NSTimeInterval DurationToTimeInterval(std::chrono::duration duration) +{ + return std::chrono::duration(duration).count(); +} + /** * Returns whether the conversion could be performed. Will return false if the * passed-in date is our of the range representable as a Matter epoch-s value. diff --git a/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm index 3fa1c45028adcd..8f712ab76d3b6b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm @@ -17,6 +17,7 @@ #import "MTRDeviceConnectionBridge.h" #import "MTRBaseDevice_Internal.h" +#import "MTRConversion.h" #import "MTRError_Internal.h" void MTRDeviceConnectionBridge::OnConnected( @@ -31,7 +32,7 @@ { NSNumber * retryDelay; if (failureInfo.requestedBusyDelay.HasValue()) { - retryDelay = @(static_cast(failureInfo.requestedBusyDelay.Value().count()) / MSEC_PER_SEC); + retryDelay = @(DurationToTimeInterval(failureInfo.requestedBusyDelay.Value())); } auto * object = static_cast(context); object->mCompletionHandler(nil, chip::NullOptional, [MTRError errorForCHIPErrorCode:failureInfo.error], retryDelay); From 8f214329aa88e2d1f8f5f315fe03702b0953134f Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 7 Jun 2024 10:14:40 -0400 Subject: [PATCH 080/162] Docs: Add autolinks to daily fail summary (#33791) --- docs/ci-cd/tools/daily_fail_summary.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/ci-cd/tools/daily_fail_summary.md b/docs/ci-cd/tools/daily_fail_summary.md index 8855a7a3de6086..290dfc313929c8 100644 --- a/docs/ci-cd/tools/daily_fail_summary.md +++ b/docs/ci-cd/tools/daily_fail_summary.md @@ -3,20 +3,20 @@ #### Source Workflow: -https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/recent_fail_summary.yaml + Script: -https://github.com/project-chip/connectedhomeip/blob/master/scripts/tools/summarize_fail.py + Fail Definitions: -https://github.com/project-chip/connectedhomeip/blob/master/scripts/tools/build_fail_definitions.yaml + #### Summary Runs once per day; takes inventory of the previous day's workflow runs and parses them for fail statistics. Creates temporarily cached artifacts for easy data parsing. Also saves a daily pass percentage list of all workflows at -https://github.com/project-chip/connectedhomeip/blob/daily_pass_percentage/docs/daily_pass_percentage.md. +. Fail definitions can be added to the file defined above to allow fast root cause determination of any fail with an error message. From 5db170117d3afd5b4c815c1c181cc8646779cc5a Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Fri, 7 Jun 2024 19:47:48 +0530 Subject: [PATCH 081/162] removing the 917 SoC condition for the 917 SoC (#33804) --- src/platform/silabs/SilabsConfig.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/platform/silabs/SilabsConfig.cpp b/src/platform/silabs/SilabsConfig.cpp index 356aa4c39b1703..d78fcf65b3444c 100644 --- a/src/platform/silabs/SilabsConfig.cpp +++ b/src/platform/silabs/SilabsConfig.cpp @@ -33,7 +33,6 @@ #include #include -#ifndef SLI_SI91X_MCU_INTERFACE // 917soc/wifi-sdk implements the same nvm3 lock/unlock mechanism and it currently can't be overide. #include #include // Substitute the GSDK weak nvm3_lockBegin and nvm3_lockEnd @@ -58,7 +57,6 @@ void nvm3_lockEnd(void) VerifyOrDie(nvm3_Sem != NULL); xSemaphoreGive(nvm3_Sem); } -#endif // !SLI_SI91X_MCU_INTERFACE namespace chip { namespace DeviceLayer { @@ -78,9 +76,7 @@ CHIP_ERROR SilabsConfig::Init() void SilabsConfig::DeInit() { -#ifndef SLI_SI91X_MCU_INTERFACE vSemaphoreDelete(nvm3_Sem); -#endif // !SLI_SI91X_MCU_INTERFACE nvm3_close(nvm3_defaultHandle); } From d6c29d2156e3dfcbf02b38bbec8aa88af3d0d877 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 7 Jun 2024 14:19:10 -0400 Subject: [PATCH 082/162] Python test runner: Add non-printing CI option (#33740) * Python test runner: Add non-printing CI option The CI files for the REPL tests are HUGE and they make it nearly impossible to find the error you want. This PR adds a CI flag where the output is only sent in case of a test failure. * REPL tests: Add flag to tests * add test failure * Restyled by autopep8 * Revert "add test failure" This reverts commit 9ee6a2e5cbd469940c402b019343c99ab298f3d4. * change "ci" flag to "quiet" --------- Co-authored-by: Restyled.io --- .github/workflows/tests.yaml | 160 +++++++++++++++---------------- scripts/tests/run_python_test.py | 41 +++++--- 2 files changed, 106 insertions(+), 95 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 78c6d7347725ef..dccd846affddc1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -477,89 +477,89 @@ jobs: - name: Run Tests run: | mkdir -p out/trace_data - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script-args "--log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_AccessChecker.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_CGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_7.py" --script-args "--storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DGGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_12.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceBasicComposition.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceConformance.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --bool-arg ignore_in_progress:True allow_provisional:True --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --tests test_TC_IDM_10_2"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_ICDManagementCluster.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_PWRTL_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RR_1_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_SC_3_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_10.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_11.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_12.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_13.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_7.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_8.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_9.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_TestEventTrigger.py" --script-args "--storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TestBatchInvoke.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script-args "--log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_AccessChecker.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_CGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_7.py" --script-args "--storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DGGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_12.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceBasicComposition.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceConformance.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --bool-arg ignore_in_progress:True allow_provisional:True --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --tests test_TC_IDM_10_2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_ICDManagementCluster.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_PWRTL_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RR_1_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_SC_3_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_10.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_11.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_12.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_13.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_7.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_8.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_9.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_TestEventTrigger.py" --script-args "--storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TestBatchInvoke.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestConformanceSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TestGroupTableReports.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TestGroupTableReports.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPCREDS_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OVENOPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPCREDS_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OVENOPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_DA_1_2.py' scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_ICDM_2_1.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestIdChecks.py' @@ -624,7 +624,7 @@ jobs: " - name: Run Tests run: | - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} diff --git a/scripts/tests/run_python_test.py b/scripts/tests/run_python_test.py index 1a9b54a3ad6736..5d2afc31ae21b7 100755 --- a/scripts/tests/run_python_test.py +++ b/scripts/tests/run_python_test.py @@ -15,6 +15,7 @@ # limitations under the License. import datetime +import io import logging import os import os.path @@ -38,7 +39,7 @@ MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" -def EnqueueLogOutput(fp, tag, q): +def EnqueueLogOutput(fp, tag, output_stream, q): for line in iter(fp.readline, b''): timestamp = time.time() if len(line) > len('[1646290606.901990]') and line[0:1] == b'[': @@ -47,24 +48,24 @@ def EnqueueLogOutput(fp, tag, q): line = line[19:] except Exception: pass - sys.stdout.buffer.write( + output_stream.write( (f"[{datetime.datetime.fromtimestamp(timestamp).isoformat(sep=' ')}]").encode() + tag + line) sys.stdout.flush() fp.close() -def RedirectQueueThread(fp, tag, queue) -> threading.Thread: +def RedirectQueueThread(fp, tag, stream_output, queue) -> threading.Thread: log_queue_thread = threading.Thread(target=EnqueueLogOutput, args=( - fp, tag, queue)) + fp, tag, stream_output, queue)) log_queue_thread.start() return log_queue_thread -def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: str, process: subprocess.Popen, queue: queue.Queue): +def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: str, process: subprocess.Popen, stream_output, queue: queue.Queue): thread_list.append(RedirectQueueThread(process.stdout, - (f"[{tag}][{Fore.YELLOW}STDOUT{Style.RESET_ALL}]").encode(), queue)) + (f"[{tag}][{Fore.YELLOW}STDOUT{Style.RESET_ALL}]").encode(), stream_output, queue)) thread_list.append(RedirectQueueThread(process.stderr, - (f"[{tag}][{Fore.RED}STDERR{Style.RESET_ALL}]").encode(), queue)) + (f"[{tag}][{Fore.RED}STDERR{Style.RESET_ALL}]").encode(), stream_output, queue)) @click.command() @@ -87,7 +88,8 @@ def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: st help='Script arguments, can use placeholders like {SCRIPT_BASE_NAME}.') @click.option("--script-gdb", is_flag=True, help='Run script through gdb') -def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: str, script: str, script_args: str, script_gdb: bool): +@click.option("--quiet", is_flag=True, help="Do not print output from passing tests. Use this flag in CI to keep github log sizes manageable.") +def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: str, script: str, script_args: str, script_gdb: bool, quiet: bool): app_args = app_args.replace('{SCRIPT_BASE_NAME}', os.path.splitext(os.path.basename(script))[0]) script_args = script_args.replace('{SCRIPT_BASE_NAME}', os.path.splitext(os.path.basename(script))[0]) @@ -127,6 +129,10 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st app_process = None app_pid = 0 + stream_output = sys.stdout.buffer + if quiet: + stream_output = io.BytesIO() + if app: if not os.path.exists(app): if app is None: @@ -137,7 +143,7 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st app_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) app_pid = app_process.pid DumpProgramOutputToQueue( - log_cooking_threads, Fore.GREEN + "APP " + Style.RESET_ALL, app_process, log_queue) + log_cooking_threads, Fore.GREEN + "APP " + Style.RESET_ALL, app_process, stream_output, log_queue) script_command = [script, "--paa-trust-store-path", os.path.join(DEFAULT_CHIP_ROOT, MATTER_DEVELOPMENT_PAA_ROOT_CERTS), '--log-format', '%(message)s', "--app-pid", str(app_pid)] + shlex.split(script_args) @@ -159,7 +165,7 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st test_script_process = subprocess.Popen( final_script_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) DumpProgramOutputToQueue(log_cooking_threads, Fore.GREEN + "TEST" + Style.RESET_ALL, - test_script_process, log_queue) + test_script_process, stream_output, log_queue) test_script_exit_code = test_script_process.wait() @@ -177,11 +183,16 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st for thread in log_cooking_threads: thread.join() - if test_script_exit_code != 0: - sys.exit(test_script_exit_code) - else: - # We expect both app and test script should exit with 0 - sys.exit(test_app_exit_code) + # We expect both app and test script should exit with 0 + exit_code = test_script_exit_code if test_script_exit_code != 0 else test_app_exit_code + + if quiet: + if exit_code: + sys.stdout.write(stream_output.getvalue().decode('utf-8')) + else: + logging.info("Test completed successfully") + + sys.exit(exit_code) if __name__ == '__main__': From 9b7e30059efa24e7f0bef86f29ea266b5122f03c Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 7 Jun 2024 14:59:40 -0400 Subject: [PATCH 083/162] Python testing: move PICS functions (#33759) * Python testing: move PICS functions We're going to need these for some new tooling, so moving them into their own file to avoid needing to pull in the entirety of matter_testing_support Only changes are moves and function renames. test: TC_pics_checker.py * Restyled by autopep8 * Restyled by isort * fix imports * Hey, I wrote a unit test Didn't update it though because I forgot it existed. Thanks, CI. It passes now. * Restyled by isort --------- Co-authored-by: Restyled.io --- src/python_testing/TC_pics_checker.py | 25 ++---- .../TestMatterTestingSupport.py | 4 +- src/python_testing/matter_testing_support.py | 47 +--------- src/python_testing/pics_support.py | 89 +++++++++++++++++++ 4 files changed, 97 insertions(+), 68 deletions(-) create mode 100644 src/python_testing/pics_support.py diff --git a/src/python_testing/TC_pics_checker.py b/src/python_testing/TC_pics_checker.py index 87107196916cd3..4e503edd101a01 100644 --- a/src/python_testing/TC_pics_checker.py +++ b/src/python_testing/TC_pics_checker.py @@ -22,25 +22,10 @@ from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, FeaturePathLocation, MatterBaseTest, TestStep, async_test_body, default_matter_test_main) from mobly import asserts +from pics_support import accepted_cmd_pics_str, attribute_pics_str, feature_pics_str, generated_cmd_pics_str from spec_parsing_support import build_xml_clusters -def attribute_pics(pics_base: str, id: int) -> str: - return f'{pics_base}.S.A{id:04x}' - - -def accepted_cmd_pics(pics_base: str, id: int) -> str: - return f'{pics_base}.S.C{id:02x}.Rsp' - - -def generated_cmd_pics(pics_base: str, id: int) -> str: - return f'{pics_base}.S.C{id:02x}.Tx' - - -def feature_pics(pics_base: str, bit: int) -> str: - return f'{pics_base}.S.F{bit:02x}' - - class TC_PICS_Checker(MatterBaseTest, BasicCompositionTests): @async_test_body async def setup_class(self): @@ -64,14 +49,14 @@ def _add_pics_for_lists(self, cluster_id: int, attribute_id_of_element_list: Glo try: if attribute_id_of_element_list == GlobalAttributeIds.ATTRIBUTE_LIST_ID: all_spec_elements_to_check = Clusters.ClusterObjects.ALL_ATTRIBUTES[cluster_id] - pics_mapper = attribute_pics + pics_mapper = attribute_pics_str elif attribute_id_of_element_list == GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID: all_spec_elements_to_check = Clusters.ClusterObjects.ALL_ACCEPTED_COMMANDS[cluster_id] - pics_mapper = accepted_cmd_pics + pics_mapper = accepted_cmd_pics_str elif attribute_id_of_element_list == GlobalAttributeIds.GENERATED_COMMAND_LIST_ID: all_spec_elements_to_check = Clusters.ClusterObjects.ALL_GENERATED_COMMANDS[cluster_id] - pics_mapper = generated_cmd_pics + pics_mapper = generated_cmd_pics_str else: asserts.fail("add_pics_for_list function called for non-list attribute") except KeyError: @@ -177,7 +162,7 @@ def test_TC_IDM_10_4(self): self.record_warning("PICS check", location=location, problem=f"Unable to parse feature mask {feature_mask} from cluster {cluster}") continue - pics = feature_pics(pics_base, feature_bit) + pics = feature_pics_str(pics_base, feature_bit) if feature_mask & feature_map: required = True else: diff --git a/src/python_testing/TestMatterTestingSupport.py b/src/python_testing/TestMatterTestingSupport.py index 56f105b8b904c0..eba9dc458383e5 100644 --- a/src/python_testing/TestMatterTestingSupport.py +++ b/src/python_testing/TestMatterTestingSupport.py @@ -24,9 +24,9 @@ from chip.clusters.Types import Nullable, NullValue from chip.tlv import uint from matter_testing_support import (MatterBaseTest, async_test_body, compare_time, default_matter_test_main, - get_wait_seconds_from_set_time, parse_pics, parse_pics_xml, type_matches, - utc_time_in_matter_epoch) + get_wait_seconds_from_set_time, type_matches, utc_time_in_matter_epoch) from mobly import asserts, signals +from pics_support import parse_pics, parse_pics_xml from taglist_and_topology_test_support import (TagProblem, create_device_type_list_for_root, create_device_type_lists, find_tag_list_problems, find_tree_roots, flat_list_ok, get_all_children, get_direct_children_of_root, parts_list_cycles, separate_endpoint_types) diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 4861cae7ea8c61..c342d87ef2cf46 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -18,7 +18,6 @@ import argparse import asyncio import builtins -import glob import inspect import json import logging @@ -30,7 +29,6 @@ import sys import typing import uuid -import xml.etree.ElementTree as ET from binascii import hexlify, unhexlify from dataclasses import asdict as dataclass_asdict from dataclasses import dataclass, field @@ -64,6 +62,7 @@ from mobly import asserts, base_test, signals, utils from mobly.config_parser import ENV_MOBLY_LOGPATH, TestRunConfig from mobly.test_runner import TestRunner +from pics_support import read_pics_from_file try: from matter_yamltests.hooks import TestRunnerHooks @@ -142,50 +141,6 @@ def get_default_paa_trust_store(root_path: pathlib.Path) -> pathlib.Path: return pathlib.Path.cwd() -def parse_pics(lines: typing.List[str]) -> dict[str, bool]: - pics = {} - for raw in lines: - line, _, _ = raw.partition("#") - line = line.strip() - - if not line: - continue - - key, _, val = line.partition("=") - val = val.strip() - if val not in ["1", "0"]: - raise ValueError('PICS {} must have a value of 0 or 1'.format(key)) - - pics[key.strip()] = (val == "1") - return pics - - -def parse_pics_xml(contents: str) -> dict[str, bool]: - pics = {} - mytree = ET.fromstring(contents) - for pi in mytree.iter('picsItem'): - name = pi.find('itemNumber').text - support = pi.find('support').text - pics[name] = int(json.loads(support.lower())) == 1 - return pics - - -def read_pics_from_file(path: str) -> dict[str, bool]: - """ Reads a dictionary of PICS from a file (ci format) or directory (xml format). """ - if os.path.isdir(os.path.abspath(path)): - pics_dict = {} - for filename in glob.glob(f'{path}/*.xml'): - with open(filename, 'r') as f: - contents = f.read() - pics_dict.update(parse_pics_xml(contents)) - return pics_dict - - else: - with open(path, 'r') as f: - lines = f.readlines() - return parse_pics(lines) - - def type_matches(received_value, desired_type): """ Checks if the value received matches the expected type. diff --git a/src/python_testing/pics_support.py b/src/python_testing/pics_support.py new file mode 100644 index 00000000000000..62e04f7dfa1cdb --- /dev/null +++ b/src/python_testing/pics_support.py @@ -0,0 +1,89 @@ +# +# Copyright (c) 2024 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. +# +import glob +import json +import os +import typing +import xml.etree.ElementTree as ET + + +def attribute_pics_str(pics_base: str, id: int) -> str: + return f'{pics_base}.S.A{id:04x}' + + +def accepted_cmd_pics_str(pics_base: str, id: int) -> str: + return f'{pics_base}.S.C{id:02x}.Rsp' + + +def generated_cmd_pics_str(pics_base: str, id: int) -> str: + return f'{pics_base}.S.C{id:02x}.Tx' + + +def feature_pics_str(pics_base: str, bit: int) -> str: + return f'{pics_base}.S.F{bit:02x}' + + +def server_pics_str(pics_base: str) -> str: + return f'{pics_base}.S' + + +def client_pics_str(pics_base: str) -> str: + return f'{pics_base}.C' + + +def parse_pics(lines: typing.List[str]) -> dict[str, bool]: + pics = {} + for raw in lines: + line, _, _ = raw.partition("#") + line = line.strip() + + if not line: + continue + + key, _, val = line.partition("=") + val = val.strip() + if val not in ["1", "0"]: + raise ValueError('PICS {} must have a value of 0 or 1'.format(key)) + + pics[key.strip()] = (val == "1") + return pics + + +def parse_pics_xml(contents: str) -> dict[str, bool]: + pics = {} + mytree = ET.fromstring(contents) + for pi in mytree.iter('picsItem'): + name = pi.find('itemNumber').text + support = pi.find('support').text + pics[name] = int(json.loads(support.lower())) == 1 + return pics + + +def read_pics_from_file(path: str) -> dict[str, bool]: + """ Reads a dictionary of PICS from a file (ci format) or directory (xml format). """ + if os.path.isdir(os.path.abspath(path)): + pics_dict = {} + for filename in glob.glob(f'{path}/*.xml'): + with open(filename, 'r') as f: + contents = f.read() + pics_dict.update(parse_pics_xml(contents)) + return pics_dict + + else: + with open(path, 'r') as f: + lines = f.readlines() + return parse_pics(lines) From c9bcd2245447c072d8b682d2e4c2167912a3f367 Mon Sep 17 00:00:00 2001 From: Philip Gregor <147669098+pgregorr-amazon@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:02:05 -0700 Subject: [PATCH 084/162] Linux tv-casting-app enable AccountLogin cluster (#33766) --- ...ationBasicReadVendorIDExampleFragment.java | 6 +++++ ...ntentLauncherLaunchURLExampleFragment.java | 6 +++++ ...ubscribeToCurrentStateExampleFragment.java | 5 +++++ .../tv-casting-common/clusters/Clusters.h | 22 +++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java index b64d10ce811332..e0a188455877c3 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java @@ -77,6 +77,12 @@ public View onCreateView( v -> { Endpoint endpoint; if (useCommissionerGeneratedPasscode) { + // For the example Commissioner-Generated passcode commissioning flow, run demo + // interactions with the Endpoint with ID DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1. For this + // flow, we commissioned with the Target Content Application with Vendor ID 1111. Since + // this target content application does not report its Endpoint's Vendor IDs, we find + // the desired endpoint based on the Endpoint ID. See + // connectedhomeip/examples/tv-app/tv-common/include/AppTv.h. endpoint = EndpointSelectorExample.selectEndpointById( selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java index e1cfc4a456112b..9d31619fe1fc86 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java @@ -77,6 +77,12 @@ public View onCreateView( v -> { Endpoint endpoint; if (useCommissionerGeneratedPasscode) { + // For the example Commissioner-Generated passcode commissioning flow, run demo + // interactions with the Endpoint with ID DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1. For this + // flow, we commissioned with the Target Content Application with Vendor ID 1111. Since + // this target content application does not report its Endpoint's Vendor IDs, we find + // the desired endpoint based on the Endpoint ID. See + // connectedhomeip/examples/tv-app/tv-common/include/AppTv.h. endpoint = EndpointSelectorExample.selectEndpointById( selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java index cd5bbba14af2ed..882fc261f67e45 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java @@ -79,6 +79,11 @@ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Endpoint endpoint; if (useCommissionerGeneratedPasscode) { + // For the example Commissioner-Generated passcode commissioning flow, run demo interactions + // with the Endpoint with ID DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1. For this flow, we + // commissioned with the Target Content Application with Vendor ID 1111. Since this target + // content application does not report its Endpoint's Vendor IDs, we find the desired endpoint + // based on the Endpoint ID. See connectedhomeip/examples/tv-app/tv-common/include/AppTv.h. endpoint = EndpointSelectorExample.selectEndpointById( selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); diff --git a/examples/tv-casting-app/tv-casting-common/clusters/Clusters.h b/examples/tv-casting-app/tv-casting-common/clusters/Clusters.h index 2da2f61e4825aa..acaa9d768e3246 100644 --- a/examples/tv-casting-app/tv-casting-common/clusters/Clusters.h +++ b/examples/tv-casting-app/tv-casting-common/clusters/Clusters.h @@ -67,6 +67,28 @@ class ApplicationBasicCluster : public core::BaseCluster }; }; // namespace application_basic +namespace account_login { +class AccountLoginCluster : public core::BaseCluster +{ +public: + AccountLoginCluster(memory::Weak endpoint) : core::BaseCluster(endpoint) {} + + void SetUp() + { + ChipLogProgress(AppServer, "Setting up AccountLoginCluster on EndpointId: %d", GetEndpoint().lock()->GetId()); + + RegisterCommand(chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Id, + new core::Command(GetEndpoint())); + RegisterCommand(chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Id, + new core::Command(GetEndpoint())); + RegisterCommand(chip::app::Clusters::AccountLogin::Commands::Login::Id, + new core::Command(GetEndpoint())); + RegisterCommand(chip::app::Clusters::AccountLogin::Commands::Logout::Id, + new core::Command(GetEndpoint())); + } +}; +}; // namespace account_login + namespace application_launcher { class ApplicationLauncherCluster : public core::BaseCluster { From c1a63916d8e2f634c172fc283f6ed475d1ce63d3 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 7 Jun 2024 16:57:13 -0400 Subject: [PATCH 085/162] Update more Darwin availability annotations. (#33810) --- src/darwin/Framework/CHIP/MTRDevice.h | 2 +- src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h | 2 +- .../Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.h b/src/darwin/Framework/CHIP/MTRDevice.h index d9555a9633dc9d..08aae192468337 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.h +++ b/src/darwin/Framework/CHIP/MTRDevice.h @@ -107,7 +107,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * * nil if no such estimate is available. Otherwise, the NSNumber stores an NSTimeInterval. */ -@property (nonatomic, readonly, nullable, copy) NSNumber * estimatedSubscriptionLatency MTR_NEWLY_AVAILABLE; +@property (nonatomic, readonly, nullable, copy) NSNumber * estimatedSubscriptionLatency MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); /** * Set the delegate to receive asynchronous callbacks about the device. diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h index 548f1c64714f80..ffccc18b0398a4 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h @@ -84,7 +84,7 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) * * If this value is 0, the maximum subscription establishments allowed at a time will be set to 1. */ -@property (nonatomic, assign) NSUInteger concurrentSubscriptionEstablishmentsAllowedOnThread MTR_NEWLY_AVAILABLE; +@property (nonatomic, assign) NSUInteger concurrentSubscriptionEstablishmentsAllowedOnThread MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); /** * Sets the storage behavior configuration - see MTRDeviceStorageBehaviorConfiguration.h for details diff --git a/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h b/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h index 30ea957cd3987d..fb835c1cc44ae0 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h +++ b/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN * Class that configures how MTRDevice objects persist its attributes to storage, so as to not * overwhelm the underlying storage system. */ -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) @interface MTRDeviceStorageBehaviorConfiguration : NSObject /** From 31d10bca62f8114cb98a7d0d387dc5936f65099c Mon Sep 17 00:00:00 2001 From: cdj <45139296+DejinChen@users.noreply.github.com> Date: Sat, 8 Jun 2024 13:28:26 +0800 Subject: [PATCH 086/162] Added endpoint id for Thread network commissioning instance (#33685) --- src/platform/BUILD.gn | 8 ++++++++ .../GenericThreadStackManagerImpl_OpenThread.hpp | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 97365a2ee72e0f..474e3c17ce284b 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -85,6 +85,9 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { # devices with multiple radios that have different sleep behavior for # different radios. chip_device_config_enable_dynamic_mrp_config = false + + # Define the default endpoint id for the generic Thread network commissioning instance + chip_device_config_thread_network_endpoint_id = 0 } if (chip_stack_lock_tracking == "auto") { @@ -389,6 +392,11 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { defines += [ "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}" ] + if (chip_enable_openthread && chip_device_platform != "linux" && + chip_device_platform != "tizen" && chip_device_platform != "webos") { + defines += [ "CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID=${chip_device_config_thread_network_endpoint_id}" ] + } + visibility = [ ":platform_config_header", "${chip_root}/src/ble:ble_config_header", diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index cf1894cf93fc74..2056699d77c8c0 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -76,7 +76,8 @@ static_assert(OPENTHREAD_API_VERSION >= 219, "OpenThread version too old"); namespace { #ifndef _NO_NETWORK_COMMISSIONING_DRIVER_ NetworkCommissioning::GenericThreadDriver sGenericThreadDriver; -app::Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(0 /* Endpoint Id */, &sGenericThreadDriver); +app::Clusters::NetworkCommissioning::Instance + sThreadNetworkCommissioningInstance(CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID /* Endpoint Id */, &sGenericThreadDriver); #endif void initNetworkCommissioningThreadDriver(void) From 13b502dad6f44f282387b6467db4db4ab5604817 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Sat, 8 Jun 2024 01:31:40 -0400 Subject: [PATCH 087/162] Post-merge updates for IM/DM separation (#33730) * Some cleanup logic for event generation - naming and return values as eventid is not the same as event number * Comment fix * More naming updates * Several comment updates and renamed RequestContext to ActionContext * Restyle * Rename to InteractionModelContext * one more rename * Fix typo * Fix tests to compile * More renames of actions to context * One more comment added * Restyle * make clang-tidy happy * Operator== exists on optional ... make use of that directly * Update src/app/interaction-model/Events.h Co-authored-by: Boris Zbarsky * Update src/app/interaction-model/IterationTypes.h Co-authored-by: Boris Zbarsky * Update src/app/interaction-model/Paths.h Co-authored-by: Boris Zbarsky * Comment update --------- Co-authored-by: Andrei Litvin Co-authored-by: Boris Zbarsky --- .../{RequestContext.h => ActionContext.h} | 8 ++-- src/app/interaction-model/BUILD.gn | 4 +- .../{Actions.h => Context.h} | 10 ++-- src/app/interaction-model/Events.h | 46 +++++++++++-------- src/app/interaction-model/InvokeResponder.h | 2 +- src/app/interaction-model/IterationTypes.h | 9 +++- src/app/interaction-model/Model.h | 20 ++++---- src/app/interaction-model/OperationTypes.h | 6 +-- src/app/interaction-model/Paths.h | 16 +++---- .../tests/TestEventEmitting.cpp | 11 ++--- 10 files changed, 72 insertions(+), 60 deletions(-) rename src/app/interaction-model/{RequestContext.h => ActionContext.h} (87%) rename src/app/interaction-model/{Actions.h => Context.h} (74%) diff --git a/src/app/interaction-model/RequestContext.h b/src/app/interaction-model/ActionContext.h similarity index 87% rename from src/app/interaction-model/RequestContext.h rename to src/app/interaction-model/ActionContext.h index 74fa9af9da0fc8..bfc2555870c780 100644 --- a/src/app/interaction-model/RequestContext.h +++ b/src/app/interaction-model/ActionContext.h @@ -22,13 +22,13 @@ namespace chip { namespace app { namespace InteractionModel { -// Context for a currently executing request -class RequestContext +// Context for a currently executing action +class ActionContext { public: - virtual ~RequestContext() = default; + virtual ~ActionContext() = default; - /// Valid ONLY during synchronous handling of a Read/Write/Invoke + /// Valid ONLY during synchronous handling of an action. /// /// Used sparingly, however some operations will require these. An example /// usage is "Operational Credentials aborting communications on removed fabrics" diff --git a/src/app/interaction-model/BUILD.gn b/src/app/interaction-model/BUILD.gn index c91c2aedac633e..a0967289c6c65c 100644 --- a/src/app/interaction-model/BUILD.gn +++ b/src/app/interaction-model/BUILD.gn @@ -15,14 +15,14 @@ import("//build_overrides/chip.gni") source_set("interaction-model") { sources = [ - "Actions.h", + "ActionContext.h", + "Context.h", "Events.h", "InvokeResponder.h", "IterationTypes.h", "Model.h", "OperationTypes.h", "Paths.h", - "RequestContext.h", ] public_deps = [ diff --git a/src/app/interaction-model/Actions.h b/src/app/interaction-model/Context.h similarity index 74% rename from src/app/interaction-model/Actions.h rename to src/app/interaction-model/Context.h index 62021fbf7ccd32..5f7f442664ff20 100644 --- a/src/app/interaction-model/Actions.h +++ b/src/app/interaction-model/Context.h @@ -16,20 +16,24 @@ */ #pragma once +#include #include #include -#include namespace chip { namespace app { namespace InteractionModel { /// Data provided to data models in order to interface with the interaction model environment. -struct InteractionModelActions +/// +/// Provides callback-style functionality to notify the interaction model of changes +/// (e.g. using paths to notify of attribute data changes or events to generate events) +/// as well as fetching current state (via actionContext) +struct InteractionModelContext { Events * events; Paths * paths; - RequestContext * requestContext; + ActionContext * actionContext; }; } // namespace InteractionModel diff --git a/src/app/interaction-model/Events.h b/src/app/interaction-model/Events.h index 255a55e97ee465..0fc3fc56b974bd 100644 --- a/src/app/interaction-model/Events.h +++ b/src/app/interaction-model/Events.h @@ -24,6 +24,7 @@ #include #include +#include #include namespace chip { @@ -32,10 +33,10 @@ namespace InteractionModel { namespace internal { template -class SimpleEventLoggingDelegate : public EventLoggingDelegate +class SimpleEventPayloadWriter : public EventLoggingDelegate { public: - SimpleEventLoggingDelegate(const T & aEventData) : mEventData(aEventData){}; + SimpleEventPayloadWriter(const T & aEventData) : mEventData(aEventData){}; CHIP_ERROR WriteEvent(chip::TLV::TLVWriter & aWriter) final override { return DataModel::Encode(aWriter, TLV::ContextTag(EventDataIB::Tag::kData), mEventData); @@ -45,22 +46,22 @@ class SimpleEventLoggingDelegate : public EventLoggingDelegate const T & mEventData; }; -template ::value, bool> = true> -EventNumber GenerateEvent(E & emittor, const T & aEventData, EndpointId aEndpoint) +template ::value, bool> = true> +std::optional GenerateEvent(G & generator, const T & aEventData, EndpointId aEndpoint) { - internal::SimpleEventLoggingDelegate eventData(aEventData); + internal::SimpleEventPayloadWriter eventPayloadWriter(aEventData); ConcreteEventPath path(aEndpoint, aEventData.GetClusterId(), aEventData.GetEventId()); EventOptions eventOptions; eventOptions.mPath = path; eventOptions.mPriority = aEventData.GetPriorityLevel(); eventOptions.mFabricIndex = aEventData.GetFabricIndex(); - // this skips logging the event if it's fabric-scoped but no fabric association exists yet. - + // this skips generating the event if it is fabric-scoped but the provided event data is not + // associated with any fabric. if (eventOptions.mFabricIndex == kUndefinedFabricIndex) { ChipLogError(EventLogging, "Event encode failure: no fabric index for fabric scoped event"); - return kInvalidEventId; + return std::nullopt; } // @@ -72,30 +73,30 @@ EventNumber GenerateEvent(E & emittor, const T & aEventData, EndpointId aEndpoin // and used to match against the accessing fabric. // EventNumber eventNumber; - CHIP_ERROR err = emittor.GenerateEvent(&eventData, eventOptions, eventNumber); + CHIP_ERROR err = generator.GenerateEvent(&eventPayloadWriter, eventOptions, eventNumber); if (err != CHIP_NO_ERROR) { - ChipLogError(EventLogging, "Failed to log event: %" CHIP_ERROR_FORMAT, err.Format()); - return kInvalidEventId; + ChipLogError(EventLogging, "Failed to generate event: %" CHIP_ERROR_FORMAT, err.Format()); + return std::nullopt; } return eventNumber; } -template ::value, bool> = true> -EventNumber GenerateEvent(E & emittor, const T & aEventData, EndpointId endpointId) +template ::value, bool> = true> +std::optional GenerateEvent(G & generator, const T & aEventData, EndpointId endpointId) { - internal::SimpleEventLoggingDelegate eventData(aEventData); + internal::SimpleEventPayloadWriter eventPayloadWriter(aEventData); ConcreteEventPath path(endpointId, aEventData.GetClusterId(), aEventData.GetEventId()); EventOptions eventOptions; eventOptions.mPath = path; eventOptions.mPriority = aEventData.GetPriorityLevel(); EventNumber eventNumber; - CHIP_ERROR err = emittor.GenerateEvent(&eventData, eventOptions, eventNumber); + CHIP_ERROR err = generator.GenerateEvent(&eventPayloadWriter, eventOptions, eventNumber); if (err != CHIP_NO_ERROR) { - ChipLogError(EventLogging, "Failed to log event: %" CHIP_ERROR_FORMAT, err.Format()); - return kInvalidEventId; + ChipLogError(EventLogging, "Failed to generate event: %" CHIP_ERROR_FORMAT, err.Format()); + return std::nullopt; } return eventNumber; @@ -103,6 +104,10 @@ EventNumber GenerateEvent(E & emittor, const T & aEventData, EndpointId endpoint } // namespace internal +/// Exposes event access capabilities. +/// +/// Allows callers to "generate events" which effectively notifies of an event having +/// ocurred. class Events { public: @@ -113,13 +118,14 @@ class Events /// Events are generally expected to be sent to subscribed clients and also /// be available for read later until they get overwritten by new events /// that are being generated. - virtual CHIP_ERROR GenerateEvent(EventLoggingDelegate * eventContentWriter, const EventOptions & options, + virtual CHIP_ERROR GenerateEvent(EventLoggingDelegate * eventPayloadWriter, const EventOptions & options, EventNumber & generatedEventNumber) = 0; // Convenience methods for event logging using cluster-object structures - // On error, these log and return kInvalidEventId + // + // On error, these log and return nullopt. template - EventNumber GenerateEvent(const T & eventData, EndpointId endpointId) + std::optional GenerateEvent(const T & eventData, EndpointId endpointId) { return internal::GenerateEvent(*this, eventData, endpointId); } diff --git a/src/app/interaction-model/InvokeResponder.h b/src/app/interaction-model/InvokeResponder.h index 0a399b24564e96..54ae9ba0f51a08 100644 --- a/src/app/interaction-model/InvokeResponder.h +++ b/src/app/interaction-model/InvokeResponder.h @@ -26,7 +26,7 @@ namespace InteractionModel { /// Handles encoding of an invoke response for a specific invoke request. /// -/// This class handles a single response (i.e. a CommandDataIB within the +/// This class handles a single request (i.e. a CommandDataIB within the /// matter protocol) and is responsible for constructing its corresponding /// response (i.e. a InvokeResponseIB within the matter protocol) /// diff --git a/src/app/interaction-model/IterationTypes.h b/src/app/interaction-model/IterationTypes.h index 32ad8bc42b73be..441dd3acb7b81f 100644 --- a/src/app/interaction-model/IterationTypes.h +++ b/src/app/interaction-model/IterationTypes.h @@ -70,8 +70,13 @@ struct AttributeEntry /// Iteration rules: /// - kInvalidEndpointId will be returned when iteration ends (or generally kInvalid* for paths) /// - Any internal iteration errors are just logged (callers do not handle iteration CHIP_ERROR) -/// - Iteration order is NOT guaranteed, however uniqueness and completeness is (must iterate -/// over all possible distinct values as long as no internal structural changes occur) +/// - Iteration order is NOT guaranteed globally. Only the following is guaranteed: +/// - when iterating over an endpoint, ALL clusters of that endpoint will be iterated first, before +/// switching the endpoint (order of clusters themselves not guaranteed) +/// - when iterating over a cluster, ALL attributes of that cluster will be iterated first, before +/// switching to a new cluster +/// - uniqueness and completeness (iterate over all possible distinct values as long as no +/// internal structural changes occur) class AttributeTreeIterator { public: diff --git a/src/app/interaction-model/Model.h b/src/app/interaction-model/Model.h index b3a127c074aaa1..151065f4c540d2 100644 --- a/src/app/interaction-model/Model.h +++ b/src/app/interaction-model/Model.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -43,17 +43,17 @@ class Model : public AttributeTreeIterator public: virtual ~Model() = default; - // `actions` pointers will be guaranteed valid until Shutdown is called() - virtual CHIP_ERROR Startup(InteractionModelActions actions) + // `context` pointers will be guaranteed valid until Shutdown is called() + virtual CHIP_ERROR Startup(InteractionModelContext context) { - mActions = actions; + mContext = context; return CHIP_NO_ERROR; } virtual CHIP_ERROR Shutdown() = 0; // During the transition phase, we expect a large subset of code to require access to // event emitting, path marking and other operations - virtual InteractionModelActions CurrentActions() { return mActions; } + virtual InteractionModelContext CurrentContext() const { return mContext; } /// List reading has specific handling logic: /// `state` contains in/out data about the current list reading. MUST start with kInvalidListIndex on first call @@ -94,14 +94,14 @@ class Model : public AttributeTreeIterator /// - `NeedsTimedInteraction` for writes that are not timed however are required to be so virtual CHIP_ERROR WriteAttribute(const WriteAttributeRequest & request, AttributeValueDecoder & decoder) = 0; - /// `responder` is used to send back the reply. + /// `reply` is used to send back the reply. /// - calling Reply() or ReplyAsync() will let the application control the reply /// - returning a CHIP_NO_ERROR without reply/reply_async implies a Status::Success reply without data - /// - returning a CHIP_*_ERROR implies an error reply (error and data are mutually exclusive) + /// - returning a value other than CHIP_NO_ERROR implies an error reply (error and data are mutually exclusive) /// /// See InvokeReply/AutoCompleteInvokeResponder for details on how to send back replies and expected - /// error handling. If you require knowledge if a response was successfully sent, use the underlying - /// `reply` object instead of returning an error codes from Invoke. + /// error handling. If you need to know weather a response was successfully sent, use the underlying + /// `reply` object instead of returning an error code from Invoke. /// /// Return codes /// CHIP_IM_GLOBAL_STATUS(code): @@ -115,7 +115,7 @@ class Model : public AttributeTreeIterator virtual CHIP_ERROR Invoke(const InvokeRequest & request, chip::TLV::TLVReader & input_arguments, InvokeReply & reply) = 0; private: - InteractionModelActions mActions = { nullptr }; + InteractionModelContext mContext = { nullptr }; }; } // namespace InteractionModel diff --git a/src/app/interaction-model/OperationTypes.h b/src/app/interaction-model/OperationTypes.h index 115dc11a1ff3bc..57499a8dbafb49 100644 --- a/src/app/interaction-model/OperationTypes.h +++ b/src/app/interaction-model/OperationTypes.h @@ -66,8 +66,8 @@ struct ReadState enum class WriteFlags : uint32_t { - kTimed = 0x0001, // Received as a 2nd command after a timed invoke - kListBegin = 0x0002, // This is the FIRST list data element in a series of data + kTimed = 0x0001, // Write is a timed write (i.e. a Timed Request Action preceeded it) + kListBegin = 0x0002, // This is the FIRST list of data elements kListEnd = 0x0004, // This is the LAST list element to write }; @@ -79,7 +79,7 @@ struct WriteAttributeRequest : OperationRequest enum class InvokeFlags : uint32_t { - kTimed = 0x0001, // Received as a 2nd command after a timed invoke + kTimed = 0x0001, // Command received as part of a timed invoke interaction. }; struct InvokeRequest : OperationRequest diff --git a/src/app/interaction-model/Paths.h b/src/app/interaction-model/Paths.h index 2bf9f0c4158011..9241222a990cb5 100644 --- a/src/app/interaction-model/Paths.h +++ b/src/app/interaction-model/Paths.h @@ -22,23 +22,21 @@ namespace chip { namespace app { namespace InteractionModel { -/// Handles path attributes for interaction models. +/// Notification listener for attribute changes. /// -/// It allows a user of the class to mark specific paths -/// as having changed. The intended use is for some listener to -/// perform operations as a result of something having changed, -/// usually by forwarding updates (e.g. in case of subscriptions -/// that cover that path). +/// Used to notify that a specific attribute path (or several attributes +/// via wildcards) have changed their underlying content. /// -/// Methods on this class MUCH be called from within the matter +/// Methods on this class MUST be called from within the matter /// main loop as they will likely trigger interaction model -/// internal updates and subscription event updates. +/// internal updates and subscription data reporting. class Paths { public: virtual ~Paths() = 0; - /// Mark some specific attributes dirty. + /// Mark all attributes matching the given path (which may be a wildcard) dirty. + /// /// Wildcards are supported. virtual void MarkDirty(const AttributePathParams & path) = 0; }; diff --git a/src/app/interaction-model/tests/TestEventEmitting.cpp b/src/app/interaction-model/tests/TestEventEmitting.cpp index cb49dc25caa068..3196636f621653 100644 --- a/src/app/interaction-model/tests/TestEventEmitting.cpp +++ b/src/app/interaction-model/tests/TestEventEmitting.cpp @@ -100,7 +100,8 @@ TEST(TestInteractionModelEventEmitting, TestBasicType) StartUpEventType event{ kFakeSoftwareVersion }; - EventNumber n1 = events->GenerateEvent(event, 0 /* EndpointId */); + std::optional n1 = events->GenerateEvent(event, 0 /* EndpointId */); + ASSERT_EQ(n1, logOnlyEvents.CurrentEventNumber()); ASSERT_EQ(logOnlyEvents.LastOptions().mPath, ConcreteEventPath(0 /* endpointId */, StartUpEventType::GetClusterId(), StartUpEventType::GetEventId())); @@ -115,9 +116,8 @@ TEST(TestInteractionModelEventEmitting, TestBasicType) ASSERT_EQ(err, CHIP_NO_ERROR); ASSERT_EQ(decoded_event.softwareVersion, kFakeSoftwareVersion); - EventNumber n2 = events->GenerateEvent(event, /* endpointId = */ 1); + std::optional n2 = events->GenerateEvent(event, /* endpointId = */ 1); ASSERT_EQ(n2, logOnlyEvents.CurrentEventNumber()); - ASSERT_NE(n1, logOnlyEvents.CurrentEventNumber()); ASSERT_EQ(logOnlyEvents.LastOptions().mPath, ConcreteEventPath(1 /* endpointId */, StartUpEventType::GetClusterId(), StartUpEventType::GetEventId())); @@ -137,14 +137,13 @@ TEST(TestInteractionModelEventEmitting, TestFabricScoped) event.adminNodeID = chip::app::DataModel::MakeNullable(kTestNodeId); event.adminPasscodeID = chip::app::DataModel::MakeNullable(kTestPasscode); - EventNumber n1 = events->GenerateEvent(event, 0 /* EndpointId */); + std::optional n1 = events->GenerateEvent(event, 0 /* EndpointId */); // encoding without a fabric ID MUST fail for fabric events - ASSERT_EQ(n1, kInvalidEventId); + ASSERT_FALSE(n1.has_value()); event.fabricIndex = kTestFabricIndex; n1 = events->GenerateEvent(event, /* endpointId = */ 0); - ASSERT_NE(n1, kInvalidEventId); ASSERT_EQ(n1, logOnlyEvents.CurrentEventNumber()); ASSERT_EQ(logOnlyEvents.LastOptions().mPath, ConcreteEventPath(0 /* endpointId */, AccessControlEntryChangedType::GetClusterId(), From 5ee4ef6ffd33e4184b08177e1a82de4ba5381501 Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Sat, 8 Jun 2024 04:56:47 -0700 Subject: [PATCH 088/162] [Darwin] MTRDevice subscription pool test timeout should be increased (#33812) --- src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index 7b821d8648d949..8b7f50dedb828b 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -35,7 +35,7 @@ static const uint16_t kTimeoutInSeconds = 3; static NSString * kOnboardingPayload = @"MT:-24J0AFN00KA0648G00"; static const uint16_t kTestVendorId = 0xFFF1u; -static const uint16_t kSubscriptionPoolBaseTimeoutInSeconds = 10; +static const uint16_t kSubscriptionPoolBaseTimeoutInSeconds = 30; @interface MTRPerControllerStorageTestsControllerDelegate : NSObject @property (nonatomic, strong) XCTestExpectation * expectation; From c15826050e744034ec9c90cf810fb2b34bb46c54 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Sun, 9 Jun 2024 21:22:05 -0700 Subject: [PATCH 089/162] [Fabric-Bridge] Don't track device changes for synced devices (#33769) * Don't track device change status for synced devices * Address review comments --- examples/fabric-bridge-app/linux/Device.cpp | 31 +++++-------------- .../fabric-bridge-app/linux/DeviceManager.cpp | 7 ++++- .../fabric-bridge-app/linux/include/Device.h | 20 +++--------- .../linux/include/DeviceManager.h | 19 +++++++++++- examples/fabric-bridge-app/linux/main.cpp | 8 ++--- 5 files changed, 41 insertions(+), 44 deletions(-) diff --git a/examples/fabric-bridge-app/linux/Device.cpp b/examples/fabric-bridge-app/linux/Device.cpp index 4cf72a281113b6..215db48f683ef5 100644 --- a/examples/fabric-bridge-app/linux/Device.cpp +++ b/examples/fabric-bridge-app/linux/Device.cpp @@ -25,10 +25,9 @@ using namespace chip::app::Clusters::Actions; -Device::Device(const char * szDeviceName, std::string szLocation) +Device::Device(chip::NodeId nodeId, const char * name) { - chip::Platform::CopyString(mName, szDeviceName); - mLocation = szLocation; + chip::Platform::CopyString(mName, name); mReachable = false; mEndpointId = 0; } @@ -38,13 +37,11 @@ bool Device::IsReachable() return mReachable; } -void Device::SetReachable(bool aReachable) +void Device::SetReachable(bool reachable) { - bool changed = (mReachable != aReachable); + mReachable = reachable; - mReachable = aReachable; - - if (aReachable) + if (reachable) { ChipLogProgress(NotSpecified, "Device[%s]: ONLINE", mName); } @@ -52,23 +49,11 @@ void Device::SetReachable(bool aReachable) { ChipLogProgress(NotSpecified, "Device[%s]: OFFLINE", mName); } - - if (changed) - { - HandleDeviceChange(this, kChanged_Reachable); - } } -void Device::SetName(const char * szName) +void Device::SetName(const char * name) { - bool changed = (strncmp(mName, szName, sizeof(mName)) != 0); + ChipLogProgress(NotSpecified, "Device[%s]: New Name=\"%s\"", mName, name); - ChipLogProgress(NotSpecified, "Device[%s]: New Name=\"%s\"", mName, szName); - - chip::Platform::CopyString(mName, szName); - - if (changed) - { - HandleDeviceChange(this, kChanged_Name); - } + chip::Platform::CopyString(mName, name); } diff --git a/examples/fabric-bridge-app/linux/DeviceManager.cpp b/examples/fabric-bridge-app/linux/DeviceManager.cpp index a5ffe68445949b..3b158b876bf033 100644 --- a/examples/fabric-bridge-app/linux/DeviceManager.cpp +++ b/examples/fabric-bridge-app/linux/DeviceManager.cpp @@ -44,10 +44,15 @@ using namespace chip::DeviceLayer; using namespace chip::app::Clusters; namespace { + constexpr uint8_t kMaxRetries = 10; + } // namespace -DeviceManager::DeviceManager() +// Define the static member +DeviceManager DeviceManager::sInstance; + +void DeviceManager::Init() { memset(mDevices, 0, sizeof(mDevices)); mFirstDynamicEndpointId = static_cast( diff --git a/examples/fabric-bridge-app/linux/include/Device.h b/examples/fabric-bridge-app/linux/include/Device.h index ee7a917d8c4bb3..64940f33c23190 100644 --- a/examples/fabric-bridge-app/linux/include/Device.h +++ b/examples/fabric-bridge-app/linux/include/Device.h @@ -32,21 +32,13 @@ class Device public: static const int kDeviceNameSize = 32; - enum Changed_t - { - kChanged_Reachable = 1u << 0, - kChanged_Location = 1u << 1, - kChanged_Name = 1u << 2, - kChanged_Last = kChanged_Name, - } Changed; - - Device(const char * szDeviceName, std::string szLocation); + Device(chip::NodeId nodeId, const char * name); virtual ~Device() {} bool IsReachable(); - void SetReachable(bool aReachable); - void SetName(const char * szDeviceName); - void SetLocation(std::string szLocation); + void SetReachable(bool reachable); + void SetName(const char * name); + void SetLocation(std::string location) { mLocation = location; }; inline void SetEndpointId(chip::EndpointId id) { mEndpointId = id; }; inline chip::EndpointId GetEndpointId() { return mEndpointId; }; inline void SetParentEndpointId(chip::EndpointId id) { mParentEndpointId = id; }; @@ -56,13 +48,11 @@ class Device inline std::string GetZone() { return mZone; }; inline void SetZone(std::string zone) { mZone = zone; }; -private: - virtual void HandleDeviceChange(Device * device, Device::Changed_t changeMask) = 0; - protected: bool mReachable; char mName[kDeviceNameSize]; std::string mLocation; + chip::NodeId mNodeId; chip::EndpointId mEndpointId; chip::EndpointId mParentEndpointId; std::string mZone; diff --git a/examples/fabric-bridge-app/linux/include/DeviceManager.h b/examples/fabric-bridge-app/linux/include/DeviceManager.h index 8e87c9059bcb78..2667fc071d4ca8 100644 --- a/examples/fabric-bridge-app/linux/include/DeviceManager.h +++ b/examples/fabric-bridge-app/linux/include/DeviceManager.h @@ -25,7 +25,9 @@ class DeviceManager { public: - DeviceManager(); + DeviceManager() = default; + + void Init(); /** * @brief Adds a device to a dynamic endpoint. @@ -62,7 +64,22 @@ class DeviceManager Device * GetDevice(uint16_t index) const; private: + friend DeviceManager & DeviceMgr(); + + static DeviceManager sInstance; + chip::EndpointId mCurrentEndpointId; chip::EndpointId mFirstDynamicEndpointId; Device * mDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT + 1]; }; + +/** + * Returns the public interface of the DeviceManager singleton object. + * + * Applications should use this to access features of the DeviceManager + * object. + */ +inline DeviceManager & DeviceMgr() +{ + return DeviceManager::sInstance; +} diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index 47670561430c90..3ad6a5a1b20fe1 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -97,8 +97,6 @@ void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) } #endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE -DeviceManager gDeviceManager; - } // namespace void ApplicationInit() @@ -111,6 +109,8 @@ void ApplicationInit() // Start a thread for bridge polling std::thread pollingThread(BridgePollingThread); pollingThread.detach(); + + DeviceMgr().Init(); } void ApplicationShutdown() {} @@ -135,7 +135,7 @@ Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(Endpoin uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); AttributeId attributeId = attributeMetadata->attributeId; - Device * dev = gDeviceManager.GetDevice(endpointIndex); + Device * dev = DeviceMgr().GetDevice(endpointIndex); if (dev != nullptr && clusterId == app::Clusters::BridgedDeviceBasicInformation::Id) { using namespace app::Clusters::BridgedDeviceBasicInformation::Attributes; @@ -179,7 +179,7 @@ Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(Endpoi uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure; - Device * dev = gDeviceManager.GetDevice(endpointIndex); + Device * dev = DeviceMgr().GetDevice(endpointIndex); if (dev != nullptr && dev->IsReachable()) { ChipLogProgress(NotSpecified, "emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d", endpoint, clusterId); From 1f4ff38d42b8b5342f22e97d19c139268d3b9346 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 10 Jun 2024 07:37:21 -0400 Subject: [PATCH 090/162] Log errors if AdvertiseOperational fails (#33773) * Log errors if AdvertiseOperational fails * Update log text --- examples/platform/linux/CommissionerMain.cpp | 2 +- .../operational-credentials-server.cpp | 6 +++++- src/app/server/CommissioningWindowManager.cpp | 11 +++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/platform/linux/CommissionerMain.cpp b/examples/platform/linux/CommissionerMain.cpp index 3ffac89a6e08e9..e8da5d70b25e8a 100644 --- a/examples/platform/linux/CommissionerMain.cpp +++ b/examples/platform/linux/CommissionerMain.cpp @@ -216,7 +216,7 @@ CHIP_ERROR InitCommissioner(uint16_t commissionerPort, uint16_t udcListenPort, F gCommissionerDiscoveryController.SetCommissionerCallback(&gCommissionerCallback); // advertise operational since we are an admin - app::DnssdServer::Instance().AdvertiseOperational(); + ReturnLogErrorOnFailure(app::DnssdServer::Instance().AdvertiseOperational()); ChipLogProgress(Support, "InitCommissioner nodeId=0x" ChipLogFormatX64 " fabric.fabricId=0x" ChipLogFormatX64 " fabricIndex=0x%x", diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 12fe1c43de0baf..366694a8c504d3 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -703,7 +703,11 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co needRevert = false; // We might have a new operational identity, so we should start advertising it right away. - app::DnssdServer::Instance().AdvertiseOperational(); + err = app::DnssdServer::Instance().AdvertiseOperational(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Operational advertising failed: %" CHIP_ERROR_FORMAT, err.Format()); + } // Notify the attributes containing fabric metadata can be read with new data MatterReportingAttributeChangeCallback(commandPath.mEndpointId, OperationalCredentials::Id, diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index f11261ad9c444d..229fd67c5bb24b 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -84,8 +84,15 @@ void CommissioningWindowManager::OnPlatformEvent(const DeviceLayer::ChipDeviceEv } else if (event->Type == DeviceLayer::DeviceEventType::kOperationalNetworkEnabled) { - app::DnssdServer::Instance().AdvertiseOperational(); - ChipLogProgress(AppServer, "Operational advertising enabled"); + CHIP_ERROR err = app::DnssdServer::Instance().AdvertiseOperational(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Operational advertising failed: %" CHIP_ERROR_FORMAT, err.Format()); + } + else + { + ChipLogProgress(AppServer, "Operational advertising enabled"); + } } #if CONFIG_NETWORK_LAYER_BLE else if (event->Type == DeviceLayer::DeviceEventType::kCloseAllBleConnections) From 853a3866d7ef40cb62fba36e8c54014f126c6e18 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:41:36 +0200 Subject: [PATCH 091/162] pigweed unit_test migration: App 3rd batch (#33757) * pigweed unit_test migration: App 3rd batch * Integrating Comments * moving buffer in TestDataModelSerialization to Teardown --- src/app/tests/BUILD.gn | 36 +- src/app/tests/TestAttributePathParams.cpp | 156 ++ .../tests/TestBasicCommandPathRegistry.cpp | 58 +- src/app/tests/TestClusterInfo.cpp | 255 --- src/app/tests/TestCommandPathParams.cpp | 50 +- src/app/tests/TestConcreteAttributePath.cpp | 111 +- src/app/tests/TestDataModelSerialization.cpp | 613 +++---- .../tests/TestDefaultOTARequestorStorage.cpp | 133 +- src/app/tests/TestEventPathParams.cpp | 115 +- src/app/tests/TestExtensionFieldSets.cpp | 281 ++- src/app/tests/TestSceneTable.cpp | 1584 ++++++++--------- 11 files changed, 1478 insertions(+), 1914 deletions(-) create mode 100644 src/app/tests/TestAttributePathParams.cpp delete mode 100644 src/app/tests/TestClusterInfo.cpp diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index e8413b92026d9a..41f083e1735924 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -143,11 +143,18 @@ chip_test_suite("tests") { test_sources = [ "TestAttributeAccessInterfaceCache.cpp", "TestAttributePathExpandIterator.cpp", + "TestAttributePathParams.cpp", "TestAttributePersistenceProvider.cpp", "TestAttributeValueDecoder.cpp", "TestAttributeValueEncoder.cpp", + "TestBasicCommandPathRegistry.cpp", "TestBindingTable.cpp", "TestBuilderParser.cpp", + "TestCommandPathParams.cpp", + "TestConcreteAttributePath.cpp", + "TestDataModelSerialization.cpp", + "TestDefaultOTARequestorStorage.cpp", + "TestEventPathParams.cpp", "TestMessageDef.cpp", "TestNullable.cpp", "TestNumericAttributeTraits.cpp", @@ -193,6 +200,17 @@ chip_test_suite("tests") { "${chip_root}/src/lib/support:test_utils", "${chip_root}/src/lib/support:testing", ] + + if (chip_device_platform != "android") { + test_sources += [ + "TestExtensionFieldSets.cpp", + "TestSceneTable.cpp", + ] + public_deps += [ + ":power-cluster-test-srcs", + ":scenes-table-test-srcs", + ] + } } chip_test_suite_using_nltest("tests_nltest") { @@ -201,16 +219,9 @@ chip_test_suite_using_nltest("tests_nltest") { test_sources = [ "TestAclAttribute.cpp", "TestAclEvent.cpp", - "TestBasicCommandPathRegistry.cpp", - "TestClusterInfo.cpp", "TestCommandInteraction.cpp", - "TestCommandPathParams.cpp", - "TestConcreteAttributePath.cpp", - "TestDataModelSerialization.cpp", - "TestDefaultOTARequestorStorage.cpp", "TestEventLoggingNoUTCTime.cpp", "TestEventOverflow.cpp", - "TestEventPathParams.cpp", "TestFabricScopedEventLogging.cpp", "TestInteractionModelEngine.cpp", "TestReadInteraction.cpp", @@ -258,17 +269,6 @@ chip_test_suite_using_nltest("tests_nltest") { "${nlunit_test_root}:nlunit-test", ] - if (chip_device_platform != "android") { - test_sources += [ - "TestExtensionFieldSets.cpp", - "TestSceneTable.cpp", - ] - public_deps += [ - ":power-cluster-test-srcs", - ":scenes-table-test-srcs", - ] - } - if (chip_config_network_layer_ble && (chip_device_platform == "linux" || chip_device_platform == "darwin")) { test_sources += [ "TestCommissionManager.cpp" ] diff --git a/src/app/tests/TestAttributePathParams.cpp b/src/app/tests/TestAttributePathParams.cpp new file mode 100644 index 00000000000000..19745e20f027a0 --- /dev/null +++ b/src/app/tests/TestAttributePathParams.cpp @@ -0,0 +1,156 @@ +/* + * + * 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 +#include + +#include +#include + +namespace chip { +namespace app { +namespace TestPath { + +TEST(TestAttributePathParams, TestAttributePathIntersect) +{ + EndpointId endpointIdArray[2] = { 1, kInvalidEndpointId }; + ClusterId clusterIdArray[2] = { 2, kInvalidClusterId }; + AttributeId attributeIdArray[2] = { 3, kInvalidAttributeId }; + + for (auto endpointId1 : endpointIdArray) + { + for (auto clusterId1 : clusterIdArray) + { + for (auto attributeId1 : attributeIdArray) + { + for (auto endpointId2 : endpointIdArray) + { + for (auto clusterId2 : clusterIdArray) + { + for (auto attributeId2 : attributeIdArray) + { + AttributePathParams path1; + path1.mEndpointId = endpointId1; + path1.mClusterId = clusterId1; + path1.mAttributeId = attributeId1; + AttributePathParams path2; + path2.mEndpointId = endpointId2; + path2.mClusterId = clusterId2; + path2.mAttributeId = attributeId2; + EXPECT_TRUE(path1.Intersects(path2)); + } + } + } + } + } + } + + { + AttributePathParams path1; + path1.mEndpointId = 1; + AttributePathParams path2; + path2.mEndpointId = 2; + EXPECT_FALSE(path1.Intersects(path2)); + } + + { + AttributePathParams path1; + path1.mClusterId = 1; + AttributePathParams path2; + path2.mClusterId = 2; + EXPECT_FALSE(path1.Intersects(path2)); + } + + { + AttributePathParams path1; + path1.mAttributeId = 1; + AttributePathParams path2; + path2.mAttributeId = 2; + EXPECT_FALSE(path1.Intersects(path2)); + } +} + +TEST(TestAttributePathParams, TestAttributePathIncludedSameFieldId) +{ + AttributePathParams path1; + AttributePathParams path2; + AttributePathParams path3; + path1.mAttributeId = 1; + path2.mAttributeId = 1; + path3.mAttributeId = 1; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path2)); + path2.mListIndex = 1; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path2)); + path1.mListIndex = 0; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path3)); + path3.mListIndex = 0; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path3)); + path3.mListIndex = 1; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path3)); +} + +TEST(TestAttributePathParams, TestAttributePathIncludedDifferentFieldId) +{ + { + AttributePathParams path1; + AttributePathParams path2; + path1.mAttributeId = 1; + path2.mAttributeId = 2; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path2)); + } + { + AttributePathParams path1; + AttributePathParams path2; + path2.mAttributeId = 2; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path2)); + } + { + AttributePathParams path1; + AttributePathParams path2; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path2)); + } + { + AttributePathParams path1; + AttributePathParams path2; + + path1.mAttributeId = 1; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path2)); + } +} + +TEST(TestAttributePathParams, TestAttributePathIncludedDifferentEndpointId) +{ + AttributePathParams path1; + AttributePathParams path2; + path1.mEndpointId = 1; + path2.mEndpointId = 2; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path2)); +} + +TEST(TestAttributePathParams, TestAttributePathIncludedDifferentClusterId) +{ + AttributePathParams path1; + AttributePathParams path2; + path1.mClusterId = 1; + path2.mClusterId = 2; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path2)); +} + +} // namespace TestPath +} // namespace app +} // namespace chip diff --git a/src/app/tests/TestBasicCommandPathRegistry.cpp b/src/app/tests/TestBasicCommandPathRegistry.cpp index 28d7621ccbe7d1..cc003cfc1581c3 100644 --- a/src/app/tests/TestBasicCommandPathRegistry.cpp +++ b/src/app/tests/TestBasicCommandPathRegistry.cpp @@ -17,9 +17,9 @@ */ #include -#include -#include +#include +#include namespace chip { namespace app { @@ -30,7 +30,7 @@ size_t constexpr kQuickTestSize = 10; } // namespace -void TestAddingSameConcretePath(nlTestSuite * apSuite, void * apContext) +TEST(TestBasicCommandPathRegistry, TestAddingSameConcretePath) { CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; @@ -47,11 +47,11 @@ void TestAddingSameConcretePath(nlTestSuite * apSuite, void * apContext) err = basicCommandPathRegistry.Add(concretePath, commandRef); } - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_DUPLICATE_KEY_ID); - NL_TEST_ASSERT(apSuite, basicCommandPathRegistry.Count() == 1); + EXPECT_EQ(err, CHIP_ERROR_DUPLICATE_KEY_ID); + EXPECT_EQ(basicCommandPathRegistry.Count(), 1u); } -void TestAddingSameCommandRef(nlTestSuite * apSuite, void * apContext) +TEST(TestBasicCommandPathRegistry, TestAddingSameCommandRef) { CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; @@ -69,32 +69,30 @@ void TestAddingSameCommandRef(nlTestSuite * apSuite, void * apContext) err = basicCommandPathRegistry.Add(concretePath, commandRef); } - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_DUPLICATE_KEY_ID); - NL_TEST_ASSERT(apSuite, basicCommandPathRegistry.Count() == 1); + EXPECT_EQ(err, CHIP_ERROR_DUPLICATE_KEY_ID); + EXPECT_EQ(basicCommandPathRegistry.Count(), 1u); } -void TestAddingMaxNumberOfEntries(nlTestSuite * apSuite, void * apContext) +TEST(TestBasicCommandPathRegistry, TestAddingMaxNumberOfEntries) { - CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; std::optional commandRef; uint16_t commandRefAndEndpointValue = 0; size_t idx = 0; - for (idx = 0; idx < kQuickTestSize && err == CHIP_NO_ERROR; idx++) + for (idx = 0; idx < kQuickTestSize; idx++) { ConcreteCommandPath concretePath(commandRefAndEndpointValue, 0, 0); commandRef.emplace(commandRefAndEndpointValue); commandRefAndEndpointValue++; - err = basicCommandPathRegistry.Add(concretePath, commandRef); + ASSERT_EQ(basicCommandPathRegistry.Add(concretePath, commandRef), CHIP_NO_ERROR); } - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, basicCommandPathRegistry.Count() == kQuickTestSize); + EXPECT_EQ(basicCommandPathRegistry.Count(), kQuickTestSize); } -void TestAddingTooManyEntries(nlTestSuite * apSuite, void * apContext) +TEST(TestBasicCommandPathRegistry, TestAddingTooManyEntries) { CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; @@ -112,36 +110,10 @@ void TestAddingTooManyEntries(nlTestSuite * apSuite, void * apContext) err = basicCommandPathRegistry.Add(concretePath, commandRef); } - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_NO_MEMORY); - NL_TEST_ASSERT(apSuite, basicCommandPathRegistry.Count() == kQuickTestSize); + EXPECT_EQ(err, CHIP_ERROR_NO_MEMORY); + EXPECT_EQ(basicCommandPathRegistry.Count(), kQuickTestSize); } } // namespace TestBasicCommandPathRegistry } // namespace app } // namespace chip - -namespace { -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestAddingSameConcretePath", chip::app::TestBasicCommandPathRegistry::TestAddingSameConcretePath), - NL_TEST_DEF("TestAddingSameCommandRef", chip::app::TestBasicCommandPathRegistry::TestAddingSameCommandRef), - NL_TEST_DEF("TestAddingMaxNumberOfEntries", chip::app::TestBasicCommandPathRegistry::TestAddingMaxNumberOfEntries), - NL_TEST_DEF("TestAddingTooManyEntries", chip::app::TestBasicCommandPathRegistry::TestAddingTooManyEntries), - - NL_TEST_SENTINEL() -}; -// clang-format on - -} // namespace - -int TestBasicCommandPathRegistry() -{ - nlTestSuite theSuite = { "CommandPathRegistry", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestBasicCommandPathRegistry) diff --git a/src/app/tests/TestClusterInfo.cpp b/src/app/tests/TestClusterInfo.cpp deleted file mode 100644 index bfbefc7af693e8..00000000000000 --- a/src/app/tests/TestClusterInfo.cpp +++ /dev/null @@ -1,255 +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. - */ - -/** - * @file - * This file implements unit tests for CommandPathParams - * - */ - -#include -#include -#include -#include -#include -#include - -using namespace chip::Test; - -namespace chip { -namespace app { -namespace TestPath { -void TestAttributePathIntersect(nlTestSuite * apSuite, void * apContext) -{ - EndpointId endpointIdArray[2] = { 1, kInvalidEndpointId }; - ClusterId clusterIdArray[2] = { 2, kInvalidClusterId }; - AttributeId attributeIdArray[2] = { 3, kInvalidAttributeId }; - - for (auto endpointId1 : endpointIdArray) - { - for (auto clusterId1 : clusterIdArray) - { - for (auto attributeId1 : attributeIdArray) - { - for (auto endpointId2 : endpointIdArray) - { - for (auto clusterId2 : clusterIdArray) - { - for (auto attributeId2 : attributeIdArray) - { - AttributePathParams path1; - path1.mEndpointId = endpointId1; - path1.mClusterId = clusterId1; - path1.mAttributeId = attributeId1; - AttributePathParams path2; - path2.mEndpointId = endpointId2; - path2.mClusterId = clusterId2; - path2.mAttributeId = attributeId2; - NL_TEST_ASSERT(apSuite, path1.Intersects(path2)); - } - } - } - } - } - } - - { - AttributePathParams path1; - path1.mEndpointId = 1; - AttributePathParams path2; - path2.mEndpointId = 2; - NL_TEST_ASSERT(apSuite, !path1.Intersects(path2)); - } - - { - AttributePathParams path1; - path1.mClusterId = 1; - AttributePathParams path2; - path2.mClusterId = 2; - NL_TEST_ASSERT(apSuite, !path1.Intersects(path2)); - } - - { - AttributePathParams path1; - path1.mAttributeId = 1; - AttributePathParams path2; - path2.mAttributeId = 2; - NL_TEST_ASSERT(apSuite, !path1.Intersects(path2)); - } -} - -void TestAttributePathIncludedSameFieldId(nlTestSuite * apSuite, void * apContext) -{ - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - AttributePathParams clusterInfo3; - clusterInfo1.mAttributeId = 1; - clusterInfo2.mAttributeId = 1; - clusterInfo3.mAttributeId = 1; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - clusterInfo2.mListIndex = 1; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - clusterInfo1.mListIndex = 0; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo3)); - clusterInfo3.mListIndex = 0; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo3)); - clusterInfo3.mListIndex = 1; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo3)); -} - -void TestAttributePathIncludedDifferentFieldId(nlTestSuite * apSuite, void * apContext) -{ - { - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - clusterInfo1.mAttributeId = 1; - clusterInfo2.mAttributeId = 2; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - } - { - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - clusterInfo2.mAttributeId = 2; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - } - { - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - } - { - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - - clusterInfo1.mAttributeId = 1; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - } -} - -void TestAttributePathIncludedDifferentEndpointId(nlTestSuite * apSuite, void * apContext) -{ - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - clusterInfo1.mEndpointId = 1; - clusterInfo2.mEndpointId = 2; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); -} - -void TestAttributePathIncludedDifferentClusterId(nlTestSuite * apSuite, void * apContext) -{ - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - clusterInfo1.mClusterId = 1; - clusterInfo2.mClusterId = 2; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); -} - -/* -{kInvalidEndpointId, kInvalidClusterId, kInvalidEventId}, -{kInvalidEndpointId, MockClusterId(1), kInvalidEventId}, -{kInvalidEndpointId, MockClusterId(1), MockEventId(1)}, -{kMockEndpoint1, kInvalidClusterId, kInvalidEventId}, -{kMockEndpoint1, MockClusterId(1), kInvalidEventId}, -{kMockEndpoint1, MockClusterId(1), MockEventId(1)}, -*/ -chip::app::EventPathParams validEventpaths[6]; -void InitEventPaths() -{ - validEventpaths[1].mClusterId = MockClusterId(1); - validEventpaths[2].mClusterId = MockClusterId(1); - validEventpaths[2].mEventId = MockEventId(1); - validEventpaths[3].mEndpointId = kMockEndpoint1; - validEventpaths[4].mEndpointId = kMockEndpoint1; - validEventpaths[4].mClusterId = MockClusterId(1); - validEventpaths[5].mEndpointId = kMockEndpoint1; - validEventpaths[5].mClusterId = MockClusterId(1); - validEventpaths[5].mEventId = MockEventId(1); -} - -void TestEventPathSameEventId(nlTestSuite * apSuite, void * apContext) -{ - ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(1), MockEventId(1)); - for (auto & path : validEventpaths) - { - NL_TEST_ASSERT(apSuite, path.IsValidEventPath()); - NL_TEST_ASSERT(apSuite, path.IsEventPathSupersetOf(testPath)); - } -} - -void TestEventPathDifferentEventId(nlTestSuite * apSuite, void * apContext) -{ - ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(1), MockEventId(2)); - NL_TEST_ASSERT(apSuite, validEventpaths[0].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[1].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[2].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[3].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[4].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[5].IsEventPathSupersetOf(testPath)); -} - -void TestEventPathDifferentClusterId(nlTestSuite * apSuite, void * apContext) -{ - ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(2), MockEventId(1)); - NL_TEST_ASSERT(apSuite, validEventpaths[0].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[1].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[2].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[3].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[4].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[5].IsEventPathSupersetOf(testPath)); -} - -void TestEventPathDifferentEndpointId(nlTestSuite * apSuite, void * apContext) -{ - ConcreteEventPath testPath(kMockEndpoint2, MockClusterId(1), MockEventId(1)); - NL_TEST_ASSERT(apSuite, validEventpaths[0].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[1].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[2].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[3].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[4].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[5].IsEventPathSupersetOf(testPath)); -} - -} // namespace TestPath -} // namespace app -} // namespace chip - -namespace { -const nlTest sTests[] = { - NL_TEST_DEF("TestAttributePathIncludedSameFieldId", chip::app::TestPath::TestAttributePathIncludedSameFieldId), - NL_TEST_DEF("TestAttributePathIncludedDifferentFieldId", chip::app::TestPath::TestAttributePathIncludedDifferentFieldId), - NL_TEST_DEF("TestAttributePathIncludedDifferentEndpointId", chip::app::TestPath::TestAttributePathIncludedDifferentEndpointId), - NL_TEST_DEF("TestAttributePathIncludedDifferentClusterId", chip::app::TestPath::TestAttributePathIncludedDifferentClusterId), - NL_TEST_DEF("TestEventPathSameEventId", chip::app::TestPath::TestEventPathSameEventId), - NL_TEST_DEF("TestEventPathDifferentEventId", chip::app::TestPath::TestEventPathDifferentEventId), - NL_TEST_DEF("TestEventPathDifferentClusterId", chip::app::TestPath::TestEventPathDifferentClusterId), - NL_TEST_DEF("TestEventPathDifferentEndpointId", chip::app::TestPath::TestEventPathDifferentEndpointId), - NL_TEST_DEF("TestAttributePathIntersect", chip::app::TestPath::TestAttributePathIntersect), - NL_TEST_SENTINEL() -}; -} - -int TestPath() -{ - nlTestSuite theSuite = { "TestPath", &sTests[0], nullptr, nullptr }; - chip::app::TestPath::InitEventPaths(); - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestPath) diff --git a/src/app/tests/TestCommandPathParams.cpp b/src/app/tests/TestCommandPathParams.cpp index 62b0b295b5b362..83a34cbc922537 100644 --- a/src/app/tests/TestCommandPathParams.cpp +++ b/src/app/tests/TestCommandPathParams.cpp @@ -23,74 +23,54 @@ */ #include -#include -#include + +#include +#include namespace chip { namespace app { namespace TestCommandPathParams { -void TestSamePath(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestSamePath) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); - NL_TEST_ASSERT(apSuite, commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_TRUE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentEndpointId(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentEndpointId) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(6, 2, 3, 4, CommandPathFlags::kEndpointIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentGroupId(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentGroupId) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kGroupIdValid); CommandPathParams commandPathParams2(1, 6, 3, 4, CommandPathFlags::kGroupIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentClusterId(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentClusterId) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(1, 2, 6, 4, CommandPathFlags::kEndpointIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentCommandId(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentCommandId) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(1, 2, 3, 6, CommandPathFlags::kEndpointIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentPathFlag(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentPathFlag) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(1, 2, 3, 4, CommandPathFlags::kGroupIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } } // namespace TestCommandPathParams } // namespace app } // namespace chip - -namespace { -const nlTest sTests[] = { NL_TEST_DEF("TestSamePath", chip::app::TestCommandPathParams::TestSamePath), - NL_TEST_DEF("TestDifferentEndpointId", chip::app::TestCommandPathParams::TestDifferentEndpointId), - NL_TEST_DEF("TestDifferentGroupId", chip::app::TestCommandPathParams::TestDifferentGroupId), - NL_TEST_DEF("TestDifferentClusterId", chip::app::TestCommandPathParams::TestDifferentClusterId), - NL_TEST_DEF("TestDifferentCommandId", chip::app::TestCommandPathParams::TestDifferentCommandId), - NL_TEST_DEF("TestDifferentPathFlag", chip::app::TestCommandPathParams::TestDifferentPathFlag), - NL_TEST_SENTINEL() }; -} - -int TestCommandPathParams() -{ - nlTestSuite theSuite = { "CommandPathParams", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestCommandPathParams) diff --git a/src/app/tests/TestConcreteAttributePath.cpp b/src/app/tests/TestConcreteAttributePath.cpp index a598c2f23c121f..d9f50ab799f487 100644 --- a/src/app/tests/TestConcreteAttributePath.cpp +++ b/src/app/tests/TestConcreteAttributePath.cpp @@ -17,36 +17,37 @@ */ #include -#include -#include + +#include +#include using namespace chip; using namespace chip::app; namespace { -void TestConcreteAttributePathEqualityDefaultConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteAttributePathEqualityDefaultConstructor) { ConcreteAttributePath path_one; ConcreteAttributePath path_two; - NL_TEST_ASSERT(aSuite, path_one == path_two); + EXPECT_EQ(path_one, path_two); } -void TestConcreteAttributePathEquality(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteAttributePathEquality) { ConcreteAttributePath path_one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteAttributePath path_two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); - NL_TEST_ASSERT(aSuite, path_one == path_two); + EXPECT_EQ(path_one, path_two); } -void TestConcreteAttributePathInequalityDifferentAttributeId(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteAttributePathInequalityDifferentAttributeId) { ConcreteAttributePath path_one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteAttributePath path_two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/4); - NL_TEST_ASSERT(aSuite, path_one != path_two); + EXPECT_NE(path_one, path_two); } -void TestConcreteDataAttributePathMatchesConcreteAttributePathEquality(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathMatchesConcreteAttributePathEquality) { ConcreteAttributePath path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath data_path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); @@ -56,138 +57,96 @@ void TestConcreteDataAttributePathMatchesConcreteAttributePathEquality(nlTestSui /*aListOp=*/ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5U); - NL_TEST_ASSERT(aSuite, data_path.MatchesConcreteAttributePath(path)); - NL_TEST_ASSERT(aSuite, data_path_with_version.MatchesConcreteAttributePath(path)); - NL_TEST_ASSERT(aSuite, data_path_with_list.MatchesConcreteAttributePath(path)); + EXPECT_TRUE(data_path.MatchesConcreteAttributePath(path)); + EXPECT_TRUE(data_path_with_version.MatchesConcreteAttributePath(path)); + EXPECT_TRUE(data_path_with_list.MatchesConcreteAttributePath(path)); } -void TestConcreteDataAttributePathMatchesConcreteAttributePathInequality(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathMatchesConcreteAttributePathInequality) { ConcreteAttributePath path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath data_path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/4); - NL_TEST_ASSERT(aSuite, !data_path.MatchesConcreteAttributePath(path)); + EXPECT_FALSE(data_path.MatchesConcreteAttributePath(path)); } -void TestConcreteDataAttributePathEqualityDefaultConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityDefaultConstructor) { ConcreteDataAttributePath one; ConcreteDataAttributePath two; - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathEqualityConcreteAttributePathConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityConcreteAttributePathConstructor) { ConcreteAttributePath path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath one(path); ConcreteDataAttributePath two(path); - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathInequalityConcreteAttributePathConstructorDifferentAttributeId(nlTestSuite * aSuite, - void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityConcreteAttributePathConstructorDifferentAttributeId) { ConcreteAttributePath path_one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteAttributePath path_two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/4); ConcreteDataAttributePath one(path_one); ConcreteDataAttributePath two(path_two); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -void TestConcreteDataAttributePathEqualityConcreteAttributePathArgsConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityConcreteAttributePathArgsConstructor) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathInequalityConcreteAttributePathArgsConstructorDifferentAttributeId(nlTestSuite * aSuite, - void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityConcreteAttributePathArgsConstructorDifferentAttributeId) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/4); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -void TestConcreteDataAttributePathEqualityDataVersionConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityDataVersionConstructor) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, /*aDataVersion=*/MakeOptional(4U)); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, /*aDataVersion=*/MakeOptional(4U)); - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathInequalityDataVersionConstructorDifferentDataVersion(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityDataVersionConstructorDifferentDataVersion) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, /*aDataVersion=*/MakeOptional(4U)); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, /*aDataVersion=*/MakeOptional(5U)); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -void TestConcreteDataAttributePathEqualityListConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityListConstructor) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5); - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathInequalityListConstructorDifferentListOp(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityListConstructorDifferentListOp) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceItem, /*aListIndex=*/5); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -void TestConcreteDataAttributePathInequalityListConstructorDifferentListIndex(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityListConstructorDifferentListIndex) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/6); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -const nlTest sTests[] = { - NL_TEST_DEF("TestConcreteAttributePathEqualityDefaultConstructor", TestConcreteAttributePathEqualityDefaultConstructor), - NL_TEST_DEF("TestConcreteAttributePathEquality", TestConcreteAttributePathEquality), - NL_TEST_DEF("TestConcreteAttributePathInequalityDifferentAttributeId", TestConcreteAttributePathInequalityDifferentAttributeId), - NL_TEST_DEF("TestConcreteDataAttributePathMatchesConcreteAttributePathEquality", - TestConcreteDataAttributePathMatchesConcreteAttributePathEquality), - NL_TEST_DEF("TestConcreteDataAttributePathMatchesConcreteAttributePathInequality", - TestConcreteDataAttributePathMatchesConcreteAttributePathInequality), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityDefaultConstructor", TestConcreteDataAttributePathEqualityDefaultConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityConcreteAttributePathConstructor", - TestConcreteDataAttributePathEqualityConcreteAttributePathConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityConcreteAttributePathConstructorDifferentAttributeId", - TestConcreteDataAttributePathInequalityConcreteAttributePathConstructorDifferentAttributeId), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityConcreteAttributePathArgsConstructor", - TestConcreteDataAttributePathEqualityConcreteAttributePathArgsConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityConcreteAttributePathArgsConstructorDifferentAttributeId", - TestConcreteDataAttributePathInequalityConcreteAttributePathArgsConstructorDifferentAttributeId), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityDataVersionConstructor", - TestConcreteDataAttributePathEqualityDataVersionConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityDataVersionConstructorDifferentDataVersion", - TestConcreteDataAttributePathInequalityDataVersionConstructorDifferentDataVersion), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityListConstructor", TestConcreteDataAttributePathEqualityListConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityListConstructorDifferentListOp", - TestConcreteDataAttributePathInequalityListConstructorDifferentListOp), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityListConstructorDifferentListIndex", - TestConcreteDataAttributePathInequalityListConstructorDifferentListIndex), - NL_TEST_SENTINEL() -}; - } // anonymous namespace - -int TestConcreteAttributePath() -{ - nlTestSuite theSuite = { "ConcreteAttributePath", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestConcreteAttributePath) diff --git a/src/app/tests/TestDataModelSerialization.cpp b/src/app/tests/TestDataModelSerialization.cpp index cdfa6560d70150..4c4a54e2e5ab74 100644 --- a/src/app/tests/TestDataModelSerialization.cpp +++ b/src/app/tests/TestDataModelSerialization.cpp @@ -16,57 +16,37 @@ * limitations under the License. */ -/** - * @file - * This file implements unit tests for CHIP Interaction Model Command Interaction - * - */ - #include #include #include #include #include -#include -#include #include #include +#include +#include + namespace { using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; -class TestDataModelSerialization +class TestDataModelSerialization : public ::testing::Test { public: - static void TestDataModelSerialization_EncAndDecSimpleStruct(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecSimpleStructNegativeEnum(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecNestedStruct(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecNestedStructList(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecDecodableNestedStructList(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecDecodableDoubleNestedStructList(nlTestSuite * apSuite, void * apContext); - - static void TestDataModelSerialization_OptionalFields(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_ExtraField(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_InvalidSimpleFieldTypes(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_InvalidListType(nlTestSuite * apSuite, void * apContext); - - static void NullablesOptionalsStruct(nlTestSuite * apSuite, void * apContext); - static void NullablesOptionalsCommand(nlTestSuite * apSuite, void * apContext); + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } + void TearDown() override { System::PacketBufferHandle buf = mStore.Release(); } - void Shutdown(); - -protected: // Helper functions template - static void NullablesOptionalsEncodeDecodeCheck(nlTestSuite * apSuite, void * apContext, bool encodeNulls, bool encodeValues); + void NullablesOptionalsEncodeDecodeCheck(bool encodeNulls, bool encodeValues); template - static void NullablesOptionalsEncodeDecodeCheck(nlTestSuite * apSuite, void * apContext); + void NullablesOptionalsEncodeDecodeCheck(); -private: void SetupBuf(); void DumpBuf(); void SetupReader(); @@ -74,13 +54,10 @@ class TestDataModelSerialization System::TLVPacketBufferBackingStore mStore; TLV::TLVWriter mWriter; TLV::TLVReader mReader; - nlTestSuite * mpSuite; }; using namespace TLV; -TestDataModelSerialization gTestDataModelSerialization; - void TestDataModelSerialization::SetupBuf() { System::PacketBufferHandle buf; @@ -92,11 +69,6 @@ void TestDataModelSerialization::SetupBuf() mReader.Init(mStore); } -void TestDataModelSerialization::Shutdown() -{ - System::PacketBufferHandle buf = mStore.Release(); -} - void TestDataModelSerialization::DumpBuf() { TLV::TLVReader reader; @@ -112,12 +84,9 @@ void TestDataModelSerialization::DumpBuf() void TestDataModelSerialization::SetupReader() { - CHIP_ERROR err; mReader.Init(mStore); - err = mReader.Next(); - - NL_TEST_ASSERT(mpSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mReader.Next(), CHIP_NO_ERROR); } template @@ -161,13 +130,9 @@ bool StringMatches(Span str1, const char * str2) return (strncmp(str1.data(), str2, str1.size()) == 0); } -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruct(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecSimpleStruct) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -186,13 +151,11 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruc t.f.Set(Clusters::UnitTesting::SimpleBitmap::kValueC); - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -201,35 +164,31 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruc { Clusters::UnitTesting::Structs::SimpleStruct::Type t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, t.a == 20); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c == Clusters::UnitTesting::SimpleEnum::kValueA); + EXPECT_EQ(t.a, 20); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c, Clusters::UnitTesting::SimpleEnum::kValueA); - NL_TEST_ASSERT(apSuite, t.d.size() == 4); + EXPECT_EQ(t.d.size(), 4u); for (uint32_t i = 0; i < t.d.size(); i++) { - NL_TEST_ASSERT(apSuite, t.d.data()[i] == i); + EXPECT_EQ(t.d.data()[i], i); } - NL_TEST_ASSERT(apSuite, StringMatches(t.e, "chip")); - NL_TEST_ASSERT(apSuite, t.f.HasOnly(Clusters::UnitTesting::SimpleBitmap::kValueC)); + EXPECT_TRUE(StringMatches(t.e, "chip")); + EXPECT_TRUE(t.f.HasOnly(Clusters::UnitTesting::SimpleBitmap::kValueC)); } } -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStructNegativeEnum(nlTestSuite * apSuite, - void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecSimpleStructNegativeEnum) + { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -248,13 +207,11 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruc t.f.Set(Clusters::UnitTesting::SimpleBitmap::kValueC); - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -263,21 +220,17 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruc { Clusters::UnitTesting::Structs::SimpleStruct::Type t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, to_underlying(t.c) == 4); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); + EXPECT_EQ(to_underlying(t.c), 4); } } -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecNestedStruct(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecNestedStruct) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -296,13 +249,10 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecNestedStruc t.c.e = Span{ strbuf, strlen(strbuf) }; - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - _this->DumpBuf(); + DumpBuf(); } // @@ -311,36 +261,30 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecNestedStruc { Clusters::UnitTesting::Structs::NestedStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, t.a == 20); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c.a == 11); - NL_TEST_ASSERT(apSuite, t.c.b == true); - NL_TEST_ASSERT(apSuite, t.c.c == Clusters::UnitTesting::SimpleEnum::kValueB); + EXPECT_EQ(t.a, 20); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c.a, 11); + EXPECT_TRUE(t.c.b); + EXPECT_EQ(t.c.c, Clusters::UnitTesting::SimpleEnum::kValueB); - NL_TEST_ASSERT(apSuite, t.c.d.size() == 4); + EXPECT_EQ(t.c.d.size(), 4u); for (uint32_t i = 0; i < t.c.d.size(); i++) { - NL_TEST_ASSERT(apSuite, t.c.d.data()[i] == i); + EXPECT_EQ(t.c.d.data()[i], i); } - NL_TEST_ASSERT(apSuite, StringMatches(t.c.e, "chip")); + EXPECT_TRUE(StringMatches(t.c.e, "chip")); } } - -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNestedStructList(nlTestSuite * apSuite, - void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecDecodableNestedStructList) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -381,13 +325,10 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe t.c.e = Span{ strbuf, strlen(strbuf) }; t.d = structList; - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - _this->DumpBuf(); + DumpBuf(); } // @@ -397,18 +338,17 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe Clusters::UnitTesting::Structs::NestedStructList::DecodableType t; int i; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, t.a == 20); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c.a == 11); - NL_TEST_ASSERT(apSuite, t.c.b == true); - NL_TEST_ASSERT(apSuite, t.c.c == Clusters::UnitTesting::SimpleEnum::kValueB); + EXPECT_EQ(t.a, 20); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c.a, 11); + EXPECT_TRUE(t.c.b); + EXPECT_EQ(t.c.c, Clusters::UnitTesting::SimpleEnum::kValueB); - NL_TEST_ASSERT(apSuite, StringMatches(t.c.e, "chip")); + EXPECT_TRUE(StringMatches(t.c.e, "chip")); { i = 0; @@ -416,13 +356,13 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe while (iter.Next()) { auto & item = iter.GetValue(); - NL_TEST_ASSERT(apSuite, item.a == static_cast(i)); - NL_TEST_ASSERT(apSuite, item.b == true); + EXPECT_EQ(item.a, static_cast(i)); + EXPECT_TRUE(item.b); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4); } { @@ -431,12 +371,12 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe while (iter.Next()) { auto & item = iter.GetValue(); - NL_TEST_ASSERT(apSuite, item == static_cast(i + 10000)); + EXPECT_EQ(item, static_cast(i + 10000)); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4); } { @@ -450,15 +390,15 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe unsigned int j = 0; for (; j < item.size(); j++) { - NL_TEST_ASSERT(apSuite, item.data()[j] == j); + EXPECT_EQ(item.data()[j], j); } - NL_TEST_ASSERT(apSuite, j == 4); + EXPECT_EQ(j, 4u); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4); } { @@ -468,24 +408,19 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe while (iter.Next()) { auto & item = iter.GetValue(); - NL_TEST_ASSERT(apSuite, item == i); + EXPECT_EQ(item, i); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4); } } } - -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDoubleNestedStructList(nlTestSuite * apSuite, - void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecDecodableDoubleNestedStructList) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -510,13 +445,10 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDo item.d = structList; } - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -525,10 +457,9 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDo { Clusters::UnitTesting::Structs::DoubleNestedStructList::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); uint8_t i = 0; @@ -543,26 +474,23 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDo { auto & nestedItem = nestedIter.GetValue(); - NL_TEST_ASSERT(apSuite, nestedItem.a == (static_cast(35) + j)); + EXPECT_EQ(nestedItem.a, (static_cast(35) + j)); j++; } - NL_TEST_ASSERT(apSuite, j == 4); + EXPECT_EQ(j, 4u); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4u); } } -void TestDataModelSerialization::TestDataModelSerialization_OptionalFields(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, OptionalFields) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -581,18 +509,18 @@ void TestDataModelSerialization::TestDataModelSerialization_OptionalFields(nlTes // Encode every field manually except a. { - err = EncodeStruct(_this->mWriter, TLV::AnonymousTag(), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ( + EncodeStruct(mWriter, TLV::AnonymousTag(), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -601,38 +529,33 @@ void TestDataModelSerialization::TestDataModelSerialization_OptionalFields(nlTes { Clusters::UnitTesting::Structs::SimpleStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); // Set the value of a to a specific value, and ensure it is not over-written after decode. t.a = 150; - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); // Ensure that the decoder did not over-write the value set in the generated object - NL_TEST_ASSERT(apSuite, t.a == 150); + EXPECT_EQ(t.a, 150); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c == Clusters::UnitTesting::SimpleEnum::kValueA); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c, Clusters::UnitTesting::SimpleEnum::kValueA); - NL_TEST_ASSERT(apSuite, t.d.size() == 4); + EXPECT_EQ(t.d.size(), 4u); for (uint32_t i = 0; i < t.d.size(); i++) { - NL_TEST_ASSERT(apSuite, t.d.data()[i] == i); + EXPECT_EQ(t.d.data()[i], i); } - NL_TEST_ASSERT(apSuite, StringMatches(t.e, "chip")); + EXPECT_TRUE(StringMatches(t.e, "chip")); } } -void TestDataModelSerialization::TestDataModelSerialization_ExtraField(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, ExtraField) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -651,22 +574,21 @@ void TestDataModelSerialization::TestDataModelSerialization_ExtraField(nlTestSui // Encode every field + an extra field. { - err = EncodeStruct( - _this->mWriter, TLV::AnonymousTag(), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kA), t.a), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e), - MakeTagValuePair(TLV::ContextTag(to_underlying(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE) + 1), - t.a)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(EncodeStruct( + mWriter, TLV::AnonymousTag(), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kA), t.a), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e), + MakeTagValuePair( + TLV::ContextTag(to_underlying(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE) + 1), t.a)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -675,35 +597,29 @@ void TestDataModelSerialization::TestDataModelSerialization_ExtraField(nlTestSui { Clusters::UnitTesting::Structs::SimpleStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); // Ensure successful decode despite the extra field. - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, t.a == 20); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c == Clusters::UnitTesting::SimpleEnum::kValueA); + EXPECT_EQ(t.a, 20); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c, Clusters::UnitTesting::SimpleEnum::kValueA); - NL_TEST_ASSERT(apSuite, t.d.size() == 4); + EXPECT_EQ(t.d.size(), 4u); for (uint32_t i = 0; i < t.d.size(); i++) { - NL_TEST_ASSERT(apSuite, t.d.data()[i] == i); + EXPECT_EQ(t.d.data()[i], i); } - NL_TEST_ASSERT(apSuite, StringMatches(t.e, "chip")); + EXPECT_TRUE(StringMatches(t.e, "chip")); } } -void TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTypes(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, InvalidSimpleFieldTypes) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - - _this->mpSuite = apSuite; - _this->SetupBuf(); - + SetupBuf(); // // Case #1: Swap out field a (an integer) with a boolean. // @@ -725,37 +641,32 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTy // Encode every field manually except a. { - err = - EncodeStruct(_this->mWriter, TLV::AnonymousTag(), + EXPECT_EQ( + EncodeStruct(mWriter, TLV::AnonymousTag(), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kA), t.b), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - _this->DumpBuf(); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); + DumpBuf(); } - // // Decode // { Clusters::UnitTesting::Structs::SimpleStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err != CHIP_NO_ERROR); + EXPECT_NE(DataModel::Decode(mReader, t), CHIP_NO_ERROR); } } - _this->SetupBuf(); - + SetupBuf(); // // Case #2: Swap out an octet string with a UTF-8 string. // @@ -777,20 +688,19 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTy // Encode every field manually except a. { - err = - EncodeStruct(_this->mWriter, TLV::AnonymousTag(), + EXPECT_EQ( + EncodeStruct(mWriter, TLV::AnonymousTag(), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kA), t.a), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.e), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -799,21 +709,16 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTy { Clusters::UnitTesting::Structs::SimpleStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err != CHIP_NO_ERROR); + EXPECT_NE(DataModel::Decode(mReader, t), CHIP_NO_ERROR); } } } -void TestDataModelSerialization::TestDataModelSerialization_InvalidListType(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, InvalidListType) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -826,16 +731,14 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidListType(nlTe // Encode a list of integers for field d instead of a list of structs. { - err = - EncodeStruct(_this->mWriter, TLV::AnonymousTag(), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::NestedStructList::Fields::kD), t.e)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ( + EncodeStruct(mWriter, TLV::AnonymousTag(), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::NestedStructList::Fields::kD), t.e)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - _this->DumpBuf(); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); + DumpBuf(); } // @@ -844,10 +747,9 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidListType(nlTe { Clusters::UnitTesting::Structs::NestedStructList::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); auto iter = t.d.begin(); bool hadItems = false; @@ -857,8 +759,8 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidListType(nlTe hadItems = true; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() != CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, !hadItems); + EXPECT_NE(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_FALSE(hadItems); } } @@ -905,13 +807,10 @@ bool ListsEqual(const DataModel::DecodableList & list1, const DataModel::List } // anonymous namespace template -void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck(nlTestSuite * apSuite, void * apContext, bool encodeNulls, - bool encodeValues) +void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck(bool encodeNulls, bool encodeValues) { - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); static const char structStr[] = "something"; const uint8_t structBytes[] = { 1, 8, 17 }; @@ -974,161 +873,117 @@ void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck(nlTestSuite encodable.nullableList.SetNull(); } - CHIP_ERROR err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), encodable); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), encodable), CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); } // Decode { - _this->SetupReader(); + SetupReader(); Decodable decodable; - CHIP_ERROR err = DataModel::Decode(_this->mReader, decodable); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, decodable), CHIP_NO_ERROR); if (encodeNulls) { - NL_TEST_ASSERT(apSuite, decodable.nullableInt.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalInt.Value().IsNull()); - - NL_TEST_ASSERT(apSuite, decodable.nullableString.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalString.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalString.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalString.Value().IsNull()); - - NL_TEST_ASSERT(apSuite, decodable.nullableStruct.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalStruct.Value().IsNull()); - - NL_TEST_ASSERT(apSuite, decodable.nullableList.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalList.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalList.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalList.Value().IsNull()); + EXPECT_TRUE(decodable.nullableInt.IsNull()); + EXPECT_FALSE(decodable.optionalInt.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalInt.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalInt.Value().IsNull()); + + EXPECT_TRUE(decodable.nullableString.IsNull()); + EXPECT_FALSE(decodable.optionalString.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalString.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalString.Value().IsNull()); + + EXPECT_TRUE(decodable.nullableStruct.IsNull()); + EXPECT_FALSE(decodable.optionalStruct.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalStruct.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalStruct.Value().IsNull()); + + EXPECT_TRUE(decodable.nullableList.IsNull()); + EXPECT_FALSE(decodable.optionalList.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalList.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalList.Value().IsNull()); } else if (encodeValues) { static const char str[] = "abc"; CharSpan strSpan = CharSpan::fromCharString(str); - NL_TEST_ASSERT(apSuite, !decodable.nullableInt.IsNull()); - NL_TEST_ASSERT(apSuite, decodable.nullableInt.Value() == 5); - NL_TEST_ASSERT(apSuite, decodable.optionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.optionalInt.Value() == 6); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalInt.Value().IsNull()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalInt.Value().Value() == 7); - - NL_TEST_ASSERT(apSuite, !decodable.nullableString.IsNull()); - NL_TEST_ASSERT(apSuite, decodable.nullableString.Value().data_equal(strSpan)); - NL_TEST_ASSERT(apSuite, decodable.optionalString.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.optionalString.Value().data_equal(strSpan)); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalString.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalString.Value().IsNull()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalString.Value().Value().data_equal(strSpan)); - - NL_TEST_ASSERT(apSuite, !decodable.nullableStruct.IsNull()); - NL_TEST_ASSERT(apSuite, SimpleStructsEqual(decodable.nullableStruct.Value(), myStruct)); - NL_TEST_ASSERT(apSuite, decodable.optionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, SimpleStructsEqual(decodable.optionalStruct.Value(), myStruct)); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalStruct.Value().IsNull()); - NL_TEST_ASSERT(apSuite, SimpleStructsEqual(decodable.nullableOptionalStruct.Value().Value(), myStruct)); - - NL_TEST_ASSERT(apSuite, !decodable.nullableList.IsNull()); - NL_TEST_ASSERT(apSuite, ListsEqual(decodable.nullableList.Value(), enumList)); - NL_TEST_ASSERT(apSuite, decodable.optionalList.HasValue()); - NL_TEST_ASSERT(apSuite, ListsEqual(decodable.optionalList.Value(), enumList)); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalList.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalList.Value().IsNull()); - NL_TEST_ASSERT(apSuite, ListsEqual(decodable.nullableOptionalList.Value().Value(), enumList)); + EXPECT_FALSE(decodable.nullableInt.IsNull()); + EXPECT_EQ(decodable.nullableInt.Value(), 5); + EXPECT_TRUE(decodable.optionalInt.HasValue()); + EXPECT_EQ(decodable.optionalInt.Value(), 6); + EXPECT_TRUE(decodable.nullableOptionalInt.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalInt.Value().IsNull()); + EXPECT_EQ(decodable.nullableOptionalInt.Value().Value(), 7); + + EXPECT_FALSE(decodable.nullableString.IsNull()); + EXPECT_TRUE(decodable.nullableString.Value().data_equal(strSpan)); + EXPECT_TRUE(decodable.optionalString.HasValue()); + EXPECT_TRUE(decodable.optionalString.Value().data_equal(strSpan)); + EXPECT_TRUE(decodable.nullableOptionalString.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalString.Value().IsNull()); + EXPECT_TRUE(decodable.nullableOptionalString.Value().Value().data_equal(strSpan)); + + EXPECT_FALSE(decodable.nullableStruct.IsNull()); + EXPECT_TRUE(SimpleStructsEqual(decodable.nullableStruct.Value(), myStruct)); + EXPECT_TRUE(decodable.optionalStruct.HasValue()); + EXPECT_TRUE(SimpleStructsEqual(decodable.optionalStruct.Value(), myStruct)); + EXPECT_TRUE(decodable.nullableOptionalStruct.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalStruct.Value().IsNull()); + EXPECT_TRUE(SimpleStructsEqual(decodable.nullableOptionalStruct.Value().Value(), myStruct)); + + EXPECT_FALSE(decodable.nullableList.IsNull()); + EXPECT_TRUE(ListsEqual(decodable.nullableList.Value(), enumList)); + EXPECT_TRUE(decodable.optionalList.HasValue()); + EXPECT_TRUE(ListsEqual(decodable.optionalList.Value(), enumList)); + EXPECT_TRUE(decodable.nullableOptionalList.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalList.Value().IsNull()); + EXPECT_TRUE(ListsEqual(decodable.nullableOptionalList.Value().Value(), enumList)); } else { - NL_TEST_ASSERT(apSuite, decodable.nullableInt.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalInt.HasValue()); + EXPECT_TRUE(decodable.nullableInt.IsNull()); + EXPECT_FALSE(decodable.optionalInt.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableString.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalString.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalString.HasValue()); + EXPECT_TRUE(decodable.nullableString.IsNull()); + EXPECT_FALSE(decodable.optionalString.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalString.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableStruct.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalStruct.HasValue()); + EXPECT_TRUE(decodable.nullableStruct.IsNull()); + EXPECT_FALSE(decodable.optionalStruct.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableList.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalList.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalList.HasValue()); + EXPECT_TRUE(decodable.nullableList.IsNull()); + EXPECT_FALSE(decodable.optionalList.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalList.HasValue()); } } } template -void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck(nlTestSuite * apSuite, void * apContext) +void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck() { - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext, false, false); - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext, true, false); - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext, false, true); + NullablesOptionalsEncodeDecodeCheck(false, false); + NullablesOptionalsEncodeDecodeCheck(true, false); + NullablesOptionalsEncodeDecodeCheck(false, true); } -void TestDataModelSerialization::NullablesOptionalsStruct(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, NullablesOptionalsStruct) { using EncType = Clusters::UnitTesting::Structs::NullablesAndOptionalsStruct::Type; using DecType = Clusters::UnitTesting::Structs::NullablesAndOptionalsStruct::DecodableType; - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext); + NullablesOptionalsEncodeDecodeCheck(); } -void TestDataModelSerialization::NullablesOptionalsCommand(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, NullablesOptionalsCommand) { using EncType = Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::Type; using DecType = Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::DecodableType; - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext); -} - -int Initialize(void * apSuite) -{ - VerifyOrReturnError(chip::Platform::MemoryInit() == CHIP_NO_ERROR, FAILURE); - return SUCCESS; -} - -int Finalize(void * aContext) -{ - gTestDataModelSerialization.Shutdown(); - chip::Platform::MemoryShutdown(); - return SUCCESS; + NullablesOptionalsEncodeDecodeCheck(); } } // namespace - -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestDataModelSerialization_EncAndDecSimple", TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruct), - NL_TEST_DEF("TestDataModelSerialization_EncAndDecSimpleStructNegativeEnum", TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStructNegativeEnum), - NL_TEST_DEF("TestDataModelSerialization_EncAndDecNestedStruct", TestDataModelSerialization::TestDataModelSerialization_EncAndDecNestedStruct), - NL_TEST_DEF("TestDataModelSerialization_EncAndDecDecodableNestedStructList", TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNestedStructList), - NL_TEST_DEF("TestDataModelSerialization_EncAndDecDecodableDoubleNestedStructList", TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDoubleNestedStructList), - NL_TEST_DEF("TestDataModelSerialization_OptionalFields", TestDataModelSerialization::TestDataModelSerialization_OptionalFields), - NL_TEST_DEF("TestDataModelSerialization_ExtraField", TestDataModelSerialization::TestDataModelSerialization_ExtraField), - NL_TEST_DEF("TestDataModelSerialization_InvalidSimpleFieldTypes", TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTypes), - NL_TEST_DEF("TestDataModelSerialization_InvalidListType", TestDataModelSerialization::TestDataModelSerialization_InvalidListType), - NL_TEST_DEF("TestDataModelSerialization_NullablesOptionalsStruct", TestDataModelSerialization::NullablesOptionalsStruct), - NL_TEST_DEF("TestDataModelSerialization_NullablesOptionalsCommand", TestDataModelSerialization::NullablesOptionalsCommand), - NL_TEST_SENTINEL() -}; -// clang-format on - -nlTestSuite theSuite = { "TestDataModelSerialization", &sTests[0], Initialize, Finalize }; - -int DataModelSerializationTest() -{ - nlTestRunner(&theSuite, &gTestDataModelSerialization); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(DataModelSerializationTest) diff --git a/src/app/tests/TestDefaultOTARequestorStorage.cpp b/src/app/tests/TestDefaultOTARequestorStorage.cpp index 1b4e9b0a3bc5ed..53ee108e73f8b6 100644 --- a/src/app/tests/TestDefaultOTARequestorStorage.cpp +++ b/src/app/tests/TestDefaultOTARequestorStorage.cpp @@ -19,16 +19,16 @@ #include #include #include -#include -#include +#include +#include using namespace chip; using namespace chip::DeviceLayer; namespace { -void TestDefaultProviders(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestDefaultProviders) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -43,49 +43,49 @@ void TestDefaultProviders(nlTestSuite * inSuite, void * inContext) }; ProviderLocationList providers = {}; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == providers.Add(makeProvider(FabricIndex(1), NodeId(0x11111111), EndpointId(1)))); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == providers.Add(makeProvider(FabricIndex(2), NodeId(0x22222222), EndpointId(2)))); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == providers.Add(makeProvider(FabricIndex(3), NodeId(0x33333333), EndpointId(3)))); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreDefaultProviders(providers)); + EXPECT_EQ(CHIP_NO_ERROR, providers.Add(makeProvider(FabricIndex(1), NodeId(0x11111111), EndpointId(1)))); + EXPECT_EQ(CHIP_NO_ERROR, providers.Add(makeProvider(FabricIndex(2), NodeId(0x22222222), EndpointId(2)))); + EXPECT_EQ(CHIP_NO_ERROR, providers.Add(makeProvider(FabricIndex(3), NodeId(0x33333333), EndpointId(3)))); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreDefaultProviders(providers)); providers = {}; - NL_TEST_ASSERT(inSuite, !providers.Begin().Next()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadDefaultProviders(providers)); + EXPECT_FALSE(providers.Begin().Next()); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadDefaultProviders(providers)); auto provider = providers.Begin(); bool hasNext; - NL_TEST_ASSERT(inSuite, hasNext = provider.Next()); + EXPECT_TRUE(hasNext = provider.Next()); if (hasNext) { - NL_TEST_ASSERT(inSuite, provider.GetValue().fabricIndex == 1); - NL_TEST_ASSERT(inSuite, provider.GetValue().providerNodeID == 0x11111111); - NL_TEST_ASSERT(inSuite, provider.GetValue().endpoint == 1); + EXPECT_EQ(provider.GetValue().fabricIndex, 1); + EXPECT_EQ(provider.GetValue().providerNodeID, 0x11111111u); + EXPECT_EQ(provider.GetValue().endpoint, 1); } - NL_TEST_ASSERT(inSuite, hasNext = provider.Next()); + EXPECT_TRUE(hasNext = provider.Next()); if (hasNext) { - NL_TEST_ASSERT(inSuite, provider.GetValue().fabricIndex == 2); - NL_TEST_ASSERT(inSuite, provider.GetValue().providerNodeID == 0x22222222); - NL_TEST_ASSERT(inSuite, provider.GetValue().endpoint == 2); + EXPECT_EQ(provider.GetValue().fabricIndex, 2); + EXPECT_EQ(provider.GetValue().providerNodeID, 0x22222222u); + EXPECT_EQ(provider.GetValue().endpoint, 2); } - NL_TEST_ASSERT(inSuite, hasNext = provider.Next()); + EXPECT_TRUE(hasNext = provider.Next()); if (hasNext) { - NL_TEST_ASSERT(inSuite, provider.GetValue().fabricIndex == 3); - NL_TEST_ASSERT(inSuite, provider.GetValue().providerNodeID == 0x33333333); - NL_TEST_ASSERT(inSuite, provider.GetValue().endpoint == 3); + EXPECT_EQ(provider.GetValue().fabricIndex, 3); + EXPECT_EQ(provider.GetValue().providerNodeID, 0x33333333u); + EXPECT_EQ(provider.GetValue().endpoint, 3); } - NL_TEST_ASSERT(inSuite, !provider.Next()); + EXPECT_FALSE(provider.Next()); } -void TestDefaultProvidersEmpty(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestDefaultProvidersEmpty) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -93,11 +93,11 @@ void TestDefaultProvidersEmpty(nlTestSuite * inSuite, void * inContext) ProviderLocationList providers = {}; - NL_TEST_ASSERT(inSuite, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == otaStorage.LoadDefaultProviders(providers)); - NL_TEST_ASSERT(inSuite, !providers.Begin().Next()); + EXPECT_EQ(CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND, otaStorage.LoadDefaultProviders(providers)); + EXPECT_FALSE(providers.Begin().Next()); } -void TestCurrentProviderLocation(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestCurrentProviderLocation) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -108,19 +108,19 @@ void TestCurrentProviderLocation(nlTestSuite * inSuite, void * inContext) provider.providerNodeID = 0x12344321; provider.endpoint = 10; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreCurrentProviderLocation(provider)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreCurrentProviderLocation(provider)); provider = {}; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadCurrentProviderLocation(provider)); - NL_TEST_ASSERT(inSuite, provider.fabricIndex == 1); - NL_TEST_ASSERT(inSuite, provider.providerNodeID == 0x12344321); - NL_TEST_ASSERT(inSuite, provider.endpoint == 10); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearCurrentProviderLocation()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadCurrentProviderLocation(provider)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadCurrentProviderLocation(provider)); + EXPECT_EQ(provider.fabricIndex, 1); + EXPECT_EQ(provider.providerNodeID, 0x12344321u); + EXPECT_EQ(provider.endpoint, 10); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.ClearCurrentProviderLocation()); + EXPECT_NE(CHIP_NO_ERROR, otaStorage.LoadCurrentProviderLocation(provider)); } -void TestUpdateToken(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestUpdateToken) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -133,21 +133,21 @@ void TestUpdateToken(nlTestSuite * inSuite, void * inContext) for (uint8_t i = 0; i < updateTokenLength; ++i) updateTokenBuffer[i] = i; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreUpdateToken(updateToken)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreUpdateToken(updateToken)); uint8_t readBuffer[updateTokenLength + 10]; MutableByteSpan readUpdateToken(readBuffer); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadUpdateToken(readUpdateToken)); - NL_TEST_ASSERT(inSuite, readUpdateToken.size() == updateTokenLength); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadUpdateToken(readUpdateToken)); + EXPECT_EQ(readUpdateToken.size(), updateTokenLength); for (uint8_t i = 0; i < updateTokenLength; ++i) - NL_TEST_ASSERT(inSuite, readBuffer[i] == i); + EXPECT_EQ(readBuffer[i], i); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearUpdateToken()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadUpdateToken(readUpdateToken)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.ClearUpdateToken()); + EXPECT_NE(CHIP_NO_ERROR, otaStorage.LoadUpdateToken(readUpdateToken)); } -void TestCurrentUpdateState(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestCurrentUpdateState) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -155,17 +155,17 @@ void TestCurrentUpdateState(nlTestSuite * inSuite, void * inContext) OTARequestorStorage::OTAUpdateStateEnum updateState = OTARequestorStorage::OTAUpdateStateEnum::kApplying; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreCurrentUpdateState(updateState)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreCurrentUpdateState(updateState)); updateState = OTARequestorStorage::OTAUpdateStateEnum::kUnknown; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadCurrentUpdateState(updateState)); - NL_TEST_ASSERT(inSuite, updateState == OTARequestorStorage::OTAUpdateStateEnum::kApplying); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearCurrentUpdateState()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadCurrentUpdateState(updateState)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadCurrentUpdateState(updateState)); + EXPECT_EQ(updateState, OTARequestorStorage::OTAUpdateStateEnum::kApplying); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.ClearCurrentUpdateState()); + EXPECT_NE(CHIP_NO_ERROR, otaStorage.LoadCurrentUpdateState(updateState)); } -void TestTargetVersion(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestTargetVersion) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -173,43 +173,14 @@ void TestTargetVersion(nlTestSuite * inSuite, void * inContext) uint32_t targetVersion = 2; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreTargetVersion(targetVersion)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreTargetVersion(targetVersion)); targetVersion = 0; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadTargetVersion(targetVersion)); - NL_TEST_ASSERT(inSuite, targetVersion == 2); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearTargetVersion()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadTargetVersion(targetVersion)); -} - -const nlTest sTests[] = { NL_TEST_DEF("Test default providers", TestDefaultProviders), - NL_TEST_DEF("Test default providers (empty list)", TestDefaultProvidersEmpty), - NL_TEST_DEF("Test current provider location", TestCurrentProviderLocation), - NL_TEST_DEF("Test update token", TestUpdateToken), - NL_TEST_DEF("Test current update state", TestCurrentUpdateState), - NL_TEST_DEF("Test target version", TestTargetVersion), - NL_TEST_SENTINEL() }; - -int TestSetup(void * inContext) -{ - return SUCCESS; -} - -int TestTearDown(void * inContext) -{ - return SUCCESS; + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadTargetVersion(targetVersion)); + EXPECT_EQ(targetVersion, 2u); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.ClearTargetVersion()); + EXPECT_NE(CHIP_NO_ERROR, otaStorage.LoadTargetVersion(targetVersion)); } } // namespace - -int TestDefaultOTARequestorStorage() -{ - nlTestSuite theSuite = { "OTA Storage tests", &sTests[0], TestSetup, TestTearDown }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestDefaultOTARequestorStorage) diff --git a/src/app/tests/TestEventPathParams.cpp b/src/app/tests/TestEventPathParams.cpp index da0b3315290815..a962a6b7e43d75 100644 --- a/src/app/tests/TestEventPathParams.cpp +++ b/src/app/tests/TestEventPathParams.cpp @@ -16,65 +16,120 @@ * limitations under the License. */ -/** - * @file - * This file implements unit tests for EventPathParams - * - */ - #include -#include -#include +#include +#include +#include + +using namespace chip::Test; namespace chip { namespace app { namespace TestEventPathParams { -void TestSamePath(nlTestSuite * apSuite, void * apContext) + +class TestEventPathParams : public ::testing::Test +{ +public: + static void SetUpTestSuite() { InitEventPaths(); } + + static void InitEventPaths(); + + static chip::app::EventPathParams validEventpaths[6]; +}; + +chip::app::EventPathParams TestEventPathParams::validEventpaths[6]; + +TEST_F(TestEventPathParams, SamePath) { EventPathParams eventPathParams1(2, 3, 4); EventPathParams eventPathParams2(2, 3, 4); - NL_TEST_ASSERT(apSuite, eventPathParams1.IsSamePath(eventPathParams2)); + EXPECT_TRUE(eventPathParams1.IsSamePath(eventPathParams2)); } -void TestDifferentEndpointId(nlTestSuite * apSuite, void * apContext) +TEST_F(TestEventPathParams, DifferentEndpointId) { EventPathParams eventPathParams1(2, 3, 4); EventPathParams eventPathParams2(6, 3, 4); - NL_TEST_ASSERT(apSuite, !eventPathParams1.IsSamePath(eventPathParams2)); + EXPECT_FALSE(eventPathParams1.IsSamePath(eventPathParams2)); } -void TestDifferentClusterId(nlTestSuite * apSuite, void * apContext) +TEST_F(TestEventPathParams, DifferentClusterId) { EventPathParams eventPathParams1(2, 3, 4); EventPathParams eventPathParams2(2, 6, 4); - NL_TEST_ASSERT(apSuite, !eventPathParams1.IsSamePath(eventPathParams2)); + EXPECT_FALSE(eventPathParams1.IsSamePath(eventPathParams2)); } -void TestDifferentEventId(nlTestSuite * apSuite, void * apContext) +TEST_F(TestEventPathParams, DifferentEventId) { EventPathParams eventPathParams1(2, 3, 4); EventPathParams eventPathParams2(2, 3, 6); - NL_TEST_ASSERT(apSuite, !eventPathParams1.IsSamePath(eventPathParams2)); + EXPECT_FALSE(eventPathParams1.IsSamePath(eventPathParams2)); } -} // namespace TestEventPathParams -} // namespace app -} // namespace chip -namespace { -const nlTest sTests[] = { NL_TEST_DEF("TestSamePath", chip::app::TestEventPathParams::TestSamePath), - NL_TEST_DEF("TestDifferentEndpointId", chip::app::TestEventPathParams::TestDifferentEndpointId), - NL_TEST_DEF("TestDifferentClusterId", chip::app::TestEventPathParams::TestDifferentClusterId), - NL_TEST_DEF("TestDifferentEventId", chip::app::TestEventPathParams::TestDifferentEventId), - NL_TEST_SENTINEL() }; +/* after Init, validEventpaths array will have the following values: +{kInvalidEndpointId, kInvalidClusterId, kInvalidEventId}, +{kInvalidEndpointId, MockClusterId(1), kInvalidEventId}, +{kInvalidEndpointId, MockClusterId(1), MockEventId(1)}, +{kMockEndpoint1, kInvalidClusterId, kInvalidEventId}, +{kMockEndpoint1, MockClusterId(1), kInvalidEventId}, +{kMockEndpoint1, MockClusterId(1), MockEventId(1)}, +*/ +void TestEventPathParams::InitEventPaths() +{ + validEventpaths[1].mClusterId = MockClusterId(1); + validEventpaths[2].mClusterId = MockClusterId(1); + validEventpaths[2].mEventId = MockEventId(1); + validEventpaths[3].mEndpointId = kMockEndpoint1; + validEventpaths[4].mEndpointId = kMockEndpoint1; + validEventpaths[4].mClusterId = MockClusterId(1); + validEventpaths[5].mEndpointId = kMockEndpoint1; + validEventpaths[5].mClusterId = MockClusterId(1); + validEventpaths[5].mEventId = MockEventId(1); } -int TestEventPathParams() +TEST_F(TestEventPathParams, ConcreteEventPathSameEventId) +{ + ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(1), MockEventId(1)); + for (auto & path : validEventpaths) + { + EXPECT_TRUE(path.IsValidEventPath()); + EXPECT_TRUE(path.IsEventPathSupersetOf(testPath)); + } +} +TEST_F(TestEventPathParams, ConcreteEventPathDifferentEndpointId) { - nlTestSuite theSuite = { "EventPathParams", &sTests[0], nullptr, nullptr }; + ConcreteEventPath testPath(kMockEndpoint2, MockClusterId(1), MockEventId(1)); + EXPECT_TRUE(validEventpaths[0].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[1].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[2].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[3].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[4].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[5].IsEventPathSupersetOf(testPath)); +} - nlTestRunner(&theSuite, nullptr); +TEST_F(TestEventPathParams, ConcreteEventPathDifferentClusterId) +{ + ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(2), MockEventId(1)); + EXPECT_TRUE(validEventpaths[0].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[1].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[2].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[3].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[4].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[5].IsEventPathSupersetOf(testPath)); +} - return (nlTestRunnerStats(&theSuite)); +TEST_F(TestEventPathParams, ConcreteEventPathDifferentEventId) +{ + ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(1), MockEventId(2)); + EXPECT_TRUE(validEventpaths[0].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[1].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[2].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[3].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[4].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[5].IsEventPathSupersetOf(testPath)); } -CHIP_REGISTER_TEST_SUITE(TestEventPathParams) +} // namespace TestEventPathParams +} // namespace app +} // namespace chip diff --git a/src/app/tests/TestExtensionFieldSets.cpp b/src/app/tests/TestExtensionFieldSets.cpp index 2c7fb4e37a2929..66b4e9e72ad891 100644 --- a/src/app/tests/TestExtensionFieldSets.cpp +++ b/src/app/tests/TestExtensionFieldSets.cpp @@ -19,8 +19,9 @@ #include #include #include -#include -#include + +#include +#include using namespace chip; @@ -53,7 +54,14 @@ static const scenes::ExtensionFieldSet EFS3(kColorControlClusterId, colorControl static scenes::ExtensionFieldSetsImpl sEFSets; -void TestInsertExtensionFieldSet(nlTestSuite * aSuite, void * aContext) +class TestExtensionFieldSets : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestExtensionFieldSets, TestInsertExtensionFieldSet) { scenes::ExtensionFieldSetsImpl * EFS = &sEFSets; scenes::ExtensionFieldSetsImpl testEFS1; @@ -68,118 +76,118 @@ void TestInsertExtensionFieldSet(nlTestSuite * aSuite, void * aContext) memset(double_size_buffer, static_cast(1), sizeof(double_size_buffer)); - NL_TEST_ASSERT(aSuite, true == EFS->IsEmpty()); + EXPECT_TRUE(EFS->IsEmpty()); // Test creators of single ExtensionFieldSet - NL_TEST_ASSERT(aSuite, EFS1.mID == kOnOffClusterId); - NL_TEST_ASSERT(aSuite, EFS1.mUsedBytes == kOnOffSize); - NL_TEST_ASSERT(aSuite, !memcmp(onOffBuffer, EFS1.mBytesBuffer, EFS1.mUsedBytes)); + EXPECT_EQ(EFS1.mID, kOnOffClusterId); + EXPECT_EQ(EFS1.mUsedBytes, kOnOffSize); + EXPECT_EQ(memcmp(onOffBuffer, EFS1.mBytesBuffer, EFS1.mUsedBytes), 0); - NL_TEST_ASSERT(aSuite, EFS2.mID == kLevelControlClusterId); - NL_TEST_ASSERT(aSuite, EFS2.mUsedBytes == kLevelControlSize); - NL_TEST_ASSERT(aSuite, !memcmp(levelControlBuffer, EFS2.mBytesBuffer, EFS2.mUsedBytes)); + EXPECT_EQ(EFS2.mID, kLevelControlClusterId); + EXPECT_EQ(EFS2.mUsedBytes, kLevelControlSize); + EXPECT_EQ(memcmp(levelControlBuffer, EFS2.mBytesBuffer, EFS2.mUsedBytes), 0); - NL_TEST_ASSERT(aSuite, EFS3.mID == kColorControlClusterId); - NL_TEST_ASSERT(aSuite, EFS3.mUsedBytes == kColorControlSize); - NL_TEST_ASSERT(aSuite, !memcmp(colorControlBuffer, EFS3.mBytesBuffer, EFS3.mUsedBytes)); + EXPECT_EQ(EFS3.mID, kColorControlClusterId); + EXPECT_EQ(EFS3.mUsedBytes, kColorControlSize); + EXPECT_EQ(memcmp(colorControlBuffer, EFS3.mBytesBuffer, EFS3.mUsedBytes), 0); // operator tests single EFS tempEFS = EFS1; - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); + EXPECT_EQ(tempEFS, EFS1); tempEFS = EFS2; - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); + EXPECT_EQ(tempEFS, EFS2); tempEFS = EFS3; - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); + EXPECT_EQ(tempEFS, EFS3); // Test clear EFS tempEFS.Clear(); - NL_TEST_ASSERT(aSuite, tempEFS.IsEmpty()); - NL_TEST_ASSERT(aSuite, tempEFS.mID == kInvalidClusterId); - NL_TEST_ASSERT(aSuite, tempEFS.mUsedBytes == 0); - NL_TEST_ASSERT(aSuite, !memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(tempEFS.mBytesBuffer))); + EXPECT_TRUE(tempEFS.IsEmpty()); + EXPECT_EQ(tempEFS.mID, kInvalidClusterId); + EXPECT_EQ(tempEFS.mUsedBytes, 0); + EXPECT_EQ(memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(tempEFS.mBytesBuffer)), 0); // Test creation of EFS from Array and ByteSpan that are to big tempEFS = scenes::ExtensionFieldSet(kOnOffClusterId, double_size_buffer, sizeof(double_size_buffer)); - NL_TEST_ASSERT(aSuite, tempEFS.mID == kOnOffClusterId); + EXPECT_EQ(tempEFS.mID, kOnOffClusterId); // Confirm EFS empty - NL_TEST_ASSERT(aSuite, tempEFS.mUsedBytes == 0); - NL_TEST_ASSERT(aSuite, !memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(empty_buffer))); + EXPECT_EQ(tempEFS.mUsedBytes, 0); + EXPECT_EQ(memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(empty_buffer)), 0); tempEFS = scenes::ExtensionFieldSet(kLevelControlClusterId, bufferSpan); - NL_TEST_ASSERT(aSuite, tempEFS.mID == kLevelControlClusterId); + EXPECT_EQ(tempEFS.mID, kLevelControlClusterId); // Confirm EFS empty - NL_TEST_ASSERT(aSuite, tempEFS.mUsedBytes == 0); - NL_TEST_ASSERT(aSuite, !memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(empty_buffer))); + EXPECT_EQ(tempEFS.mUsedBytes, 0); + EXPECT_EQ(memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(empty_buffer)), 0); // Test creation of EFS from truncating an Array tempEFS = scenes::ExtensionFieldSet(kColorControlClusterId, double_size_buffer, sizeof(tempEFS.mBytesBuffer)); - NL_TEST_ASSERT(aSuite, tempEFS.mID == kColorControlClusterId); + EXPECT_EQ(tempEFS.mID, kColorControlClusterId); // Confirm EFS was written - NL_TEST_ASSERT(aSuite, tempEFS.mUsedBytes == static_cast(sizeof(tempEFS.mBytesBuffer))); - NL_TEST_ASSERT(aSuite, !memcmp(double_size_buffer, tempEFS.mBytesBuffer, sizeof(tempEFS.mBytesBuffer))); + EXPECT_EQ(tempEFS.mUsedBytes, static_cast(sizeof(tempEFS.mBytesBuffer))); + EXPECT_EQ(memcmp(double_size_buffer, tempEFS.mBytesBuffer, sizeof(tempEFS.mBytesBuffer)), 0); tempEFS.Clear(); - NL_TEST_ASSERT(aSuite, tempEFS.IsEmpty()); + EXPECT_TRUE(tempEFS.IsEmpty()); // Test insertion of uninitialized EFS - NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_ARGUMENT == EFS->InsertFieldSet(tempEFS)); - NL_TEST_ASSERT(aSuite, 0 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_ERROR_INVALID_ARGUMENT, EFS->InsertFieldSet(tempEFS)); + EXPECT_EQ(0, EFS->GetFieldSetCount()); // Test insertion of empty EFS tempEFS.mID = kOnOffClusterId; - NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_ARGUMENT == EFS->InsertFieldSet(tempEFS)); - NL_TEST_ASSERT(aSuite, 0 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_ERROR_INVALID_ARGUMENT, EFS->InsertFieldSet(tempEFS)); + EXPECT_EQ(0, EFS->GetFieldSetCount()); // test operators on multiple EFS struct - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS1.InsertFieldSet(EFS1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS1.InsertFieldSet(EFS2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS1.InsertFieldSet(EFS3)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS1.InsertFieldSet(EFS1)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS1.InsertFieldSet(EFS2)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS1.InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS2.InsertFieldSet(EFS3)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS2.InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS3.InsertFieldSet(EFS1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS3.InsertFieldSet(EFS2)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS3.InsertFieldSet(EFS1)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS3.InsertFieldSet(EFS2)); tempTestEFS = testEFS1; - NL_TEST_ASSERT(aSuite, tempTestEFS == testEFS1); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS2)); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS3)); + EXPECT_EQ(tempTestEFS, testEFS1); + EXPECT_FALSE(tempTestEFS == testEFS2); + EXPECT_FALSE(tempTestEFS == testEFS3); tempTestEFS = testEFS2; - NL_TEST_ASSERT(aSuite, tempTestEFS == testEFS2); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS1)); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS3)); + EXPECT_EQ(tempTestEFS, testEFS2); + EXPECT_FALSE(tempTestEFS == testEFS1); + EXPECT_FALSE(tempTestEFS == testEFS3); tempTestEFS = testEFS3; - NL_TEST_ASSERT(aSuite, tempTestEFS == testEFS3); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS1)); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS2)); + EXPECT_EQ(tempTestEFS, testEFS3); + EXPECT_FALSE(tempTestEFS == testEFS1); + EXPECT_FALSE(tempTestEFS == testEFS2); // test clear multipler efs struct tempTestEFS.Clear(); - NL_TEST_ASSERT(aSuite, tempTestEFS.IsEmpty()); - NL_TEST_ASSERT(aSuite, 0 == tempTestEFS.GetFieldSetCount()); + EXPECT_TRUE(tempTestEFS.IsEmpty()); + EXPECT_EQ(0, tempTestEFS.GetFieldSetCount()); // Test insert - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS1)); - NL_TEST_ASSERT(aSuite, 1 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS1)); + EXPECT_EQ(1, EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS2)); - NL_TEST_ASSERT(aSuite, 2 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS2)); + EXPECT_EQ(2, EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, 3 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS3)); + EXPECT_EQ(3, EFS->GetFieldSetCount()); // Test get - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 0)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 0)); + EXPECT_EQ(tempEFS, EFS1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 1)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 1)); + EXPECT_EQ(tempEFS, EFS2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 2)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 2)); + EXPECT_EQ(tempEFS, EFS3); } -void TestSerializeDerializeExtensionFieldSet(nlTestSuite * aSuite, void * aContext) +TEST_F(TestExtensionFieldSets, TestSerializeDerializeExtensionFieldSet) { scenes::ExtensionFieldSetsImpl * EFS = &sEFSets; scenes::ExtensionFieldSetsImpl testSceneEFS; @@ -203,148 +211,105 @@ void TestSerializeDerializeExtensionFieldSet(nlTestSuite * aSuite, void * aConte // Individual Field Sets serialize / deserialize writer.Init(EFS1Buffer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS1.Serialize(writer)); + EXPECT_EQ(CHIP_NO_ERROR, EFS1.Serialize(writer)); EFS1_serialized_length = writer.GetLengthWritten(); - NL_TEST_ASSERT(aSuite, EFS1_serialized_length <= scenes::kMaxFieldBytesPerCluster); + EXPECT_LE(EFS1_serialized_length, scenes::kMaxFieldBytesPerCluster); writer.Init(EFS2Buffer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS2.Serialize(writer)); + EXPECT_EQ(CHIP_NO_ERROR, EFS2.Serialize(writer)); EFS2_serialized_length = writer.GetLengthWritten(); - NL_TEST_ASSERT(aSuite, EFS2_serialized_length <= scenes::kMaxFieldBytesPerCluster); + EXPECT_LE(EFS2_serialized_length, scenes::kMaxFieldBytesPerCluster); writer.Init(EFS3Buffer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS3.Serialize(writer)); + EXPECT_EQ(CHIP_NO_ERROR, EFS3.Serialize(writer)); EFS3_serialized_length = writer.GetLengthWritten(); - NL_TEST_ASSERT(aSuite, EFS3_serialized_length <= scenes::kMaxFieldBytesPerCluster); + EXPECT_LE(EFS3_serialized_length, scenes::kMaxFieldBytesPerCluster); reader.Init(EFS1Buffer); reader.Next(TLV::AnonymousTag()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == tempEFS.Deserialize(reader)); - NL_TEST_ASSERT(aSuite, EFS1 == tempEFS); + EXPECT_EQ(CHIP_NO_ERROR, tempEFS.Deserialize(reader)); + EXPECT_EQ(EFS1, tempEFS); reader.Init(EFS2Buffer); reader.Next(TLV::AnonymousTag()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == tempEFS.Deserialize(reader)); - NL_TEST_ASSERT(aSuite, EFS2 == tempEFS); + EXPECT_EQ(CHIP_NO_ERROR, tempEFS.Deserialize(reader)); + EXPECT_EQ(EFS2, tempEFS); reader.Init(EFS3Buffer); reader.Next(TLV::AnonymousTag()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == tempEFS.Deserialize(reader)); - NL_TEST_ASSERT(aSuite, EFS3 == tempEFS); + EXPECT_EQ(CHIP_NO_ERROR, tempEFS.Deserialize(reader)); + EXPECT_EQ(EFS3, tempEFS); // All ExtensionFieldSets serialize / deserialize writer.Init(sceneEFSBuffer); writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->Serialize(writer)); + EXPECT_EQ(CHIP_NO_ERROR, EFS->Serialize(writer)); writer.EndContainer(outer); sceneEFS_serialized_length = writer.GetLengthWritten(); - NL_TEST_ASSERT(aSuite, sceneEFS_serialized_length <= kPersistentSceneBufferMax); + EXPECT_LE(sceneEFS_serialized_length, kPersistentSceneBufferMax); reader.Init(sceneEFSBuffer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.EnterContainer(outerRead)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testSceneEFS.Deserialize(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, reader.EnterContainer(outerRead)); + EXPECT_EQ(CHIP_NO_ERROR, testSceneEFS.Deserialize(reader)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.ExitContainer(outerRead)); - NL_TEST_ASSERT(aSuite, *EFS == testSceneEFS); + EXPECT_EQ(CHIP_NO_ERROR, reader.ExitContainer(outerRead)); + EXPECT_EQ(*EFS, testSceneEFS); } -void TestRemoveExtensionFieldSet(nlTestSuite * aSuite, void * aContext) +TEST_F(TestExtensionFieldSets, TestRemoveExtensionFieldSet) { scenes::ExtensionFieldSetsImpl * EFS = &sEFSets; scenes::ExtensionFieldSet tempEFS; // Order in EFS at this point: [EFS1, EFS2, EFS3] // Removal at beginning - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->RemoveFieldAtPosition(0)); - NL_TEST_ASSERT(aSuite, 2 == EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS1)); - NL_TEST_ASSERT(aSuite, 3 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->RemoveFieldAtPosition(0)); + EXPECT_EQ(2, EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS1)); + EXPECT_EQ(3, EFS->GetFieldSetCount()); // Verify order - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 0)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 1)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 2)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 0)); + EXPECT_EQ(tempEFS, EFS2); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 1)); + EXPECT_EQ(tempEFS, EFS3); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 2)); + EXPECT_EQ(tempEFS, EFS1); // Order in EFS at this point: [EFS2, EFS3, EFS1] // Removal at middle - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->RemoveFieldAtPosition(1)); - NL_TEST_ASSERT(aSuite, 2 == EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, 3 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->RemoveFieldAtPosition(1)); + EXPECT_EQ(2, EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS3)); + EXPECT_EQ(3, EFS->GetFieldSetCount()); // Verify order - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 0)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 1)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 2)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 0)); + EXPECT_EQ(tempEFS, EFS2); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 1)); + EXPECT_EQ(tempEFS, EFS1); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 2)); + EXPECT_EQ(tempEFS, EFS3); // Order in EFS at this point: [EFS2, EFS1, EFS3] // Removal at end - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->RemoveFieldAtPosition(2)); - NL_TEST_ASSERT(aSuite, 2 == EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, 3 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->RemoveFieldAtPosition(2)); + EXPECT_EQ(2, EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS3)); + EXPECT_EQ(3, EFS->GetFieldSetCount()); // Verify order - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 0)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 1)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 2)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 0)); + EXPECT_EQ(tempEFS, EFS2); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 1)); + EXPECT_EQ(tempEFS, EFS1); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 2)); + EXPECT_EQ(tempEFS, EFS3); // Emptying the table EFS->Clear(); - NL_TEST_ASSERT(aSuite, true == EFS->IsEmpty()); + EXPECT_TRUE(EFS->IsEmpty()); } } // namespace TestEFS -/** - * Tear down the test suite. - */ -int TestSetup(void * inContext) -{ - VerifyOrReturnError(CHIP_NO_ERROR == chip::Platform::MemoryInit(), FAILURE); - - return SUCCESS; -} - -namespace { -/** - * Setup the test suite. - */ -int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - - return SUCCESS; -} -} // namespace - -int TestExtensionFieldSets() -{ - static nlTest sTests[] = { NL_TEST_DEF("TestInsertExtensionFieldSet", TestEFS::TestInsertExtensionFieldSet), - NL_TEST_DEF("TestSerializeDerializeExtensionFieldSet", - TestEFS::TestSerializeDerializeExtensionFieldSet), - NL_TEST_DEF("TestRemoveExtensionFieldSet", TestEFS::TestRemoveExtensionFieldSet), - - NL_TEST_SENTINEL() }; - - nlTestSuite theSuite = { - "SceneTable", - &sTests[0], - TestSetup, - TestTeardown, - }; - - nlTestRunner(&theSuite, nullptr); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestExtensionFieldSets) diff --git a/src/app/tests/TestSceneTable.cpp b/src/app/tests/TestSceneTable.cpp index 1ce2583c28ab27..1563c286ac3e16 100644 --- a/src/app/tests/TestSceneTable.cpp +++ b/src/app/tests/TestSceneTable.cpp @@ -22,9 +22,9 @@ #include #include #include -#include -#include +#include +#include using namespace chip; using SceneTable = scenes::SceneTable; @@ -425,10 +425,42 @@ class TestSceneTableImpl : public SceneTableImpl uint8_t GetClusterCountFromEndpoint() override { return 3; } }; -// Storage -static chip::TestPersistentStorageDelegate testStorage; -// Scene -static TestSceneHandler sHandler; +// Test Fixture Class +class TestSceneTable : public ::testing::Test +{ +public: + static void SetUpTestSuite() + { + mpTestStorage = new chip::TestPersistentStorageDelegate; + mpSceneHandler = new TestSceneHandler; + + ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); + + // Initialize Scene Table + SceneTable * sceneTable = scenes::GetSceneTableImpl(); + ASSERT_NE(sceneTable, nullptr); + ASSERT_EQ(sceneTable->Init(mpTestStorage), CHIP_NO_ERROR); + } + + static void TearDownTestSuite() + { + // Terminate Scene Table + SceneTable * sceneTable = scenes::GetSceneTableImpl(); + ASSERT_NE(sceneTable, nullptr); + sceneTable->Finish(); + delete mpTestStorage; + delete mpSceneHandler; + chip::Platform::MemoryShutdown(); + } + + // Storage + static chip::TestPersistentStorageDelegate * mpTestStorage; + // Scene + static TestSceneHandler * mpSceneHandler; +}; + +chip::TestPersistentStorageDelegate * TestSceneTable::mpTestStorage = nullptr; +TestSceneHandler * TestSceneTable::mpSceneHandler = nullptr; void ResetSceneTable(SceneTable * sceneTable) { @@ -437,11 +469,10 @@ void ResetSceneTable(SceneTable * sceneTable) sceneTable->RemoveFabric(kFabric3); } -void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestHandlerRegistration) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); TestSceneHandler tmpHandler[scenes::kMaxClustersPerScene]; for (uint8_t i = 0; i < scenes::kMaxClustersPerScene; i++) @@ -453,7 +484,7 @@ void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext) sceneTable->UnregisterAllHandlers(); // Verify the handler num has been updated properly - NL_TEST_ASSERT(aSuite, sceneTable->HandlerListEmpty()); + EXPECT_TRUE(sceneTable->HandlerListEmpty()); for (uint8_t i = 0; i < scenes::kMaxClustersPerScene; i++) { @@ -462,40 +493,38 @@ void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext) // Hanlder order in table : [H0, H1, H2] - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Removal at beginning sceneTable->UnregisterHandler(&tmpHandler[0]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Re-insert sceneTable->RegisterHandler(&tmpHandler[0]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Hanlder order in table : [H0, H1, H2] // Removal at the middle sceneTable->UnregisterHandler(&tmpHandler[2]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Re-insert sceneTable->RegisterHandler(&tmpHandler[2]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Hanlder order in table : [H1, H0, H2] // Removal at the end sceneTable->UnregisterHandler(&tmpHandler[2]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Emptying Handler array sceneTable->UnregisterAllHandlers(); // Verify the handler num has been updated properly - NL_TEST_ASSERT(aSuite, sceneTable->HandlerListEmpty()); + EXPECT_TRUE(sceneTable->HandlerListEmpty()); } -void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestHandlerFunctions) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - + ASSERT_NE(nullptr, sceneTable); app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type extensionFieldSetOut; app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType extensionFieldSetIn; @@ -548,99 +577,91 @@ void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext) // Serialize Extension Field sets as if they were recovered from memory writer.Init(OO_buffer); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), OOextensionFieldSet.attributeValueList)); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), OOextensionFieldSet.attributeValueList)); OO_buffer_serialized_length = writer.GetLengthWritten(); writer.Init(LC_buffer); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), LCextensionFieldSet.attributeValueList)); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), LCextensionFieldSet.attributeValueList)); LC_buffer_serialized_length = writer.GetLengthWritten(); writer.Init(CC_buffer); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), CCextensionFieldSet.attributeValueList)); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), CCextensionFieldSet.attributeValueList)); CC_buffer_serialized_length = writer.GetLengthWritten(); // Test Registering SceneHandler - sceneTable->RegisterHandler(&sHandler); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + sceneTable->RegisterHandler(mpSceneHandler); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Setup the On Off Extension field set in the expected state from a command reader.Init(OO_list); extensionFieldSetIn.clusterID = kOnOffClusterId; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == extensionFieldSetIn.attributeValueList.Decode(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, extensionFieldSetIn.attributeValueList.Decode(reader)); - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sHandler.SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); // Verify the handler extracted buffer matches the initial field sets - NL_TEST_ASSERT(aSuite, 0 == memcmp(OO_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(0, memcmp(OO_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); buff_span = MutableByteSpan(buffer); // Setup the Level Control Extension field set in the expected state from a command reader.Init(LC_list); extensionFieldSetIn.clusterID = kLevelControlClusterId; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == extensionFieldSetIn.attributeValueList.Decode(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, extensionFieldSetIn.attributeValueList.Decode(reader)); - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sHandler.SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); // Verify the handler extracted buffer matches the initial field sets - NL_TEST_ASSERT(aSuite, 0 == memcmp(LC_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(0, memcmp(LC_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); buff_span = MutableByteSpan(buffer); // Setup the Color control Extension field set in the expected state from a command reader.Init(CC_list); extensionFieldSetIn.clusterID = kColorControlClusterId; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == extensionFieldSetIn.attributeValueList.Decode(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, extensionFieldSetIn.attributeValueList.Decode(reader)); - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sHandler.SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); // Verify the handler extracted buffer matches the initial field sets - NL_TEST_ASSERT(aSuite, 0 == memcmp(CC_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(0, memcmp(CC_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); buff_span = MutableByteSpan(buffer); // Verify Deserializing is properly filling out output extension field set for on off - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, kOnOffClusterId)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sHandler.Deserialize(kTestEndpoint1, kOnOffClusterId, OO_list, extensionFieldSetOut)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, kOnOffClusterId)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->Deserialize(kTestEndpoint1, kOnOffClusterId, OO_list, extensionFieldSetOut)); // Verify Encoding the Extension field set returns the same data as the one serialized for on off previously writer.Init(buff_span); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); - NL_TEST_ASSERT(aSuite, 0 == memcmp(OO_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); + EXPECT_EQ(0, memcmp(OO_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); // Verify Deserializing is properly filling out output extension field set for level control - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, kLevelControlClusterId)); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == sHandler.Deserialize(kTestEndpoint1, kLevelControlClusterId, LC_list, extensionFieldSetOut)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, kLevelControlClusterId)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->Deserialize(kTestEndpoint1, kLevelControlClusterId, LC_list, extensionFieldSetOut)); // Verify Encoding the Extension field set returns the same data as the one serialized for level control previously writer.Init(buff_span); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); - NL_TEST_ASSERT(aSuite, 0 == memcmp(LC_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); + EXPECT_EQ(0, memcmp(LC_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); // Verify Deserializing is properly filling out output extension field set for color control - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, kColorControlClusterId)); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == sHandler.Deserialize(kTestEndpoint1, kColorControlClusterId, CC_list, extensionFieldSetOut)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, kColorControlClusterId)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->Deserialize(kTestEndpoint1, kColorControlClusterId, CC_list, extensionFieldSetOut)); // Verify Encoding the Extension field set returns the same data as the one serialized for color control previously writer.Init(buff_span); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); - NL_TEST_ASSERT(aSuite, 0 == memcmp(CC_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); + EXPECT_EQ(0, memcmp(CC_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); // To test failure on serialize and deserialize when too many pairs are in the field sets @@ -663,52 +684,46 @@ void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext) // Serialize Extension Field sets as if they were recovered from memory writer.Init(failBuffer); - NL_TEST_ASSERT( - aSuite, CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldFailTestOut.attributeValueList)); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldFailTestOut.attributeValueList)); // Setup the On Off Extension field set in the expected state from a command reader.Init(fail_list); extensionFieldFailTestIn.clusterID = kColorControlClusterId; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == extensionFieldFailTestIn.attributeValueList.Decode(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, extensionFieldFailTestIn.attributeValueList.Decode(reader)); // Verify failure on both serialize and deserialize - NL_TEST_ASSERT(aSuite, - CHIP_ERROR_BUFFER_TOO_SMALL == sHandler.SerializeAdd(kTestEndpoint1, extensionFieldFailTestIn, buff_span)); - NL_TEST_ASSERT(aSuite, - CHIP_ERROR_BUFFER_TOO_SMALL == - sHandler.Deserialize(kTestEndpoint1, kColorControlClusterId, fail_list, extensionFieldFailTestOut)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, mpSceneHandler->SerializeAdd(kTestEndpoint1, extensionFieldFailTestIn, buff_span)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, + mpSceneHandler->Deserialize(kTestEndpoint1, kColorControlClusterId, fail_list, extensionFieldFailTestOut)); memset(failBuffer, 0, fail_list.size()); memset(buffer, 0, buff_span.size()); }; -void TestHandlerHelpers(nlTestSuite * aSuite, void * aContext) {} - -void TestStoreScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestStoreScenes) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); SceneId sceneList[defaultTestFabricCapacity]; // Reset test ResetSceneTable(sceneTable); // Populate scene1's EFS (Endpoint1) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene1)); // Populate scene2's EFS (Endpoint1) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene2)); // Populate scene3's EFS (Endpoint2) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene3)); // Populate scene4's EFS (Endpoint2) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene4)); // Populate scene8's EFS (Endpoint3) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene8)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene8)); SceneTableEntry scene; Span sceneListSpan = Span(sceneList); @@ -716,272 +731,266 @@ void TestStoreScenes(nlTestSuite * aSuite, void * aContext) Span smallListSpan = Span(sceneList, 1); // Test Get All scenes in Group in empty scene table - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); - NL_TEST_ASSERT(aSuite, 0 == emptyListSpan.size()); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); + EXPECT_EQ(0u, emptyListSpan.size()); // Set test - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); // Test single scene in table with 0 size span - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, smallListSpan)); - NL_TEST_ASSERT(aSuite, 1 == smallListSpan.size()); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, smallListSpan)); + EXPECT_EQ(1u, smallListSpan.size()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); // Too many scenes for 1 fabric - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric1, scene9)); + EXPECT_EQ(CHIP_ERROR_NO_MEMORY, sceneTable->SetSceneTableEntry(kFabric1, scene9)); // Not Found - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); // Get test - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, scene == scene7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(scene, scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(scene, scene6); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(scene, scene7); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); // Test error when list too small in a full table // Test failure for 3 spaces in 4 scenes list - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, smallListSpan)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, smallListSpan)); // Test failure for no space in a 4 scenes list - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); // Test failure for no space in a 1 scene list - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, emptyListSpan)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, smallListSpan)); - NL_TEST_ASSERT(aSuite, 1 == smallListSpan.size()); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, emptyListSpan)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, smallListSpan)); + EXPECT_EQ(1u, smallListSpan.size()); // Test successfully getting Ids from various groups - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, sceneListSpan)); - NL_TEST_ASSERT(aSuite, 4 == sceneListSpan.size()); - NL_TEST_ASSERT(aSuite, kScene1 == sceneList[0]); - NL_TEST_ASSERT(aSuite, kScene2 == sceneList[1]); - NL_TEST_ASSERT(aSuite, kScene3 == sceneList[2]); - NL_TEST_ASSERT(aSuite, kScene4 == sceneList[3]); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup2, sceneListSpan)); - NL_TEST_ASSERT(aSuite, 2 == sceneListSpan.size()); - NL_TEST_ASSERT(aSuite, kScene5 == sceneList[0]); - NL_TEST_ASSERT(aSuite, kScene6 == sceneList[1]); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, sceneListSpan)); - NL_TEST_ASSERT(aSuite, 1 == sceneListSpan.size()); - NL_TEST_ASSERT(aSuite, kScene7 == sceneList[0]); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, sceneListSpan)); + EXPECT_EQ(4u, sceneListSpan.size()); + EXPECT_EQ(kScene1, sceneList[0]); + EXPECT_EQ(kScene2, sceneList[1]); + EXPECT_EQ(kScene3, sceneList[2]); + EXPECT_EQ(kScene4, sceneList[3]); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup2, sceneListSpan)); + EXPECT_EQ(2u, sceneListSpan.size()); + EXPECT_EQ(kScene5, sceneList[0]); + EXPECT_EQ(kScene6, sceneList[1]); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, sceneListSpan)); + EXPECT_EQ(1u, sceneListSpan.size()); + EXPECT_EQ(kScene7, sceneList[0]); uint8_t sceneCount = 0; sceneTable->GetEndpointSceneCount(sceneCount); sceneTable->GetFabricSceneCount(kFabric1, sceneCount); } -void TestOverwriteScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestOverwriteScenes) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); uint8_t sceneCount = 0; sceneTable->GetEndpointSceneCount(sceneCount); sceneTable->GetFabricSceneCount(kFabric1, sceneCount); SceneTableEntry scene; // Overwriting the first entry - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene10)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene10)); // Overwriting in the middle - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene11)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene11)); // Overwriting the last entry - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene12)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene12)); // Scene 10 has the same sceneId as scene 1, Get->sceneId1 should thus return scene 10, etc. - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene10); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene10); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene11); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(scene, scene11); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, scene == scene12); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(scene, scene12); } -void TestIterateScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestIterateScenes) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); SceneTableEntry scene; auto * iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator != nullptr); + ASSERT_NE(iterator, nullptr); if (iterator) { - NL_TEST_ASSERT(aSuite, iterator->Count() == 7); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene10); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene11); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene12); - - NL_TEST_ASSERT(aSuite, iterator->Next(scene) == false); + EXPECT_EQ(iterator->Count(), 7u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene10); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene2); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene3); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene4); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene11); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene6); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene12); + + EXPECT_FALSE(iterator->Next(scene)); iterator->Release(); } } -void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestRemoveScenes) { SceneTableImpl * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); SceneTableEntry scene; // Removing non-existing entry should not return errors - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); // Remove middle - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene5.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene5.mStorageId)); auto * iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 6); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene10); + EXPECT_EQ(iterator->Count(), 6u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene10); iterator->Release(); // Add scene in middle, a spot should have been freed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene9)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene9)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); - NL_TEST_ASSERT(aSuite, scene == scene9); + EXPECT_EQ(iterator->Count(), 7u); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); + EXPECT_EQ(scene, scene9); iterator->Release(); // Remove the recently added scene 9 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 6); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene10); + EXPECT_EQ(iterator->Count(), 6u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene10); iterator->Release(); // Remove first - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, 0)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, 0)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 5); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); + EXPECT_EQ(iterator->Count(), 5u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene2); iterator->Release(); // Remove Next - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 4); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); + EXPECT_EQ(iterator->Count(), 4u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene2); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene4); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 3); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); + EXPECT_EQ(iterator->Count(), 3u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene4); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); + EXPECT_EQ(iterator->Count(), 2u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene6); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene6.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene6.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 1); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene12); + EXPECT_EQ(iterator->Count(), 1u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene12); iterator->Release(); // Remove last - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene7.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene7.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 0); - NL_TEST_ASSERT(aSuite, iterator->Next(scene) == false); + EXPECT_EQ(iterator->Count(), 0u); + EXPECT_FALSE(iterator->Next(scene)); iterator->Release(); // Remove at empty position, shouldn't trigger error - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == - sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, defaultTestFabricCapacity - 1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, defaultTestFabricCapacity - 1)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 0); + EXPECT_EQ(iterator->Count(), 0u); iterator->Release(); // Test Remove all scenes in Group - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 6); + EXPECT_EQ(iterator->Count(), 6u); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->DeleteAllScenesInGroup(kFabric1, kGroup1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->DeleteAllScenesInGroup(kFabric1, kGroup1)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); + EXPECT_EQ(iterator->Count(), 2u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene5); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene6); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->DeleteAllScenesInGroup(kFabric1, kGroup2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->DeleteAllScenesInGroup(kFabric1, kGroup2)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 0); + EXPECT_EQ(iterator->Count(), 0u); iterator->Release(); } -void TestFabricScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestFabricScenes) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); // Reset test ResetSceneTable(sceneTable); @@ -990,234 +999,233 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) uint8_t fabric_capacity = 0; // Verify capacities are at max - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Fabric 1 inserts - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); uint8_t scene_count = 0; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric1, scene_count)); + EXPECT_EQ(defaultTestFabricCapacity, scene_count); // Fabric 2 inserts - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, (defaultTestFabricCapacity - 4) == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 11 == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ((defaultTestFabricCapacity - 4), fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(11, scene_count); // Fabric 3 inserts, should only be 4 spaces left at this point since 12 got taken - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestTableSize - 11 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric3, scene_count)); - NL_TEST_ASSERT(aSuite, 5 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, defaultTestTableSize == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestTableSize - 11, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric3, scene_count)); + EXPECT_EQ(5, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(defaultTestTableSize, scene_count); // Checks capacity is now 0 accross all fabrics - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // To many scenes accross fabrics (Max scenes accross fabrics == 16) - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric3, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_ERROR_NO_MEMORY, sceneTable->SetSceneTableEntry(kFabric3, scene6)); + EXPECT_EQ(CHIP_ERROR_NO_MEMORY, sceneTable->SetSceneTableEntry(kFabric2, scene5)); // Verifying all inserted scenes are accessible - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, scene == scene7); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(scene, scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(scene, scene6); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(scene, scene7); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + EXPECT_EQ(scene, scene5); // Remove Fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveFabric(kFabric1)); // Verify Fabric 1 removed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 9 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric1, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(9, scene_count); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); // Verify Fabric 2 still there - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 4 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(4, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(scene, scene4); // Verify capacity updated for all fabrics - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 5 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 4, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 5, fabric_capacity); // Verify we can now write more scenes in scene fabric 2 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, scene == scene7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 7 == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); + EXPECT_EQ(scene, scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); + EXPECT_EQ(scene, scene6); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); + EXPECT_EQ(scene, scene7); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(7, scene_count); // Verify capacity updated properly - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 4 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 5 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(4, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 5, fabric_capacity); // Verify Fabric 3 still there - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + EXPECT_EQ(scene, scene5); // Remove Fabric 2 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveFabric(kFabric2)); // Verify Fabric 2 removed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 5 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(5, scene_count); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); // Verify Fabric 3 still there - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric3, scene_count)); - NL_TEST_ASSERT(aSuite, 5 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric3, scene_count)); + EXPECT_EQ(5, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + EXPECT_EQ(scene, scene5); // Remove Fabric 3 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveFabric(kFabric3)); // Verify Fabric 3 removed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); // Confirm all counts are at 0 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric3, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric1, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric3, scene_count)); + EXPECT_EQ(0, scene_count); // Verify capacity updated for all fabrics - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); } -void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestEndpointScenes) { // Get Count for Endpoint 1 SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); // Reset test ResetSceneTable(sceneTable); @@ -1228,401 +1236,360 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) // Get Count for Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Get Count for Endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Get Count for Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Test Scenes insertion not accessible accross all endpoints sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 2 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(2, endpoint_scene_count); uint8_t fabric_capacity = 0; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 1, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 1, fabric_capacity); // Endpoint2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Endpoint3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Check if scene present in Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // Check if scene present in Endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); // Check if scene present in Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); // Test removal on different endpoints do not affect each endpoints // Insertion on Endpoint2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // Removal on Endpoint1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); // Scene present on Endpoint2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // Removal on Endpoint 2 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); // Removal on Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric2, sceneId1)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric2, sceneId1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Test the fabric capacity accross endpoint // Fill fabric 1 endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); // Fill fabric 2 endpoint 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene7)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Endpoints 2 and 3 should be unaffected sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Verify filling Fabric on endpoint 2 does not affect on endpoint 3 despite Max per fabric being reached by adding Endpoint1 // and Endpoint2 // Fill fabric 1 endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); // Fill fabric 2 endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene7)); // scene count to Endpoint // Endpoint 3 still unafected sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Fill fabric 1 endpoint 3 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); // Test removal of Endpoint clears scene on all fabrics for that endpoint sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveEndpoint()); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveEndpoint()); // Check Fabric1 on Endpoint 2 - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); // Check Fabric 1 and 2 on Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); // Check Fabric 1 on Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); // Test removal of fabric clears scene fabric on all endpoints sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); sceneTable->RemoveFabric(kFabric1); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); sceneTable->RemoveFabric(kFabric2); // Validate endpoints are empty sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Validate Fabric capacities at maximum accross all endpoints // Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Test of Get with changes to Endpoint capacity // Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize - 2); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 1, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 1, fabric_capacity); // Test Endpoint 2's capacity remains unaffected sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + ASSERT_NE(nullptr, sceneTable); // Test Insertion then change of capacity sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 4, fabric_capacity); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 2); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 6 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 6, fabric_capacity); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 4); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Test making the endpoint scene table smaller than the actual number of scenes on it sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 5); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); } -void TestOTAChanges(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestOTAChanges) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); // Reset test ResetSceneTable(sceneTable); @@ -1633,88 +1600,85 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) // Fill scene table // Fill fabric 1 to capacity - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); uint8_t scene_table_fabric1_capacity = fabric_capacity; auto * iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == iterator->Count()); + EXPECT_EQ(defaultTestFabricCapacity, iterator->Count()); iterator->Release(); // Fill fabric 2 to capacity - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); uint8_t scene_table_fabric2_capacity = fabric_capacity; iterator = sceneTable->IterateSceneEntries(kFabric2); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == iterator->Count()); + EXPECT_EQ(defaultTestFabricCapacity, iterator->Count()); iterator->Release(); // SceneTable should be full at this point uint8_t scene_count; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); // Global count should not have been modified - NL_TEST_ASSERT(aSuite, fabricsFullCount == scene_count); + EXPECT_EQ(fabricsFullCount, scene_count); // Create a scene table with a greater capacity than the original one (Max allowed capacity from gen_config.h) TestSceneTableImpl ExpandedSceneTable(scenes::kMaxScenesPerFabric, scenes::kMaxScenesPerEndpoint); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.Init(&testStorage)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.Init(mpTestStorage)); ExpandedSceneTable.SetEndpoint(kTestEndpoint1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, - scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, - scene_table_fabric2_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity), fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(scene_table_fabric2_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity), fabric_capacity); // We should be able to insert 4 scenes into fabric 2 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene9)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene13)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene14)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene15)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene9)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene13)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene14)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene15)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Fabric 1's capacity should have remain unchanged - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, - scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity), fabric_capacity); // Global count should have increased by (scenes::kMaxScenesPerFarbic - defaultTestFabricCapacity) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, fabricsFullCount + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(fabricsFullCount + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity), scene_count); // Same test for 4 insertion in fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene9)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene13)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene14)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene15)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene9)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene13)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene14)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene15)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Global count should be at defaultTestTableSize + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, fabricsFullCount + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(fabricsFullCount + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize), scene_count); // Test failure to init a SceneTable with sizes above the defined max scenes per fabric or globaly TestSceneTableImpl SceneTableTooManyPerFabric(scenes::kMaxScenesPerFabric + 1, scenes::kMaxScenesPerEndpoint); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_INTEGER_VALUE == SceneTableTooManyPerFabric.Init(&testStorage)); + EXPECT_EQ(CHIP_ERROR_INVALID_INTEGER_VALUE, SceneTableTooManyPerFabric.Init(mpTestStorage)); SceneTableTooManyPerFabric.Finish(); TestSceneTableImpl SceneTableTooManyGlobal(scenes::kMaxScenesPerFabric, scenes::kMaxScenesPerEndpoint + 1); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_INTEGER_VALUE == SceneTableTooManyGlobal.Init(&testStorage)); + EXPECT_EQ(CHIP_ERROR_INVALID_INTEGER_VALUE, SceneTableTooManyGlobal.Init(mpTestStorage)); SceneTableTooManyGlobal.Finish(); // Create a new table with a lower limit of scenes per fabric @@ -1722,148 +1686,90 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) uint8_t newTableSize = defaultTestTableSize - 2; uint8_t capacityDifference = static_cast(scenes::kMaxScenesPerFabric - newCapacity); TestSceneTableImpl ReducedSceneTable(newCapacity, newTableSize); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.Init(&testStorage)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.Init(mpTestStorage)); ReducedSceneTable.SetEndpoint(kTestEndpoint1); // Global count should not have been modified - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 2 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(scenes::kMaxScenesPerEndpoint - 2, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Load a scene from fabric 1, this should adjust fabric 1 scene count in flash - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // The number count of scenes in Fabric 1 should have been adjusted here iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, newCapacity == iterator->Count()); + EXPECT_EQ(newCapacity, iterator->Count()); iterator->Release(); // Capacity should still be 0 in fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetEndpointSceneCount(scene_count)); // Global count should have been reduced by the difference between the max fabric capacity of a fabric and the // new fabric capacity since we haven't loaded from fabric 2 yet - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 2 - capacityDifference == scene_count); + EXPECT_EQ(scenes::kMaxScenesPerEndpoint - 2 - capacityDifference, scene_count); // Remove a Scene from the Fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene1.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene1.mStorageId)); // Check count updated for fabric iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, static_cast(newCapacity - 1) == iterator->Count()); + EXPECT_EQ(static_cast(newCapacity - 1), iterator->Count()); iterator->Release(); // Check fabric still doesn't have capacity because fabric 2 still have a higher number of scene than allowed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Remove another scene from fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); // Check count updated for fabric iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, 2 == iterator->Count()); + EXPECT_EQ(2u, iterator->Count()); iterator->Release(); // Confirm global count has been updated - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 13 == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(13, scene_count); // Confirm we now have capacity in fabric one - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 1 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(1, fabric_capacity); // Load a scene from fabric 2, this should adjust fabric 2 scene count in flash - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // The number count of scenes in Fabric 2 should have been adjusted here iterator = ReducedSceneTable.IterateSceneEntries(kFabric2); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == iterator->Count()); + EXPECT_EQ(defaultTestFabricCapacity - 1u, iterator->Count()); iterator->Release(); // Global count should also have been adjusted - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetEndpointSceneCount(scene_count)); // had 22 scenes, truncated 5 from both (10) and deleted 4 from fabric 1: 8 scenes left - NL_TEST_ASSERT(aSuite, 8 == scene_count); + EXPECT_EQ(8, scene_count); // Confirm we now have capacity of 6 in the first fabric since we previously removed 6 scenes form there - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 4 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(4, fabric_capacity); // Fabric 2 should still be at capacity - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); ReducedSceneTable.Finish(); // The Scene 8 should now have been truncated from the memory and thus not be accessible from both fabrics in the // original scene table - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId8, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId8, scene)); // The Remaining capacity in the original scene table therefore have been modified as well // Fabric 2 should still be almost at capacity - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 5 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(5, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 1 == fabric_capacity); + EXPECT_EQ(1, fabric_capacity); } } // namespace TestScenes - -namespace { -/** - * Setup the test suite. - */ -int TestSetup(void * inContext) -{ - VerifyOrReturnError(CHIP_NO_ERROR == chip::Platform::MemoryInit(), FAILURE); - - // Initialize Scene Table - SceneTable * sceneTable = scenes::GetSceneTableImpl(); - VerifyOrReturnError(nullptr != sceneTable, FAILURE); - VerifyOrReturnError(CHIP_NO_ERROR == sceneTable->Init(&TestScenes::testStorage), FAILURE); - - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestTeardown(void * inContext) -{ - // Terminate Scene Table - SceneTable * sceneTable = scenes::GetSceneTableImpl(); - VerifyOrReturnError(nullptr != sceneTable, FAILURE); - sceneTable->Finish(); - chip::Platform::MemoryShutdown(); - - return SUCCESS; -} -} // namespace - -int TestSceneTable() -{ - static nlTest sTests[] = { NL_TEST_DEF("TestHandlerRegistration", TestScenes::TestHandlerRegistration), - NL_TEST_DEF("TestHandlerFunctions", TestScenes::TestHandlerFunctions), - NL_TEST_DEF("TestStoreScenes", TestScenes::TestStoreScenes), - NL_TEST_DEF("TestOverwriteScenes", TestScenes::TestOverwriteScenes), - NL_TEST_DEF("TestIterateScenes", TestScenes::TestIterateScenes), - NL_TEST_DEF("TestRemoveScenes", TestScenes::TestRemoveScenes), - NL_TEST_DEF("TestFabricScenes", TestScenes::TestFabricScenes), - NL_TEST_DEF("TestEndpointScenes", TestScenes::TestEndpointScenes), - NL_TEST_DEF("TestOTAChanges", TestScenes::TestOTAChanges), - - NL_TEST_SENTINEL() }; - - nlTestSuite theSuite = { - "SceneTable", - &sTests[0], - TestSetup, - TestTeardown, - }; - - nlTestRunner(&theSuite, nullptr); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestSceneTable) From 0ea32d36f27723c7b86a0762f1e21b78190fc2e6 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 10 Jun 2024 08:55:25 -0400 Subject: [PATCH 092/162] [MinMdns] do no stop a `browse` operation after the first result (#33808) * Do not stop minmdns browse after the first result found * Complete browsing for testing active resolve attempts * Fix test to be clearer - remove unused data --- src/lib/dnssd/ActiveResolveAttempts.cpp | 24 ------------------- src/lib/dnssd/ActiveResolveAttempts.h | 2 -- src/lib/dnssd/Resolver_ImplMinimalMdns.cpp | 2 -- .../dnssd/tests/TestActiveResolveAttempts.cpp | 10 ++------ 4 files changed, 2 insertions(+), 36 deletions(-) diff --git a/src/lib/dnssd/ActiveResolveAttempts.cpp b/src/lib/dnssd/ActiveResolveAttempts.cpp index f8f351d85cf05e..0b5072bc05e5e2 100644 --- a/src/lib/dnssd/ActiveResolveAttempts.cpp +++ b/src/lib/dnssd/ActiveResolveAttempts.cpp @@ -53,30 +53,6 @@ void ActiveResolveAttempts::Complete(const PeerId & peerId) #endif } -void ActiveResolveAttempts::CompleteCommissioner(const chip::Dnssd::DiscoveredNodeData & data) -{ - for (auto & item : mRetryQueue) - { - if (item.attempt.Matches(data, chip::Dnssd::DiscoveryType::kCommissionerNode)) - { - item.attempt.Clear(); - return; - } - } -} - -void ActiveResolveAttempts::CompleteCommissionable(const chip::Dnssd::DiscoveredNodeData & data) -{ - for (auto & item : mRetryQueue) - { - if (item.attempt.Matches(data, chip::Dnssd::DiscoveryType::kCommissionableNode)) - { - item.attempt.Clear(); - return; - } - } -} - bool ActiveResolveAttempts::HasBrowseFor(chip::Dnssd::DiscoveryType type) const { for (auto & item : mRetryQueue) diff --git a/src/lib/dnssd/ActiveResolveAttempts.h b/src/lib/dnssd/ActiveResolveAttempts.h index 157790b531c3e7..a64a3444474c7e 100644 --- a/src/lib/dnssd/ActiveResolveAttempts.h +++ b/src/lib/dnssd/ActiveResolveAttempts.h @@ -250,8 +250,6 @@ class ActiveResolveAttempts /// Mark a resolution as a success, removing it from the internal list void Complete(const chip::PeerId & peerId); - void CompleteCommissioner(const chip::Dnssd::DiscoveredNodeData & data); - void CompleteCommissionable(const chip::Dnssd::DiscoveredNodeData & data); void CompleteIpResolution(SerializedQNameIterator targetHostName); /// Mark all browse-type scheduled attemptes as a success, removing them diff --git a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp index 5d67c1de892a20..8b2b30e3184291 100644 --- a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp @@ -424,11 +424,9 @@ void MinMdnsResolver::AdvancePendingResolverStates() { case IncrementalResolver::ServiceNameType::kCommissioner: discoveredNodeIsRelevant = mActiveResolves.HasBrowseFor(chip::Dnssd::DiscoveryType::kCommissionerNode); - mActiveResolves.CompleteCommissioner(nodeData); break; case IncrementalResolver::ServiceNameType::kCommissionable: discoveredNodeIsRelevant = mActiveResolves.HasBrowseFor(chip::Dnssd::DiscoveryType::kCommissionableNode); - mActiveResolves.CompleteCommissionable(nodeData); break; default: ChipLogError(Discovery, "Unexpected type for browse data parsing"); diff --git a/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp b/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp index 0648c9880c597b..6d778808f3e669 100644 --- a/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp +++ b/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp @@ -126,10 +126,7 @@ TEST(TestActiveResolveAttempts, TestSingleBrowseAddRemove) EXPECT_EQ(attempts.GetTimeUntilNextExpectedResponse(), std::make_optional(1900_ms32)); // once complete, nothing to schedule - Dnssd::DiscoveredNodeData data; - data.Set(); - data.Get().longDiscriminator = 1234; - attempts.CompleteCommissionable(data); + attempts.CompleteAllBrowses(); EXPECT_FALSE(attempts.GetTimeUntilNextExpectedResponse().has_value()); EXPECT_FALSE(attempts.NextScheduled().has_value()); } @@ -377,10 +374,7 @@ TEST(TestActiveResolveAttempts, TestCombination) // Complete all, we should see no more scheduled. attempts.Complete(MakePeerId(2)); attempts.Complete(MakePeerId(1)); - Dnssd::DiscoveredNodeData data; - data.Set(); - data.Get().longDiscriminator = 1234; - attempts.CompleteCommissionable(data); + attempts.CompleteAllBrowses(); EXPECT_FALSE(attempts.GetTimeUntilNextExpectedResponse().has_value()); EXPECT_FALSE(attempts.NextScheduled().has_value()); From d4d9a999a729d2e9bec39b4b42a513fb5fc889c0 Mon Sep 17 00:00:00 2001 From: Sting Chang <33673360+stingchang@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:14:25 +0800 Subject: [PATCH 093/162] add noip back to fix cloud build (#33820) --- integrations/cloudbuild/chef.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 95cba5a3730e38..2795c6b5095cd5 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -29,7 +29,7 @@ steps: args: - >- perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt && - ./examples/chef/chef.py --build_all + ./examples/chef/chef.py --build_all --build_exclude noip id: CompileAll waitFor: - Bootstrap From 17cda5a1a1817ffabd052cd9b51838efdeefe7eb Mon Sep 17 00:00:00 2001 From: C Freeman Date: Mon, 10 Jun 2024 11:37:28 -0400 Subject: [PATCH 094/162] TC-DA-1.2: Fix for numberic PIDs with fallback (#33621) * TC-DA-1.2: Fix for numberic PIDs will fallback Apparently isupper is false if there are no letters at all. Adds a fix for TC-DA-1.2 and test vector that exposes this condition. Also adds the pid as a variable to the test vectors. * Fix test to use pid from json * Restyled by clang-format * Change to regular expression - added a new test vector with the non-numeric PID - confirmed in the log that the test failure now happens on line 81 rather than line 90. This is a manual only verification, I am not adjusting the test-test to expect this, any failure is equally valid as far as the test-test is concerned. - remaning tests are still correct per test_TC_DA_1_2.py --------- Co-authored-by: Restyled.io --- .../invalid_paa/test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../struct_cd_cms_v2/test_case_vector.json | 1 + .../struct_cd_cms_v3/test_case_vector.json | 1 + .../test_case_vector.json | 3 +- .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 3 +- .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 479 bytes .../dac-Cert.pem | 12 +++++ .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 ++ .../pai-Cert.der | Bin 0 -> 472 bytes .../pai-Cert.pem | 12 +++++ .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 ++ .../test_case_vector.json | 10 ++++ .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 479 bytes .../dac-Cert.pem | 12 +++++ .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 ++ .../pai-Cert.der | Bin 0 -> 472 bytes .../pai-Cert.pem | 12 +++++ .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 ++ .../test_case_vector.json | 10 ++++ .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 479 bytes .../dac-Cert.pem | 12 +++++ .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 ++ .../pai-Cert.der | Bin 0 -> 463 bytes .../pai-Cert.pem | 12 +++++ .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 ++ .../test_case_vector.json | 10 ++++ .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 479 bytes .../dac-Cert.pem | 12 +++++ .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 ++ .../pai-Cert.der | Bin 0 -> 463 bytes .../pai-Cert.pem | 12 +++++ .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 ++ .../test_case_vector.json | 10 ++++ .../credentials/TestHarnessDACProvider.cpp | 13 ++++++ .../credentials/TestHarnessDACProvider.h | 3 ++ .../tests/TestCommissionerDUTVectors.cpp | 2 +- src/python_testing/TC_DA_1_2.py | 3 +- .../test_testing/test_TC_DA_1_2.py | 7 +-- .../chip-cert/gen_com_dut_test_vectors.py | 44 ++++++++++++------ 195 files changed, 380 insertions(+), 21 deletions(-) create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/test_case_vector.json diff --git a/credentials/development/commissioner_dut/invalid_paa/test_case_vector.json b/credentials/development/commissioner_dut/invalid_paa/test_case_vector.json index 8b504a8a1b8997..b592004400ddf8 100644 --- a/credentials/development/commissioner_dut/invalid_paa/test_case_vector.json +++ b/credentials/development/commissioner_dut/invalid_paa/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAA Test Vector: Use Invalid PAA (Not Registered in the DCL).", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820172a0030201020208567d67fad563292c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3231303632383134323334335a170d3232303632383134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043e84ccfb667a1d562229015913124f85e7c62d6f1393a21327fb3e4dc4d6e7a425b00dc77250800c07a90311bdf4f70dd85a70ec7689a45a9f063c1bd03508c7a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cd5158817cba8798bf2d4c3823403a78b26a6e2c301f0603551d2304183016801460299f6439897e6f486e5f7237cd98a297ad48e1300a06082a8648ce3d040302034900304602210088a0246e9fa3314477108d6ca54be5f085d49280dc443fe36d7142b35fa7661f022100deb66d515b10a85e3da566fcdacfd6809df9969281dc6c18aa3aa397d10596fe", "pai_cert": "308201c53082016ba00302010202087a29a4e6ad8c2979300a06082a8648ce3d04030230393137303506035504030c2e496e76616c696420284e6f74205265676973746572656420696e207468652044434c29204d617474657220504141301e170d3231303632383134323334335a170d3232303632383134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000447262db2383a51c1064c0f19ff281526a8a2d31186f26e4e99435d00ed2d839184dbfa933bb69f5d2efec15558d35306d9245e926f59a69fe3018bb7ca63928fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041460299f6439897e6f486e5f7237cd98a297ad48e1301f0603551d23041830168014135ad5c6f7b95c524f346cbf2e9c124d9fbd4e2d300a06082a8648ce3d0403020348003045022100f9a560954e98b0b3ff621166727664d689a41d3b4cd107c3e87a9145b3384a8a0220586b4ad7f4c2c7c333e9cdfe3d37065d238cb7498e7629e20964e501f4a7beea", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402202f6fdf1d3e5587c6e6f4d6f2015b1a2b69a22768efe10bfbbdcc7f7c53e81db202206f4bcc3fead88b2aebb9a1ece815b5f20fee350d96127e77150d9a7b024d073f", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count0/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count0/test_case_vector.json index df138046c675f3..14056dd7e27db5 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count0/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count0/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains one valid PAA which is authorized to sign the PAI.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa003020102020866dfbc08976c91be300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000418f3f19bd1c766d85fc6f3f86773b1b3a245c4928fb24b3430294c7d3f43c26866b5aeeac77dbc8ac007195ac0ffa67412e63574a370ec024abeca5f30aa49faa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c154ccb722ff1bc9ed9f91aa597eb1e97039eb1c301f0603551d230418301680140c0527c403c6de10a5fde5c521bbbed4f0f88732300a06082a8648ce3d0403020349003046022100a5598c46a8b9991d5c488030eb6d8e6bbc6959774bac0838064d287cc1cbe485022100bbc7ba9ef547985f4956f8a65bacba7e6ebd6317ead65ef59784894e44d809c0", "pai_cert": "308201d53082017aa00302010202085cbff391288347ef300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b360814283520ecb9fb9c405780a2930bc7b833ae4106ab1259fc6d177c54edf5d4725c30e400f542ca865f7f2d74b315e0ff7b438040f75fe1128142c6bc3daa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140c0527c403c6de10a5fde5c521bbbed4f0f88732301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100aba3cf5b385fa705ff1e2b49a067d6140c591797fadfd8815e52918a77b09c430221009434b1902c4306c1300224152cf04f56d353bc6d7953005a5edf9afef94164f7", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b0609608648016503040201304806092a864886f70d010701a03b0439152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b1818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502203e95e0d9d4324d9fdbb38d6880285888828427759c03b8763bda4e43953fd290022100e030484f70e8f937175c28d1ce575bd612251a4b1d83a0365a2374c613933487", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_invalid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_invalid/test_case_vector.json index f88b7b80090cb7..422334bdca5ded 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_invalid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_invalid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains ten PAAs none of which is a valid PAA authorized to sign the PAI.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208619d97b52a9bd8b5300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000444ee63eae77e514b74f16a0ffc056f5cc7e15b50be36fa820f53c8f9db55f3abf63a2d9e801294ba8856aa3b8a890331068c7e91290069951fc8b7878f689acfa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041483d1ac698457e8200c643f7dac654164e6b0c676301f0603551d230418301680144a5d2c6304ac0c2e83759550647d8d2f45cb2b14300a06082a8648ce3d040302034800304502202484b475e7db3bc35b156fb4d4987fca8522f4ae2ac4029ba2a07441d9e22073022100b68d656f8b07db08086f29d1a26a53b3446767f797bb8b1abef5ef18842ee907", "pai_cert": "308201d43082017aa0030201020208079e93d07530dbf4300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047a70f9af70bb9bf2b302ecbd0ef86193ebfed1136bb62a9b115792a2b7f9ab0a920ffa8e7ff5f88a4dfbf211c5a0cf08d7265bc3513aabdf22420cdf4918f05ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144a5d2c6304ac0c2e83759550647d8d2f45cb2b14301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100acfd6e9ab1c356e6539f5208e6146627be56f80ced4fb39217e28fb7c23d0f5c0220214b75d6180d62c8d4afd7d32be976b20fcc40c1b362976b5ba65db13a1d9623", "certification_declaration": "308201d006092a864886f70d010702a08201c1308201bd020103310d300b06096086480165030402013082012806092a864886f70d010701a082011904820115152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10140b44cabbc5016577aa8b44ffb90fcca140fe662010140bbbcabbc5016577aa8b44ffb90fcca140fe662010140bbb35bbc5016577aa8b44ffb90fcca140fe662010140bbb3544c5016577aa8b44ffb90fcca140fe662010140bbb35443a016577aa8b44ffb90fcca140fe662010140bbb35443afe6577aa8b44ffb90fcca140fe662010140bbb35443afe9a77aa8b44ffb90fcca140fe662010140bbb35443afe9a88aa8b44ffb90fcca140fe662010140bbb35443afe9a88558b44ffb90fcca140fe662010140bbb35443afe9a88557444ffb90fcca140fe66201818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502203d4581e769a71482498f4fe9df315e486ed838951af4aad8fa94dd8ef5bf3c63022100f24ac406238eb617e7a9c18b16938bfd4540a7aa106486d37468fc3b411855e3", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_valid/test_case_vector.json index 679398c44cbc1e..62e64dec078a64 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains ten PAAs one of which is valid PAA authorized to sign the PAI.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208164c0e740ca45824300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000463aff759bddaee30f45b5b4a486d4f9fb32de4c698720054d3e95333a6d71dfb19e40a04f5c5eb4a535090e102df06e2ae8e02066bc086829f289cc9f3b7915aa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414569bc3bd997dc682c1c714157c139710a38776ea301f0603551d2304183016801407a710a0ff13d00df63a9e5c8325174c5f08c8d0300a06082a8648ce3d040302034800304502203a3e6465f2cb66b3a61e2b4a44cf4a4084f4abc76a97471e3ffb444ccf1f3246022100f1e5cb7f071aa52231a4bdaee309ea3372b98875910ea14aedf76ad3f6721bc9", "pai_cert": "308201d33082017aa00302010202084feaec9a37c9398e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004142c31ebc29a3d6bb04a18ef2cc6e7648634fdbf9d3bb2c91a53799b9f458456db64372997fe1727ee95e95a2382c0b4066e2df9dbef78829d2b5b6d8e7a2a16a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041407a710a0ff13d00df63a9e5c8325174c5f08c8d0301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402207e75cabe27de00bb184983ca5443416e7976c1de5f8b8a82df70444373d42cb5022077a43af72e320fc74dc1d76a859d10c700b2ffe5a49ec2d23753f27bd7f19b34", "certification_declaration": "308201d006092a864886f70d010702a08201c1308201bd020103310d300b06096086480165030402013082012806092a864886f70d010701a082011904820115152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10146afd22771f511fecbf1641976710dcdc31a1717e1014f4bbcabbc5016577aa8b44ffb90fcca140fe66201014f4bb35bbc5016577aa8b44ffb90fcca140fe66201014f4bb3544c5016577aa8b44ffb90fcca140fe66201014f4bb35443a016577aa8b44ffb90fcca140fe66201014f4bb35443afe6577aa8b44ffb90fcca140fe66201014f4bb35443afe9a77aa8b44ffb90fcca140fe66201014f4bb35443afe9a88aa8b44ffb90fcca140fe66201014f4bb35443afe9a88558b44ffb90fcca140fe66201014f4bb35443afe9a88557444ffb90fcca140fe66201818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502201b10656798c6360de20e30e2ebd93fa776f78eb347bc178b92064470080cd972022100e6c798a2c4dd0486b927c99d40c9a01994fd8f5000037c26e5f2bf5f3492192e", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count1_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count1_valid/test_case_vector.json index 87dca92b8aaf4f..ad6fa8d2751c68 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count1_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count1_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains one valid PAA which is authorized to sign the PAI.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202080e5146c5fe47ba0a300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004447eff6c579f3ebb8014886ecd2031ed2b22476986c35d5db3f1516f8335aa785e9e5d5b8b1ba5f0aee3cf3dcd9f84f5431f6bae2a15a207b4a81fb0540a50d0a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c54475ec42f837b7b11d186236c6329607c5c23f301f0603551d230418301680140a620b8d9e1b8da6cb6f22b275a464e4b41938b1300a06082a8648ce3d0403020349003046022100dec569252bcde62ff937f3eb5c312c437cc1cad7736b145cc5c55f7e4beb2c0e022100d79dba6ed3b1c3956f6f759f20f1472415d095bef53ab65cba0b3c743d1709a1", "pai_cert": "308201d53082017aa00302010202082a474a51bba41ea1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000420fd963ee5c8a978c5b8f2bde7262279bf5517234f93e6dded3c23baf4e53cfb886ad83a82a0791bad434d0d72563815bab9a0a48fbf15489770ce77adabba31a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140a620b8d9e1b8da6cb6f22b275a464e4b41938b1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a859075ac87461eeaade52383d8d404f7f2ed41d0bf3535f22a670c7bf393b73022100e8be368b400f6ac406e03c3a85f93139e06532b23e8547b67ae35099ef40fb48", "certification_declaration": "3082010306092a864886f70d010702a081f53081f2020103310d300b0609608648016503040201305e06092a864886f70d010701a051044f152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10146afd22771f511fecbf1641976710dcdc31a1717e1818317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100bac36c9f830bcbd49e07dd670d042df0eaa4ae1cf5308d39434fb0e7851402e902210087e279dc232a5eb68c74f19aec946ad988edfc35ac4a420cce36a1ec49c76d50", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count2_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count2_valid/test_case_vector.json index 6572e21fc6a121..8d87d9342222e9 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count2_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count2_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains two PAAs one of which is valid PAA authorized to sign the PAI.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202082f03484bec0943da300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042c87804f5ccad479b3aa938377a54abdf689c73095f838cbf43da9dea9222e9dbcc335ad71c5175661c21604ab987c5903a5dbd8b0c4ca25104e5976d36c93a2a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b5a9d50d21f956fe36544446e157e356263a3d80301f0603551d230418301680145bec2478a2da401835a0815cb4656ac4b92b0ae7300a06082a8648ce3d040302034700304402201734e114e6f6ae2c7c90b3ac5f74fb297a364fd871bf1ff4d3e78088a779c4f102204999daf1f02a331355a05bb4d79a6292726b90fa448ede1b0d052ca3e0af1dce", "pai_cert": "308201d43082017aa00302010202084663472106a76044300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b86e0da6af949217ff8df3257336ea0621ca53cc52e44a227041e32dd57a13b9ee68f33e30c13186d1232f0f44f0b004b6fd2d953165e843608a5c5750f2dee3a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145bec2478a2da401835a0815cb4656ac4b92b0ae7301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502201c3245a0ea743d922bbd3fb0496a4a1876941fbbddbed0d3f1a0b610655a9b3c0221008641b5be85663739e8356fafcc2057475c27cec37426e2e70417f69ffe673b74", "certification_declaration": "3082011b06092a864886f70d010702a082010c30820108020103310d300b0609608648016503040201307406092a864886f70d010701a0670465152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10146afd22771f511fecbf1641976710dcdc31a1717e1014f4bbcabbc5016577aa8b44ffb90fcca140fe66201818317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100b47d3b1973b72fd8be80ded8c656a3adbb98928c0d4d8f9a0bcd864a68a49d66022100de3806359f877fb51ab36e3620f873bfa07da372bc71c9d1f1407a84da6996d2", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count3_invalid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count3_invalid/test_case_vector.json index 633ca150855dec..3a5a370d22c2ed 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count3_invalid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count3_invalid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains three PAAs none of which is a valid PAA authorized to sign the PAI.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202085dcb3bdbfd318499300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fa5e5d04fdf0bd8426495e3be7da6c9a83b9508a71f414fd41451bdcdde86930a85f64edd0a4ec66ecd9ea50bb2e1f5acd9f03b1b8f2c42e710886b38f432d18a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e378ed232ba0dca7ce541f8491bf217ca1d6742d301f0603551d23041830168014057dc0978692d229cb6ce732dbf8356ffcfd3efe300a06082a8648ce3d0403020349003046022100ffd65e1b7c352ad3b5db13770c5529b8b7a6693642801f07b92b49d95700ac76022100c21bf59617b444315dfbd34b35bb8eb6cfbcbb7de268210d4bf69c156097c108", "pai_cert": "308201d43082017aa003020102020812ede62cc86d392c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004161820bdda95f711e0fedd3a8d060f273c36f9a03ff7b105ff96fa7e7df0b2f951f8022f869570fce219c8f3e466881bad898b6265a8f8a2c6c5bff306761b71a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414057dc0978692d229cb6ce732dbf8356ffcfd3efe301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100acb6985b132d11929f78b38868be8b7b90ac73fd27b651930686b442d4c91a6a02201cc4b54f753703bcfe36eb4f298cb188b4a8814b44fa872d0584ccfb4649b389", "certification_declaration": "3082013106092a864886f70d010702a08201223082011e020103310d300b060960864801650304020130818a06092a864886f70d010701a07d047b152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10140b44cabbc5016577aa8b44ffb90fcca140fe662010140bbbcabbc5016577aa8b44ffb90fcca140fe662010140bbb35bbc5016577aa8b44ffb90fcca140fe66201818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221009358856426dce2550347c9c5f52c0c028193de36adeaa73afc14708e01805be302206c29d9e9926df3f0dca2e794d6a1fc5de880e94626b7be1edfcae8996af22479", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_missing/test_case_vector.json index 1ac95989ce5e59..ea30a8c98546ff 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The optional authorized_paa_list field is not present.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202086b9269307ec22f16300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004624dc0f62274149af021e4ad07a45635aeed76ff456d837473151de65ed2178962968f8e944a496f86b3300064ae32d4083a5fc8d32536fe83639b3c884aeebaa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141b3044abe088ea3aa56db5b2d66c5a057e8fb522301f0603551d23041830168014f0ed3106a93b842028dab233a73b796931529304300a06082a8648ce3d0403020349003046022100b4856c9f0ecde3572e807a7ffca098cfd21e808939e43880d7a7f3eda28987d9022100d865e23b12e835b38619e2fcab91edc46f5d6ff7b8a7cff98fae4ccf066a9cee", "pai_cert": "308201d43082017aa0030201020208473df880371ed255300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047c8294caa384716c2235fa8e6203aee8267cd97ab723234a66dddcef9adcfef9a341b00fb921f866c912381c2a19fe241d6f065e3bf3a5ad0ae179d106017d85a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f0ed3106a93b842028dab233a73b796931529304301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100a0e8962a88901e2aac1ba5bb04d87a9947ea7683ec3339e39469f88ba1c835f702201c929aee77e48c5ace4a7610bf526532f8eab67ad1927d19e96ae7ea0e3e0541", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220763d8156ca34e8b88c06570e73192f4a424eb7db57cddae2fcc88b3921b57364022100ceb7da4b891c5044ac391fa251f093a6488164ffa745397005ba36a935121457", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_id_len_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_id_len_wrong/test_case_vector.json index a9942fc7b01fc6..294e14f61dbda6 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_id_len_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_id_len_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certificate_id field has wrong length.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202083619fcce7a54254f300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004a48090410a0ee48ac198ceede10cd2c2e2c0ee0ab2bbad2810830ed9671dac611b0827af584a3474eba8b01f9b70dd3ba6ebd46f6c579a27b0c2b098f847232ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ca2506782dded38684c13090e61b932da62255cd301f0603551d230418301680141d45428a2e2c60ebae19604f9be6cc9154a30460300a06082a8648ce3d0403020349003046022100a0bfeb462544dc65359cc1c774004ab7057566e73738eba9ac1b858292560cc3022100b77bf8015dcafe539df52072037cd121e3bd51d368c246e552a34b232146cf3f", "pai_cert": "308201d33082017aa0030201020208495a434bcef0386e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000481628862f3c9e7492c3b6c805f02f1f0dfd0097c794ace554dd195003dbee1a47e5e3f1ab560dfe9cb5e5323c84d73e275e329b36cc3944aabc354e77afcfea2a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141d45428a2e2c60ebae19604f9be6cc9154a30460301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022073278ff5a49cb8ade2d11b810666f15a61f3eda4670463a932284fe07f18bccb0220241cfbd676c9dc57521e5c6736c195e73ecea61adac39ac5f6cbaba4bc947483", "certification_declaration": "3081ed06092a864886f70d010702a081df3081dc020103310d300b0609608648016503040201304906092a864886f70d010701a03c043a152400012501f1ff360205008018250334122c04175a494732303134315a423333303030312d3234313233342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ea14f344941e870353931995ed58dc2d168033d62ad0959373e2da6df7b3101d0220040391e1aa30f7212ddffc046faa4bdccfa7eb85de1d9bb497946ace6f68ea6d", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_id_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_id_mismatch/test_case_vector.json index bd6dad51a51a48..9a931d0a211b48 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_id_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_id_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certificate_id field doesn't contain a globally unique serial number allocated by the CSA for this CD.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202082ae17382e13a7119300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000464f5306b94ffdf12d7a7637a227130e34e17e60b956e728a28e65540b40e3cda41cc1105a1ef31fd102a3b5ba92446f79667cb65b72749bed53f9642d22a72b4a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414bb0ad484b4ab92e415e93d8d09e74105d45bbcf9301f0603551d230418301680149ec378a76a02aee9e859d43c3faa9af0cbf39f0c300a06082a8648ce3d04030203480030450220412ad16a485425c8868f4c19653c9306edfe2c039bc76f2144ae3ac97229c7ad022100bfcee30b78cd7ac4feb628f99bcb3c52bdd16035b34bd42dbd904e5e1ccf0b81", "pai_cert": "308201d33082017aa003020102020874ff7f5a21618e7f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f1cd573340d3df3967e4dd1c378c64b2cf0b8537deb67049b0b94a8b1d30f84e701b3dad5d9184e2e86904976bcbeda94996ac34e7b24051f41bba397ba75f0aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149ec378a76a02aee9e859d43c3faa9af0cbf39f0c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022041d3f40b2c1e22f41bfd5d6e6d3261eac42a6072baaf6618310ec33b105b759602206c45a3b31692243fdc1b6ad11bfac7834cc388535af914fa27c0341494cd7f2b", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c0413494e5632303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203e409fc0be4e30cbe2c02a022519e2ee602a986df2f35c03e0b1ef0e076b3f62022069f6216057ae3319b80c4d56f5b6bd550f3506ac1252fbac7554542ecb1a2fd6", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_id_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_id_missing/test_case_vector.json index cd13f02d943510..d745da16632fb9 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_id_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_id_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certificate_id field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202087ea6b3e63ae97177300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042972e5bef8a607c74269b7588bf898eedde3bccdc3992691a70e44a6269dcaaac04a52e82b81266c84738358942186b42e234848150fac84e8eeab3cf818163da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604142853b2227f79ab542a266240daf3fda19d893371301f0603551d23041830168014ab730a7e9b73e7e65abf187b6e429d8a086946f1300a06082a8648ce3d0403020347003044022076978c4d1ae2636b8d936162adad9a596f00be855506afac5564abc0363aa1e102206ac28f4964c168d50010a926cea6a200afe03940a7d98e1a70c6c55c1fb8c0d4", "pai_cert": "308201d43082017aa003020102020862de19dd9e730905300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c5db54bb35840be7935426f46facbfb7472be15c30f1a2be6c9c31b51f8f815354b94a356a99e8e256e21db622365086b345804ae91e34b5c0cd97f0f1c9938ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ab730a7e9b73e7e65abf187b6e429d8a086946f1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100ab728f28fee7b972fb9b0a5101c8fb2b41e2efab825f91df548a0b891785f40d022039427ccee45e76b7ac2dfc35f7e1ba042605095586947aa10fd2316667290389", "certification_declaration": "3081d206092a864886f70d010702a081c43081c1020103310d300b0609608648016503040201302f06092a864886f70d010701a0220420152400012501f1ff360205008018250334122405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022056ff620b0fd9551f2f66c49370768b42a4784cb291b95a7890e8ff8f8633977202200ebe80082d30d6e1e9c83b7e370a0f1f8fe5974d26e3cf9aa392e96b139973aa", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_type_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_type_missing/test_case_vector.json index 4f2a4fb4e91575..7a0ca0c3dfd3ad 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_type_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_type_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certification_type field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202080834f51f89b212c6300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041ea075a3f408cc172ba4aa7c4d1ea97aa3edc5835c90a8c5375d0f0f449587a9bf21bd56f563260cb5549d546a2b0c394f650f8730b7f3ae69cd0877ad235dcea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414798660df8cec17e8ae767e680d831533c8081eb6301f0603551d230418301680146cde5ddb9319d4e60c20e8d2c66f1a0f62e1d014300a06082a8648ce3d040302034800304502200be4a2179b5ee5d1977a20cf1cb354df2045675b768032ff7a3e4ee0679d3664022100f654bb5dba82f43b27d791fc1ef228e1fec0b82c352f8321f01135e5435ce958", "pai_cert": "308201d43082017aa003020102020840f0908c93495565300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048c5edea82008e14fd7d8d9af5cec08d653d990120b3814fb836fe3db262fd1b5daea3a273a799b7dca990ca9e35383a751405221b0d7a5e62954881262577c52a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604146cde5ddb9319d4e60c20e8d2c66f1a0f62e1d014301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220324de9de382052b2aa2aae5e96b32ac90c01022fe642b3fa17be32efe44d15fd0221009e41b8ba2dc2471012c804b63acc80718c77afdcd2a0b70d5830564eb66e739d", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022036136361524f160beacdd64b6eee06d1032448bd1ee371bf65afd46bc3ab1d3c022100d22617af7d9eff14c59a416577e1418e6f3ece0260207af0fe9e1c853ab82576", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_type_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_type_wrong/test_case_vector.json index 3d26c2b7eabeaa..fc9af3524486b3 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_type_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_type_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certification_type field is set to invalid value.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202080949f08e6e414d05300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000403d434b1f209dae90b4326eea4bf966e6d07fb13550292852f79850ea904ad86d29f9700529e380320f398de5b49defd888b1c1afb431ce98dc843ac115fbcc0a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414edf7a1d367a5ce829e4868adece1260ef0244d9c301f0603551d230418301680140697d80ad514db1aa6f39ed4656411ec857d7d8d300a06082a8648ce3d0403020348003045022100bca4338871ede720a51769ab758cece080330d88597907a2a020647f776f6912022016a5c97d4941ccfda32abfa2a055f658f42a644952b123d450568ff6b9d08da6", "pai_cert": "308201d33082017aa00302010202084347b700bedeec12300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ef003fb502869af99800bb86f629446c2135c576b0b479a7f0e7370ebde491faef37eb6a3dc96f772add28df97e6b9042a331b223f8ec30d53e270eb9846a48fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140697d80ad514db1aa6f39ed4656411ec857d7d8d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402200d3d073dd237778549c97f6fac3d459c52ed829d9f1fa53fe8dc4d5b3c09459f02207354b134ea4f5bd58b9610213eaee0f0120178eb19f4a203812b74c8b3176d65", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408ff18317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008a550a3a379571c8f81f5b17e786e4bfdfbcba3c7075e01b5dd25c7b644422000220551e26c99143a3850628d4f1206bb5895d9b82b25330bb84cdcd6197e5cc9be4", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha1/test_case_vector.json index 74100bfacfc7ed..dee527ed1287da 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS digest algorithm SHA1.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020818d5679a80c485be300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043f504a85258308105d789fad8b9686b3c1f8e94c253109625bb1de84587de360dd12ab2fa97c913db03e8f37197e8ce2395f3e9b030ad8ab1ddee1a4d6287142a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a5f57dea9d8dce16995a071a98485ce8cd5a29a3301f0603551d2304183016801486797969584455dd4955e8de31dd2e3bf0b8786d300a06082a8648ce3d0403020347003044022057787dc1a1ae060af9e2db9b4472c9e3a80b3fc659a18175d8aa4aafd4bf25c10220045ec44d104531961904bcccf2967b437708fbd8f66c1b1579a18d25e9785b4d", "pai_cert": "308201d33082017aa003020102020828b15ead56d26dcd300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042ebac935e9ea61e7f83e2a89d55aed38e57afbe5b6448d1cb4144c9cc5e65b10f55f6d2b981ebe9fe7e89445faec11f4994398edd61c30e8fff659ab1a556ba9a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041486797969584455dd4955e8de31dd2e3bf0b8786d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402203ae85c041ce766ce393d942d1cce8c4127cec8e61ee0742747b07a4ecbe7163e02206e2b81a014e84d818db39ff79e8701f7b1fce24b6158c20df9e5dd97b912920a", "certification_declaration": "3081e606092a864886f70d010702a081d83081d50201033109300706052b0e03021a304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100ca28ee68583948a3197e804cdd8db6cde1298938b157af05d52436ca87e8f1bd022100c3a8e7b678ab18cba8d0d861ec9900b09d881f306b379f4acf76ef5b47555d74", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha256/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha256/test_case_vector.json index 2ff179954db243..4a96187d322c1d 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha256/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha256/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid CMS digest algorithm SHA256.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020823dd9a7ed09f8bca300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040a520fd80573f5a8e69d46b5a8cc5874e10e157483c5fd4cca2a12f257423f38e4feadff92a346b8bd0354efe37b06013824349157102a8de8f4d22f07cf3544a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414250fe8cf813e21ea28829809fd34e001c392f1f2301f0603551d230418301680147ed74a75dbf1b443c03c9043a2723cb8ad8b7b32300a06082a8648ce3d0403020347003044022043c151192dba83944e615b22848091bd9ca4bc92988512d2609998fe0d7d33e502204e853e7bc3780e452db55974d49798f4cb8639913c6562c973abf3c03f73f873", "pai_cert": "308201d43082017aa003020102020806e8d71f2f54cee2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040396591399bd5e0a035caca49b67c4c41516cf6b16128710bdb199f5aafb73d1c47b3baeb8171e2eafb2bc7386428f850ad8f86852b6d5b93a78494f47100f5ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147ed74a75dbf1b443c03c9043a2723cb8ad8b7b32301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100f581bf20a9a51e35d66612740b6a92ce8e47ed1a30a0053b3616048a2550f237022051bb511dd78fe973513c42210611e9d98168a65b2067b0d58333c4c54df42ae8", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008433a32e83d025d8463a54b34e6d99f96bc2bfda0c8c2c24d8b2d6f365995d5f0220116b9124447deefee2e09457b871be791e2bbbd1eb5f7abf75916e379bf71418", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_msac/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_msac/test_case_vector.json index 4c0dc45cf7f2e6..99fbbe1d1aafa5 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_msac/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_msac/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS eContentType is set to Microsoft Authenticode [MSAC] OID = { 1.3.6.1.4.1.311.2.1.4 }.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa0030201020208488516846e71dd57300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004aa2757988c72225ef0fc4b6f8ebb93a10efc1a9ab5b846f0f1e39a7fff0b4b09e4789ffd42713faf5d33c26bb785118b470573969681b5dc24bdc325318ca23ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148f363885e2769db706eb333283e16bf32a7e0f25301f0603551d2304183016801473f3119b54e7a2aacf469813b2a5c9308ceb5213300a06082a8648ce3d0403020349003046022100de1bbb4ceec70e791c2576c6690814e3523cf8656a140ff8a0843b2546fadc95022100819e50615e8e5b086794b4b5f879a55056e14fd25361c38c2dbf8e7b945707bc", "pai_cert": "308201d43082017aa00302010202087a315f5afa0c9264300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004334df1df5da93e2d7550d456c380e51457d28705dd1a07b67ddae3e8d9ffe2ab334ab4bf25f93422f3a61fe588fd6e285886224b06d6600230724de11e5c36f0a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041473f3119b54e7a2aacf469813b2a5c9308ceb5213301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210090e20b2458c96f3a75b43382f516b23dcd51c865a48d2722a27c9c4ee5f6197b0220439546386978c1586351f18f114924d74b000258b40470f96d4ac199d65abc05", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b06096086480165030402013048060c060a2b060104018237020104a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022024af5a9a1b5a67ad88ca2f457651c20a77d610d246727b14fb120e81ec044fc3022100867566c3b058593b135a2cb076c28bbf59bfe711caa2c38462abf0ebf1091d0a", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_pkcs7_data/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_pkcs7_data/test_case_vector.json index 2980c02f17585e..13f64bec93a4b0 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_pkcs7_data/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_pkcs7_data/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid CMS eContentType pkcs7-data.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202083e4c735a19aee98d300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041490bef16049b1efc6a4fcc93497a0954c4e5adc291678919ab22848052462e2f1d811dfb90b9cd2b6eb2069a2b0af801678f14ea001accac3832823273ed422a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f337a308dbd8bc2eaedadac926102341e8e45414301f0603551d230418301680148aa728da3e1784ab9c2f9222f12ff9d290391e9c300a06082a8648ce3d040302034700304402201f166f6c46ec16173b8fd9e55150c8447dee1f263b4de947f5576a5597444f6b02202eeae9d033308b9a289d4d256ea260a2fed5b169beafd18e68e2d59f3702726b", "pai_cert": "308201d53082017aa00302010202083b1196f67de3cab3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042a8975640240b47be77d90d681b5b99287d8501698628ba0d0947f0b646105ee89b0420ee73db8cbdb112cfc7ef2d79b66b7e691997c6bf7328c2b9c6b8110daa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148aa728da3e1784ab9c2f9222f12ff9d290391e9c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100bed6ee124a57397d0367af396f5433cef76191a6b8cfbc0e62687bb8f5a4a5ed022100e8140314b376852700b05eae972f376a7d38cbbe5cebc23b337c2d204bc5730c", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100adf29a65c3a84a1a19e2968b997ca529fe579de5c8250a2bbd091c201dad44c80220797e85e16cb511d67a52b185a742257f9a81e7fde48fe6555adc85a2d467d649", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha1/test_case_vector.json index a137093200a2d1..e46975d8039d2a 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS signature algorithm ECDSA_WITH_SHA1.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202086e0e9efbf1d9619b300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ec8c006c94cc032fc31de7ec8a7f0dd369175eb498cb1431745fc735ec3400912e0007512f73c0a72702b6373306e5c77dbb51b0fba27cb6e64f4d1c63ff53cfa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e455aca399560ce0fe06340a873a8ddfeaa58293301f0603551d230418301680145fb6d29163ae281d11fc7d89d8aff9da82da0e3a300a06082a8648ce3d0403020349003046022100e55f49bcbeb91907fdb1fce4192609bb42ad53ca4ac2df72ca550b7a380175b90221009461916880110ebdcc76722c978e5cc6f5ffa0b323a64e92d77d6b24e1c0848d", "pai_cert": "308201d33082017aa00302010202082970bad74acfd368300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ce94c57d7d3497df1be2950842552cc9dddf988a32a9b5310c1e10ad3e366d29ec904f5a9511024ad9e3e539421ce9220017998a7d43d0c06738e6459be57edda366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145fb6d29163ae281d11fc7d89d8aff9da82da0e3a301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022075023bb0ea584b1a3429e3e15d00ca893c8767a06d4c76711f49a3ab1826d5860220769ffe8ab8bc468f1922423ae8a8280cf2d9d8cfaa8258db7ee69adaa33a1439", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300906072a8648ce3d04010447304502204cc9271c804ece5ea89f06e0c63843c795506a4c3a1d28f4a46d47c29c7db63b022100f461d4e5f10fea7f3f1ec0e74914c652a84cca9405391f77df497cb872bda61e", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha256/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha256/test_case_vector.json index 4a998f32779145..97c5400d0ad111 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha256/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha256/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid CMS signature algorithm ECDSA_WITH_SHA256.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020832f4324184fe4e26300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040b3f9dbd1212fac0046edae04939d851270e165277fd8cb122b337399f661992fc0ee93b530af6f83f1ed6257316f867ef78691d14b2ae5aec98551ae7586a05a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041406eefce739159031955de59c8885f5ab8a17ba10301f0603551d230418301680145d4290b1c895bdb7706aeb0d1391d2115c5c6a21300a06082a8648ce3d0403020348003045022100ac3bb9c66d2ebd94b7afb9d1fc249c6371f4d8e22bb03636ff69acad5cb03d8d02205ce991efe36844eac83e9205ca1edd35ceaf4342b0547f96bd1863be3f692600", "pai_cert": "308201d33082017aa00302010202081aa79db7a1e4ed1d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004690252fd790882bd9ceb5c85ab843ac5c5b431600f6eda945b42d84d5d1f364e35ef60479a1a6d8244abd0bdc5448ef55cb591c1028e276ac7f045b178bea061a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145d4290b1c895bdb7706aeb0d1391d2115c5c6a21301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022022745fb78130a7923813eb860c7192770d82edc1c2cfe5317c2afe314176358a02200582f0d8c79c986ec179ec71269ac7e72fe100fc5b26c939b05abb19e13c994d", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220706cf8d088172ff3b477993f8e8c52a1ca8e55f9dc23d3945d8e1e8a4175d90002206f000bd775a4f8018cf0ed95eb2602f962c98d033addf86e84f350abcdf58e36", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_signature/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_signature/test_case_vector.json index b34880a9f677d5..51d064472a34c8 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_signature/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_signature/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS Signature.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202080d61e11583ee4e71300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d05f76a3b237cc3738ae7f7a03c3d93fac6dd5077c1ee18e124ce4d622914c5858b3ec97d1cce1ab1207b87fa81470f9ea2e709f66f42069dc4f483403716a20a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ad24fabacde3200591249cc2202f301418f5f4ff301f0603551d230418301680143185d867b334051a85f7b446aea68468c9678bc1300a06082a8648ce3d0403020348003045022100e79aa67f04087d96780f68ecd48745ed742b57b6cc58989988a3b18860c74eb702200d7a265d71ea0f79ecdb906678789742fa1bf9d6d3d99e8d53b62bf8d9f7b349", "pai_cert": "308201d53082017aa00302010202085df1c32d21c0d0e2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040cc77a443329420741dc26ee955a8361dfd2174a7e81e7ed376ff3c9489110fd8f8ab84cbbdc21ef34b067370ac94dadf01cd286dabb6681ea9602bdc54d53f6a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143185d867b334051a85f7b446aea68468c9678bc1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100f05b93f95b181aca7d3cd55a73f5f4a561fe52f408c501df842eb9a6089ccb22022100bb8ea5464394284303d74415dac45fd4e81471d25635ad3d4e0a9dfda7ff2545", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100bb2e93d0f26c24ace0c0cef10a0d81c0d84dcaa07d64589d62fb23147c24027a0220485ee2ba0a3e49fd2050e5d70c522e3dcb6484e03ca0439c2038d0d5d8f409a1", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_v2/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_v2/test_case_vector.json index 61d4d5141df782..1de6a7c7644b49 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_v2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_v2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS version set to v2.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202083adc3cb144189aa8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e9e999a358e56209c22b38c510fb3fef64a497eae473143c566946169ca031a5e3be48abc8abd09845a39336d98ab2ca14ef2bf74bad0acd37cac490deb2624da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a5888b8340c1f7b7caeb8aa42f99b71606240dc7301f0603551d2304183016801449c9631211c3f8f30ca4b484bec2ab1114b619cd300a06082a8648ce3d0403020349003046022100b2bd8a12820bfaf7f9b6b57bf5b2725184ac2dc177ac6d716b608cf20f4c47b3022100b1315fa56a6929aa4126ebdad80658dd59c12474e3051a5ad18ee895dea79f79", "pai_cert": "308201d33082017aa00302010202084d61098263fd16fa300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048db02838ff21f937c1917a3e4b18be675cbdbb64a694a729893b8f74552888e8dfe48e0dc6c401e684cb8a39e648ff275d628c9dfe4ea64aabbb1ad648b14b7ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041449c9631211c3f8f30ca4b484bec2ab1114b619cd301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022047681ee29a1b27fa850c12f913ca606b4646770a2704385ab4fd79972cef306902203ced713480174eb0b870f388b980c6488cbcec993ba15dfc1ac1d47345b4c60d", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020102310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100eba961f6ebc6b94ff21c5b0e7b3c38c43e0b962bc2254478e707d5a19fee41d5022100b5891ea566ec4ff322c88ae42901537cbebd68cf8b9684d3be01dfc714f12aa6", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_v3/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_v3/test_case_vector.json index 42a211632e8c8e..a4cc0fbbf587a4 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_v3/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_v3/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid CMS version set to v3.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa0030201020208609bf5957fed7d54300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004789dc05f84a38964024d1ede7a496f3233c7da6ad99b89626ca2d110678a6fc6759b0a9aa9ce4ce2963ae4541245d627c21e89b85445b9b736fafe558e234138a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ee4fb899cf58fcd00af70a5c894a3558c8913cba301f0603551d2304183016801481d80ecba12618d14bb27b6e1191068e1e9e165d300a06082a8648ce3d040302034700304402203d63196c07f428a2b86256eb778e22f750d86b5e66b672773484d49b703b4f1402206a47c70f1baeffe75d0f95ca3351bd34eca500b1013624bb322ec3c0224f41d3", "pai_cert": "308201d43082017aa00302010202083cf1c49eee2daf5c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b1c5febdd9c1f5a8909501bef8824948eede5c80704ee9c6846d367f506a8032f1c72f2ed2fe061c4065d8e2aeae44e4107d8544a8146d160ba3cbec636dd013a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041481d80ecba12618d14bb27b6e1191068e1e9e165d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022007e894383dad716eddec9da562610557178a288d2fb29155fec6543e3c0ad259022100d67324e8b92055dd07fb993f0029501a4e91eb35d5ba197aedaa297c114af358", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210099df8a735ec4a09649c1221afe848abf3880d6ee5f398d9fd9f6f59da1250d2c022100b229ca249649a3faa81a1cd7b011e80437a65abf34e2c314820df31245bbe437", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_missing_pid_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_missing_pid_present/test_case_vector.json index 7ffc0e7136ace1..1340e0acc11120 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_missing_pid_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_missing_pid_present/test_case_vector.json @@ -1,6 +1,7 @@ { - "description": "CD Test Vector: The dac_origin_vendor_id fild is not present and dac_origin_product_id is present.", + "description": "CD Test Vector: The dac_origin_vendor_id field is not present and dac_origin_product_id is present.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202086fca8305379a51c8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048f9e81c533da04fa65f648b68a51e30e79cd25213fe0e12408de2c16143a9963b185be23b14984eaa85071801fc7f4c73d79c7c5764c6466d54bedf0d839c2b5a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604149a9da1de5035530cf84ae9828cce06883dd4c8c6301f0603551d2304183016801461cd58c802384c8d2b02da483df4bfdcbd7251fe300a06082a8648ce3d0403020348003045022100bd1cbf19f6c4f8755e6b4a35e589605f703cc33a620a68d4eab6803c6d46ac4c02207211efe3355790fadf84523ad67425364fb9a3fe4b9d8ca01682398e761ee006", "pai_cert": "308201d33082017aa00302010202080f9cc819a7183e74300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200046c49c8545aff616e73361aaafd3ec06e34bae81ab13dc0b74431a1bda4621f4dd9a5d4f67b4fac5b5463e9f026f4172bf2385719dd002e547bd2f1f834a8ba4ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041461cd58c802384c8d2b02da483df4bfdcbd7251fe301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402207fc77f59a6ca922c02b3231158cec6d44b26444116646bfbc075d09db010f7440220435f925a125174f1d8fb58c3f44186246722796356eff2afbe362b65f49801c3", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b0609608648016503040201304906092a864886f70d010701a03c043a152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800250a008018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402200d624e7be3c6724f1d4daa489b95110f06c9444f562a8d9798bed064ff562eca022052f07ef535ab980a5def109859c48f82b8a7390d0841d3bce756e57d2b664900", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_missing/test_case_vector.json index 00671b42ba8781..80e1a41779744f 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The dac_origin_vendor_id and dac_origin_product_id fields are not present.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202084d50d23a1fbf1a0e300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fad5843ac6a0e6ce7595253614ca0ccfa754bff4709edf68ff81d0f3dae0d8574acafd70e41868b758ee7d00c410c4bf956ba58cbe832be98f936b1d9c2fa8e8a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148fabb63e5851a5f212ce5acaed8c448e554d1481301f0603551d2304183016801473649040c70af4afbbb1bbded28377bb14a26167300a06082a8648ce3d04030203480030450221008533a38b2a3817d9511a3f9253e9f22a05d686e84a01d89fef2d4c315e2117d602207ff7732db1dc82541234789e7a82f68317440f13b9ef4510a48381fbe0c7eb00", "pai_cert": "308201d43082017aa003020102020826616921371e9c9d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000492e9e5797a852148103f60da01fdd12ab63602c297e8fe566356d7d89e573f76216ceafe379a5d6b3ea168d0ebf23537272e1a58d19021c216dd13dcbc285e6ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041473649040c70af4afbbb1bbded28377bb14a26167301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220326b9d41deff0d269e5ed4de61e7b19f4d24f7f68321415198d83164bcd20277022100e1b6ced478e5bc348d9dc2b721fa1be022e5658fff03361585ac30a471e4b913", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502203917850d875473d4ceea249b1a69f3298db296c912b193dca184a9e98f111e4e022100bca116dedfcc576533d1a2912ecd005bc6fd3fecfdd850c5db2da30100ab4ea2", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_match/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_match/test_case_vector.json index 5fe58f4d0cbfbc..f7b468832ccc10 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_match/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_match/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The dac_origin_vendor_id and dac_origin_product_id fields present and contain the VID and PID values that match the VID and PID found in the DAC Subject DN.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202082c5f9571dca5b861300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043cd9d908a0fdeb76fa40708621cb62c4ca32be47cf69c225071ee52cc900b0f611643cee47e2bdadddd145f25ba6b12054131e568f58f9a35ffa65963a0f60f3a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a716fae6c3d9eaa950017ba8e996f9a006a126dc301f0603551d23041830168014a03ac8b3ca288b09538ec1bf8cc443eec8684937300a06082a8648ce3d0403020348003045022100befbece9c30d03aa53793e5187b92f641133459865d514d818a2e1423b52e16b022013406c2d6a15e2c8cddf188a80e37fd3d1c579a86dfa35787d07bf715f87ab30", "pai_cert": "308201d53082017aa00302010202083f02d99518e372cc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c04710951478627c5bb6e0466a81c38b8bd10a9c334ff10a3edd3717a30e792cf53478a1bc59fa53d6a539b2a0a6022ad65383d1adee308ad7c65aff94685f03a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414a03ac8b3ca288b09538ec1bf8cc443eec8684937301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100edb92d9d41881a990deae2955d4a79d03dccbcbf607a0c87d07b52e0317e88c0022100fb70713bd140997b86983c51753c93c4fc09cef415003d7cab3710058c8eed00", "certification_declaration": "3081f106092a864886f70d010702a081e33081e0020103310d300b0609608648016503040201304d06092a864886f70d010701a040043e152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408002509f1ff250a008018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100cd9628a064b0421c0f2fb5ea4ddc4fadba37c70fc3fac7ba885121cb45f49384022069a14a56376e8155610eef914234a07952dc3b1287ce46926fd9b14c045ed04a", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_pid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_pid_mismatch/test_case_vector.json index 2705fffe53e80b..b8d8d49b342d90 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_pid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_pid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The dac_origin_vendor_id and dac_origin_product_id fields present and the PID value doesn't match the PID found in the DAC Subject DN.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020801a8ef779583419a300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200046ba79cc6a857e4563aae3290494cd869248b5b551d7ec78e206d79d9239ef3b948a69968e1dca0962647f16de78f9b1d4414d73a724b9eb3bcbbaca6dfb3c7bba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ed5fce750f4fbaae8779ded9990bd77ed74f5deb301f0603551d230418301680140e5e0154fa83852ea9bd7d513678ce621b12db17300a06082a8648ce3d040302034700304402206f6f02d977fb7d0b5782914a76471f6f28b6bace6ba220f6bd2911b88e65ac7802204fe9c5893a713bfc65079e17f182949b1e7f30c1300e21a384ce0684a6bf37a4", "pai_cert": "308201d33082017aa003020102020807b9477dc7c08cbc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004db3961e906481011abb53af45fd9b92318c8d7081a9cf66ac9f48eb94c2582df0bf30ce9eae7839c64a7779b596096fbae6f3c107d807257fd819b19adc69aa9a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140e5e0154fa83852ea9bd7d513678ce621b12db17301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203470030440220238af97ac2ac11c3a7576e0402ecc25ac7ae6b405e6f92735123c7c8e58f76da02204e07a2ed178a80f90255231be0de620c90ce653987ad61f53baff055292144df", "certification_declaration": "3081f206092a864886f70d010702a081e43081e1020103310d300b0609608648016503040201304d06092a864886f70d010701a040043e152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080025090880250a00ff18317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d08faa14c78d204d7b3f191b7b18c667eb53a4ea7b8fb2891a297c07b223c176022100842d2b037776544c70bd1206615f715fc7a2e6692189e4acb4d99807bbd05057", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_vid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_vid_mismatch/test_case_vector.json index 6419866698444d..955a1fed7c61fb 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_vid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_vid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The dac_origin_vendor_id and dac_origin_product_id fields present and the VID value doesn't match the VID found in the DAC Subject DN.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020879ca6b466a955428300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c6139148e607ce3ef190bbdb39778ac0ea10c9aca71e6c4d0a2ab4480d2c022a4bc7fe5ccfc3a307da1ee904cd6dd4bed9f9efc9accff221bd96dadb5cb3862ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604144cf71355a2d6e55bfe85a2b5df3bae595c8983ac301f0603551d23041830168014dc22d4c0ba96bcec9e73febcc6a5c6a95cccd530300a06082a8648ce3d04030203480030450221008f5df6c8e03cd974f77e82af82bf236a8fe85fef1db273545342c27f36776718022049cfc7dde9ca713da03676c38e4d7be7133410404308aa065741416664617230", "pai_cert": "308201d43082017aa00302010202080a3e877acc9fc778300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000492e0c2e66114caeeea5a9071f4405edea66c2bfb28e4ee09c467ed85a4ce85e5f1f19758511daeb57875c73e76bf8c3420a245882acd4cf7f2fa65b470609cd4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414dc22d4c0ba96bcec9e73febcc6a5c6a95cccd530301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207dfa2378ccef2df8b4b46e07e480825b9f4cab1b5e951ec38b37f8f89866bb39022100e94ded063f5ad6fac41871b361b233fb440f25e800d26342d16be62443acc5d3", "certification_declaration": "3081f106092a864886f70d010702a081e33081e0020103310d300b0609608648016503040201304d06092a864886f70d010701a040043e152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080025090880250a00ff18317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220141fd1d963a4d35addceeb2588808663bf9e48869cdd7638fcd17ca7744db671022100e247d9707c2e73a241a3ecc681e98f431e926dba315a8c7af014eaed8005cb68", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_present_pid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_present_pid_missing/test_case_vector.json index 60d9465c59d190..3832d7379dcccf 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_present_pid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_present_pid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { - "description": "CD Test Vector: The dac_origin_vendor_id fild is present and dac_origin_product_id fields is not present.", + "description": "CD Test Vector: The dac_origin_vendor_id field is present and dac_origin_product_id fields is not present.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202084e03eb8442bd3357300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000432775051a1188d457be69d283d2d472fcf99fd91d0ce245ef4fb4d75726f71b3775c035f5671dacba351328d95553f1d052c6681b81bb81fd670da1662fa8b27a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604147409b1265bed56a570b09b12afd16cdeaa1d2516301f0603551d2304183016801415ca129c1fab4beef249c78b622dc725fdb04179300a06082a8648ce3d0403020348003045022100b263f48fd96ced033c137b21170f43bd02918dc15b73fea67ee2ae61640a7175022076a6ac30fa7996c45d8968c74891f9b8f7aa6b4e4fd1c2225f245b3c894deb6b", "pai_cert": "308201d43082017aa003020102020859c220c6e66614fb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d85129281a55c97cc9b9d6d7af6febf8fe95a6d3b78c71ed71f0f8444812b31686581e5f4010f68d9ce4f9182f7e7104d221da12184bad1a7124bcdf4ae131e0a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041415ca129c1fab4beef249c78b622dc725fdb04179301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207d9edf0f1c24a33e6d7db0a4235fce3252939ec6fc5a6b8da5241fa8d03fd21f022100ab7447a8d5eca096615f777af4f9aa43af9e4af1ba37f9c71f401a86ec31d28c", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b0609608648016503040201304906092a864886f70d010701a03c043a152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408002509f1ff18317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203b39f5769ff990ea93efe930bf51b535b46bf27eb512b31b64d5c1ce0b14a4290220258dc57e0c162d8999cb540a663ead0f7b8afe43a81be777df57ebb94b1d0ee0", diff --git a/credentials/development/commissioner_dut/struct_cd_device_type_id_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_device_type_id_mismatch/test_case_vector.json index 13849c2d91c371..d5f339f58549b8 100644 --- a/credentials/development/commissioner_dut/struct_cd_device_type_id_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_device_type_id_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The device_type_id field doesn't match the device_type_id value in the DCL entries associated with the VID and PID.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202085f01bc509b190dd9300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000487aecdce5fe02c34285d6ce225221bc3f7fc6fc9daf31e8f8a858e561af69322cea40af5841954c497a6e22144704dfc010b6712bdd863849c28f85f352985c5a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414fd34dded7d13efc8e32240d29591f4cb66073449301f0603551d230418301680140fd6fd9e6f14f152de21f74cb71e3fe6712dd69c300a06082a8648ce3d040302034800304502207b1d0291f7b87e43a891cee458f72c3756e34f8b7e7002c81bcca930c943bdb6022100c7ce22c0f6540b829d2412af63a7619d499c80906bfcbe35a6035ece6044c6c1", "pai_cert": "308201d53082017aa0030201020208096930bcd7b1301b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047a1f689ca5b0139009ecd54f9f35c27eb5b98ee3c3798ecf673db03e0fa09bdbf2cbfc63ad218b6637d932f6dab737f028965982e2acccb3404b2812091ac45ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140fd6fd9e6f14f152de21f74cb71e3fe6712dd69c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221009e98128a4fee36e3c5e62706329c8436e899c40a7b795b02213e642153771fc10221008a2c4cdc5fca7bbe0ef90546fa20f7f3766cc19015580338aead5a6122e34d4b", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b0609608648016503040201304706092a864886f70d010701a03a0438152400012501f1ff3602050080182603cbedffff2c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100cf9ef2cd6f3d1dab544baa9b5aaea70b6566749d061ebf2fffb966f3934c94820221008de090bf9e9e4e5c52de503176ca4b8f9190eb46785676de92e709f32c4ea9dd", diff --git a/credentials/development/commissioner_dut/struct_cd_device_type_id_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_device_type_id_missing/test_case_vector.json index b408b8ae58d446..b1fdef9f0dba28 100644 --- a/credentials/development/commissioner_dut/struct_cd_device_type_id_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_device_type_id_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The device_type_id field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020810b3b42fa205f9c0300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b9d8b57fb9fc15c992cfc22c529a0aa19b88dddc0a9b46b4aa13797093575e65085ba15d026d19182038db35e7609b85a6ec70f984572f5164da1dbf9200dec1a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141cde48d9ac01f2598a5fb2217df5ff58c93f2189301f0603551d23041830168014c6103d3cae2c92dc0379e8cce69bbcbfc1b4aa3c300a06082a8648ce3d040302034800304502210080574615e0e9fd4d670355ace058849224103f84b5e7b56d01c04d7f4b5378e802207011fef698625b88b6f7f79132f53bdee556e9a0fa1c2ca05e99f03b6419b569", "pai_cert": "308201d43082017aa003020102020872436953e3407211300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043d8e78d7f321594504bbab7556fde17cdc4484aefb7efefd8bb0474d00193b85f3043dfd935c2ab6cb51e476e6b39b4edc081441b8f6b191af072d920ede0901a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414c6103d3cae2c92dc0379e8cce69bbcbfc1b4aa3c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100c1135a1718bcc4ea707a92ccd9d5b2b6e7c45684d243fdae3fa75e02c75a18bc02207e0589ac4549b06d8fa45d728cc66fd2bcfd7d425164f33316efe8d8c2084536", "certification_declaration": "3081e506092a864886f70d010702a081d73081d4020103310d300b0609608648016503040201304106092a864886f70d010701a0340432152400012501f1ff3602050080182c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100cff9aa11d224cad4658821f4de919097e83ad2f926563aee18de157e576facd60220295d0cd70509b00efeeec306bb609bef718d576b98906ff6645e3bb66ac3153e", diff --git a/credentials/development/commissioner_dut/struct_cd_format_version_1/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_format_version_1/test_case_vector.json index e7c33e2f0f5893..083817981e4e17 100644 --- a/credentials/development/commissioner_dut/struct_cd_format_version_1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_format_version_1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid format_version field set to 1.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208035ec7a3a65b409a300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047186577af5c7e6dfdb08e9415c474a65f829b3572907edc2d790505e5887bc5ba2a873fcc9dcd675b87e96fcc8cf4b99cfcee7b6b3015e672230d12478f784daa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e456ebaf42c6ef15493dfc82ee9546172c80c7f3301f0603551d23041830168014c3a89febdb9d1aed09ed0ec7ced1f50c4322d95f300a06082a8648ce3d0403020348003045022100e01b2e2769d3e18ab2aa5901a93a9be4e12f084a678400f66ffe898e48a6394f022008c2f5f179c18c2231618d1528f8b28964d20455934a1a3a28d62e30cec1dfd6", "pai_cert": "308201d43082017aa003020102020848f107f0c566b40e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000474683a577879172160569252832accd2f50733b4cae596c13af815c0020d8fc4bdf20a6978f5181169a705d799a167d075eaacca19d54b5a650fd4de0f23ca16a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414c3a89febdb9d1aed09ed0ec7ced1f50c4322d95f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100aad83a91f94b4ad0b0ab01a609fe0bf618f92891393536f63cbcb00b6d2560ab0220255c68bc1ee929d029c835cddd728856ebf09c00f03dc363d39097b790b0a2b5", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210091f543aa73f3665262f783002d126e06ae641d7e96d33dea516b088b44000421022100cd6e9a27613886e9c03831ad4bb4d101fabab954f7daa9e505b31081818890a3", diff --git a/credentials/development/commissioner_dut/struct_cd_format_version_2/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_format_version_2/test_case_vector.json index 4c9f1508fe2160..55e5384881cb75 100644 --- a/credentials/development/commissioner_dut/struct_cd_format_version_2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_format_version_2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid format_version field set to 2.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208546d6d522eac4ba8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200046fe3d432d949cca06e7d4571d31ace8d3e947e87623484f96594a9d8daaf1dbb4a0d64a61849818f39993cc58934778e96b6e010b6b38a798454c80f004f0d56a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f3952c383741bc8c56a4d8e65631e2427efe67b3301f0603551d230418301680145c138e7e257715f85f7fcf15de659ba17ca193de300a06082a8648ce3d04030203480030450220233534ecba0b8e4fa7f5cd4b969b93882d27b12a68dfcacb226db65ea5444065022100bc9eeb65560dfd3bb529b479ea0d1e35499b1844bbcdc4fc0a6b33a68fea573a", "pai_cert": "308201d43082017aa00302010202080ca9cc09727c82f9300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000463e2721794f3e9f1d7a05127587e2f22d1ae41e1d12eeef1615d4bb624da430e5394d4c7561e0b01618cad4220f92c3a7adb3f995a68b8f0f669129116a13205a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145c138e7e257715f85f7fcf15de659ba17ca193de301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022041a7e9092f98355d832eb9161ebacb51f8e20bf016e12fff32b44dfcfc459f5c022100a7d64cda6f2fcf7e421330b6720fdf1675111cbab79a0c28e9baf55f71f92ed2", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400022501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221009ad37ffe2daa88ce82ba2af513e07a97be2b1f26bdd5b9101afe70151d56d7f1022040dee6e3b812d9f51436960334409a98ad84caa4e4a2a99bc1bdf7ee6f536305", diff --git a/credentials/development/commissioner_dut/struct_cd_format_version_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_format_version_missing/test_case_vector.json index e087c92ff94c03..d15bfce64f71ff 100644 --- a/credentials/development/commissioner_dut/struct_cd_format_version_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_format_version_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The format_version field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202081d0d93366a36e62c300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c2b8426d06970ff9f15fbc35ec948089718f3e4b8976ce5766a6892c7f783e4fe43bb535c239c5e2a468480288feb2bb6b0972a1ba2bae03019063ef9d0f110ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414faf55002b31f6820668e0948b002334327119f98301f0603551d2304183016801455334811118b29e0cba9a03c77084e59ba0e90eb300a06082a8648ce3d040302034800304502206ea57ae13900ec1ff6ad9a9ff401b753247a74e19565422bfa9792dd455960c2022100a5e970b31f5d28dad1b08bbb523422271b74682a69068fb03f85295260503cd3", "pai_cert": "308201d53082017aa003020102020809329adc63f55298300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fe271aa0ba3d243895c9600f3fa555e62869a6ccd2e67edd7da82300bfc3bc40bc5fc8a8d1bed78479d600f4c3db52b50b6e878bf20d966d0ddf112c24fd5af1a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041455334811118b29e0cba9a03c77084e59ba0e90eb301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b1f90ccef9c465b994748d7e480a87c50c20597cb1de338e835a295590e877a1022100a2d5570aee8609362bb3ce70188feb8daabd4432a5feb52f41ae65e8416d2c1e", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100e1ab367555c9ed7816e5a307123278385ca877f2a0bdc4c9bd0e5083d279b184022031770d30da5910be7821c0f0e56265ecce55f40a19937d8f94af6461a137ea0a", diff --git a/credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json index cba8781bcd3450..f8954776dc4a84 100644 --- a/credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Origin VID/PID different than VID/PID (correct use of origin)", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020842746453dda3a0f5300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030313020170d3233303730343030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d030107034200048b4e27fd46d015bc8eba0c1825b3dc47110f46f59024fc298c7be623726a62ca3d212cb3fcb49727740d22f977b7d020b6c5f0d7b6cc1f507acece9d1d7d3009a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145533733f2b3bb53210597a98f50af48124001fb2301f0603551d2304183016801424391a2ca5a801e0d174a4fecf2ae5256223a087300a06082a8648ce3d0403020348003045022047e6417ee7561058828789b02f1bd44c84b49d165a10d9bdf28373dc10693537022100e85ecb093c7aa6cbdbf9a2a5f48f219c0f7cffef3c8ef4e66f8e2fe1e7bd1c9a", "pai_cert": "308201bf30820164a00302010202085705dbb9324090c1300a06082a8648ce3d040302301a3118301606035504030c0f4d61747465722054657374205041413020170d3233303730343030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d03010703420004381efd94c1d4049bcd45b803682945d13465c354964094697025920906a5d69f23cde03af2e159c662b00e3442ca69243f4e7963f47885bcfba71d8b5dc4db0ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041424391a2ca5a801e0d174a4fecf2ae5256223a087301f0603551d23041830168014785ce705b86b8f4e6fc793aa60cb43ea696882d5300a06082a8648ce3d0403020349003046022100bb12c3850de8c26559f20a2931a3067a47287f28dc8afe25b80c930397c947b5022100f67c7bfbeb08fe615480d96442539819bcd71836d1fc0d4bef9d213c171c26b7", "certification_declaration": "3081f006092a864886f70d010702a081e23081df020103310d300b0609608648016503040201304d06092a864886f70d010701a040043e152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408002509f2ff250a018018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220494f87a430b234de3eaeb2dd756d49f5a952f99611b5e9049d864499670cad1c0220492f157848ef15bb597fb46ab387f639107bb53fc6d0dbe11b3fefc8e3baea8d", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count0/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count0/test_case_vector.json index 13655cc7ac64e9..aca02f4a5f9312 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count0/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count0/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field is empty TLV array.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202080dc031b7abf3d930300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047a99914b40a3d8dead6bd352f34b5e42fb5e21decc630aa4b113b84200641e44b247365a738994b4be8f090a1369addb4bc341a54e5473be3748f7e58c3af77ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604146834c01c4b79aac7d003b0ba6b9ab1a400560dbc301f0603551d23041830168014eb370b914c6bcfd7979fd3f45e2fddaab5ee8d26300a06082a8648ce3d0403020349003046022100ad008178698f20bcdc0ea8626c06c07a6dcac84b0a8e0acf2262680abcf0e9ce0221008c7982c11ae70833488189b9ae6cd14bdcadc44e657d0c405e54c0e403b29ccc", "pai_cert": "308201d53082017aa00302010202085a36afe25e5dd180300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200044412245c517c9a683b52cc94d75558ffc279b107281df2b0c42c07db0f9be2f8873542e666a1b992a2d250036499248debbae90ea8071408683b73c6af30336aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414eb370b914c6bcfd7979fd3f45e2fddaab5ee8d26301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100900c528c98b9fda57d0ef7910f5d6ef8b0e414224b770d766ca4b17d1a940c2c022100be3d396e3c63d2b7789574888711ca611e62b81a04bc74c4da616704a4233efa", "certification_declaration": "3081e506092a864886f70d010702a081d73081d4020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152400012501f1ff360218250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022037d322978286a3de31d08ee96bd942aa72da18fbe26b063b914934e5fd4e087402205601ec5cd295d33050ec64b6f3fb23bfec1ed436c02c5cc8f71639a49b5d9bfd", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count01_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count01_mismatch/test_case_vector.json index d1a6420a9965bf..1b551c84fe2c1c 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count01_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count01_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has one PID value that doesn't match the PID value in DAC.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020816c768ae269faa24300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e617c522bc35989fccbaf3c1b4d1615d987c6308d9f882744ce9669a2742094a2bd1fc62abfc2807864d27ac6c2b1b8e34ad5eb614b38177bed577f235123376a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145e76235826c77cb8b422a34be5c7318799713da5301f0603551d230418301680145a91bc3c2d772cabc0febfd2e60b3f6ae7fcb7b6300a06082a8648ce3d0403020347003044022077e9c39d62d34ef5800435bbc2b4efc21bf857f1fc444c1293ea6de2effb583c0220425447084c7aa6802866797e9e80c2777e85539ab8f54ac356353721a09955b9", "pai_cert": "308201d53082017aa003020102020859befb179d081387300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004079e47bcab04f0b58e456e0b7cd5e4aa6f8e8bf3213722a94376a147e01b7369fbbc8fdbeb920294ac6db2edfd8b62594478fb56df46fb1a61154be2fc21cd8da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145a91bc3c2d772cabc0febfd2e60b3f6ae7fcb7b6301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034900304602210098543371eb74e4060e9e6f0488d52f852b509d1aa35fadd8f5bcd65f4e093206022100873d70328f544762f25cd7180905c50fa8b6ab19e04dfc45446283fb1afd38e2", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205018018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c65b5b0f2133979bc4ddd7531bf401008178223bd19852a331431016cbeca0b202207cb7cc48ab35550809da5990fca76833177cc309b9d79f3420f498c127670883", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count01_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count01_valid/test_case_vector.json index 59879f18149afd..481de31ca7560a 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count01_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count01_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has one PID value which matches the PID value in DAC.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020846e7bb711b1a8f59300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004557802fa2919608b988d8e1d2014f8591d999f432c28007a8a3ad9709e9419cb67af46d0ac93db07e98c01a75883fbf4981f6017432bfc28faccaa1070d42707a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414bc9f74adf13cd1c78c72957f12fdf3f8a5fe2a04301f0603551d2304183016801403dd353822461c72c01f85a7983678b0658de787300a06082a8648ce3d040302034700304402206195ed4f23756d16128ece0bdcabcf9262c1af6344a09061c07b6168acd0a75f02207ea18f2a8bf3bf7b99dc6b5e5acb344f6db92289a06e90fa51c7a817370377f0", "pai_cert": "308201d53082017aa00302010202087fb1e1f18805406f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000426e8e3bb5c21d9ed7741869e5ed5c5934d2d377be3282bd861c2e0a4d34e354bee793735503bd6efe3d6a8572ad0353693a7c50168dc0148a5ff3e796418cb3ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041403dd353822461c72c01f85a7983678b0658de787301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b56f9572ba07f32a20aac9990ecccba7a6552602d2cd4b61bc514f832f958519022100ed7caa6a6bbcef7836132472f62cb0f130b1ff28b6e48cefdc73302edcd19617", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502201fd94ea4e095f4415928cd615ccfbdb4de8fd7f91452d19babae66d7e60c8568022100af9aff7d2a08426a1d2c232eccce49fdb61ac4e78c79edb3bd6fe6472a451e31", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count100_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count100_mismatch/test_case_vector.json index 7514b727c2dbba..c3fdf882b7abb3 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count100_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count100_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has 100 PID values none of which matches the PID value in DAC.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020813c9fe0d153b9626300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000495a09e0311075be696398378e4ecca35e1b934305e3728dcb10e9c5570490bb67e348ea57e97f4e672fa6175961f9e36ab87b4cf0defa3d36cc673975772738fa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604144679a512bc53543f5927544dff9389c1eefa38b5301f0603551d23041830168014f8ee1c6b27d43c7bd4dcbc64a4dc088076e2c0ba300a06082a8648ce3d04030203480030450221008a43da983e7c9b4f2f472e426cda0cf83a4262bb20f86857ccf1913d019584770220294c04a18f1cf019781d7519f39ca519e80a72ac962d56659ffb02fac6e2ded5", "pai_cert": "308201d33082017aa003020102020806d9a6b9cd17946b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e2d2d49d1f0dab8764c82f3cc0741c2eb06e9d179748e740aac361e25a4c2c8933191489ec3c3c09d525b87f8a19f9c65d6358b7310fefaeb412696842ee3444a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f8ee1c6b27d43c7bd4dcbc64a4dc088076e2c0ba301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022020a4ab2de432a23674b86c3e256c5698e6befc62c7792fa8db9da8e1757abe3502204211a398c2f98a112bcba7327bbb3142019221b459c8400e54568d44b057753f", "certification_declaration": "3082021a06092a864886f70d010702a082020b30820207020103310d300b06096086480165030402013082017206092a864886f70d010701a08201630482015f152400012501f1ff3602050180050280050380050480050580050680050780050880050980050a80050b80050c80050d80050e80050f80051080051180051280051380051480051580051680051780051880051980051a80051b80051c80051d80051e80051f80052080052180052280052380052480052580052680052780052880052980052a80052b80052c80052d80052e80052f80053080053180053280053380053480053580053680053780053880053980053a80053b80053c80053d80053e80053f80054080054180054280054380054480054580054680054780054880054980054a80054b80054c80054d80054e80054f80055080055180055280055380055480055580055680055780055880055980055a80055b80055c80055d80055e80055f8005608005618005628005638005648018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502207edcef8e1549aa5924f99ebc30b0b117b0ea950e580f024d1d34e27fd6a78cf2022100e4bf6442c088ebe23afe5d4f245cf73ff433fc855d637c35739ad9fa339bd868", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count100_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count100_valid/test_case_vector.json index 9c7038ab9d6569..4216d3c390f9e6 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count100_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count100_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has 100 PID values one of which matches the PID value in DAC.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202083d9a50313f7e6432300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000462849005c7c5d1e478e9f7646a07194a02195c27a6744fa4ab126bde19aa996ffb1edd37166784837d00a57c49b5365e7bac81a6d58a2c4207e32da2706125eca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140f3cf8c88db35522fee3cf07d76ed6f7a74218dd301f0603551d230418301680147c7ec3a697f1d1d23c3abf16eaa8543b41db0176300a06082a8648ce3d04030203470030440220521f5c8038043a4f525ab3a962a689a984919c213c6094e2a671fd87f306a12d022067027cfeff6a89e515807b34138e1b8ab30196aa29f9374ca9ca58608e9691c9", "pai_cert": "308201d43082017aa003020102020868922259f0f88d0f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ac190feb222ae94abf5e6f4bea6c78e3a8238d56a39ccdd3da557a0923623e8e463fb12d954cc311f85b40be0b81e6ca04bb2dae2417276cbda05bf443a898d6a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147c7ec3a697f1d1d23c3abf16eaa8543b41db0176301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100c9b17660bda201b3a1c620870cbd79dcfc6c5a9c26e956ca14a8ccd40de43a08022004ad90365b23ac6eb84a9e50f9c25f23e01c4fcbcc4526186c7af215e2b49c33", "certification_declaration": "3082021b06092a864886f70d010702a082020c30820208020103310d300b06096086480165030402013082017206092a864886f70d010701a08201630482015f152400012501f1ff3602050080050180050280050380050480050580050680050780050880050980050a80050b80050c80050d80050e80050f80051080051180051280051380051480051580051680051780051880051980051a80051b80051c80051d80051e80051f80052080052180052280052380052480052580052680052780052880052980052a80052b80052c80052d80052e80052f80053080053180053280053380053480053580053680053780053880053980053a80053b80053c80053d80053e80053f80054080054180054280054380054480054580054680054780054880054980054a80054b80054c80054d80054e80054f80055080055180055280055380055480055580055680055780055880055980055a80055b80055c80055d80055e80055f8005608005618005628005638018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d1ea878a4afdc2fa9421b821a0aa13c91adb7073a7aa522a37427e3deedddb0f022100fb4bd91f26623af67968c235f769685dbd216676a3a5e8be68a22882e8bb5426", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count10_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count10_mismatch/test_case_vector.json index 560412e4a8d322..02b77d7b71d511 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count10_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count10_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has 10 PID values none of which matches the PID value in DAC.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202086c50b4cec0f6ee67300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041bd6caac43916f3205141a69f6f23701bf475ee1afdd2050e2e4e2d8061f92c0dc2289bf5b6f81bee05ad5f0844d2f346cf457064bd2a4115f5ac4bc13296660a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604144f0ccaaedf52bea1d44f2044d9512515206ece41301f0603551d230418301680141de7c0e2d372e7e9786407337e2865d41c988d09300a06082a8648ce3d040302034800304502200172eb172b66f6f52e9f859f488f3efe1fa56ce2ec26bedcd431849d7a0cca63022100f6bc3169ce75c7aafa1aa97b008cf1e0152dcedbfb951eb3d388a2674a726af3", "pai_cert": "308201d43082017aa00302010202082857dd601ea8b4da300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000436904f5521859435ce88e12ca860d4db2a9226ba508c0078ad8df155e2304b6a82a1fcb0ee824bb6ee9bbefdf533a6da58e7bbeda8a401fccec570613f9b31c8a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141de7c0e2d372e7e9786407337e2865d41c988d09301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210094280a7789b65d3ea3285645e92ef7b4bd6d41e479fa4299a03f1a0c8bdf29e202204621f7a2a509a6806fa4c607b3e0d037fa7d4114f42aebd51a4f45e31f466254", "certification_declaration": "3082010406092a864886f70d010702a081f63081f3020103310d300b0609608648016503040201306006092a864886f70d010701a0530451152400012501f1ff3602050180050280050380050480050580050680050780050880050980050a8018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022003ee4d0af4f660acb22916e20add28c200535ff6119c9b6f265ad91f306e0c1f022100a93bb5f92bedba63c2d0ca7109e61191dbad4ddae05e05c43e153c162dbd6e17", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count10_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count10_valid/test_case_vector.json index 61a9e7c0acf6e2..c6a6ccb9324511 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count10_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count10_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has 10 PID values one of which matches the PID value in DAC.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020813c727933283774e300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200044d30a0a2913d3e430a5290f6f7b7c10f091367cf3c35cacd4918ebeba70e16500f8a8f7205750cfb7ed7c8239302903a30f616b2c9b64570aebc8c5710af03c0a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041407c291d0533f40e07526020c813e667658ea4314301f0603551d23041830168014751351fbfa9f9a5ecc254cca72530027e084aab3300a06082a8648ce3d0403020348003045022100eb85f860a40dca1ecd37fc5edd320ed9e4eb63475a819bec600a7a877456d84c022014da291fd311a09d622269da16456efba5138a2a5242ce50230725ddaad694f5", "pai_cert": "308201d33082017aa003020102020812d4b50d55511fef300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200044ff414682c6efa040a931d69d47375531d73385dcccbcd5573973efa2399c0319fa3d42d2789c00abffbd9636856130bdaece1e735b25a7947596e8cf9871c3da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414751351fbfa9f9a5ecc254cca72530027e084aab3301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402204f5189cbd11c19c3dc0cbbb172cc500f17379dc64d6569fa77a9c02c3508d3330220511cbb9543a21f4020c302ff30c4fa78a4a3a971b57445c2c585bd56a05d9ed5", "certification_declaration": "3082010406092a864886f70d010702a081f63081f3020103310d300b0609608648016503040201306006092a864886f70d010701a0530451152400012501f1ff360205008005018005028005038005048005058005068005078005088005098018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220302965578573f3811244946361f79ce605b02863de179d8ac6a36efb8b78a67e0221009f15b1f4c93acfae9d9c4302c18f6ead7a2a3f3beeb37575085dd1f157db42aa", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_missing/test_case_vector.json index 7fabff203d094e..1ada3777846d1e 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202081fdaa42991ccbf5c300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200044febdf8a83168d7a7c7be2fc6d42da9f778362105e0a5cc2709f712aed71b1893bbec09fb1e501b75b4df6e99d73a2cdacb0de68dddb01bef0aef2d466b9e1dda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414136fde481954f10977aab54c0e4ab7220f690741301f0603551d230418301680149fcf9ea3beed65ae0e5edca69600f4a20fa10597300a06082a8648ce3d040302034700304402206324cabab17126abcb90925d0501cc172f07d7eb8ab43390f0da92b1b18f2a2602205921cf9056d51ada910adc6a377c645369700d31a8a218eaac99d30b605e7f59", "pai_cert": "308201d43082017aa0030201020208724dda0890c6a378300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041cf4b099d094496b6fa3f4dd72f52a0a0742bb67582e20d24ef4d1cf8e6f4d8870684cc49ae09e5adecb024393fd67203246e21d06351c324622665cc2b724d4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149fcf9ea3beed65ae0e5edca69600f4a20fa10597301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221008f91a73b5646800340e04e1f7478771086430561ef1ed02ed19d95c29ccc06aa02204e019062c79e9715b254204091dbb38da2b67624deb13629b30b933008db02db", "certification_declaration": "3081e406092a864886f70d010702a081d63081d3020103310d300b0609608648016503040201303f06092a864886f70d010701a0320430152400012501f1ff250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210090cc80d5df9abd077d88a1419ab98362e7dca75c63d792f55587bf60aac3a6be022100814b62096f52d8c92e724c411e9d566c37b243f1ad75685a7c25a182acb59786", diff --git a/credentials/development/commissioner_dut/struct_cd_security_info_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_security_info_missing/test_case_vector.json index c26acd865bf73a..53ff3961ecafc2 100644 --- a/credentials/development/commissioner_dut/struct_cd_security_info_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_security_info_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The security_information field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202081f9839b2310bf858300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004162f2d706590ca77c9e1de0a183d11ca1dc998d6d31bc5e0f2ccb9ba652bcbab07c71366c1359f56872a6bc715f72fe9f1f4a8ffcb3cd487c91eded0cb842000a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041462c90493c8edbab9e28c3ed0898190b43a937432301f0603551d230418301680147f9df096b23be219ff644d75ac3ec084eadd2b15300a06082a8648ce3d0403020348003045022055a69069836e345832d570b1e8294388acb62e04b007f5fd524cbd955711ef43022100b99c4a9a55412bc33ede6f3f7aaed189bc1b3a06a3acc2fa1314710e7d9b42d5", "pai_cert": "308201d53082017aa00302010202082dbfc301ef98a555300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004dea4531769105d7a18cfc800847149e0675797adfe557502ba78a2f0340a5aad74d0d91377743ca89d51258e4d2a31b98b27db29c8631c226cf8dd8b92d9b4b3a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147f9df096b23be219ff644d75ac3ec084eadd2b15301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034900304602210082c316171a4f9d96a11a3038735d8f7876a2ce670d2d43055888903bac5223e90221009e2bed4651004bf7b1b71d4f88b0034dd07d0ea7677a5133dd3b265be0cf7516", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100cf1310f8316f1d1d5b2ee2aee1e0169195ce52fc98f18b5c81327ae66b40ec6f02202ee3d05d763838996818ed91d77c5ee2813c056f4b4c8029c771dd2573c6a4d8", diff --git a/credentials/development/commissioner_dut/struct_cd_security_info_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_security_info_wrong/test_case_vector.json index 5c14ce4b86606a..7f0ee787bf20c1 100644 --- a/credentials/development/commissioner_dut/struct_cd_security_info_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_security_info_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The security_information field is set to invalid value (different from 0).", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202081f9e401f772b4b2f300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004989423f9e0db0bb3f22cd8c6869e192c4d09782c723ba25fb2e3fc623fa40932bcf22aa721679df6fa800808ae58da2399c254ba0ba2436812b3f96b94c6db54a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a38f1563a5e2ae848a8e681258f5a25000cd48fc301f0603551d230418301680146367ba130fd87aa3c438cfdcf41b241cf8321269300a06082a8648ce3d0403020348003045022100e7f32d095ae49428636c66f58509c9ff3db8ba9820266d0dec22ad3b96f881fa02200b78756b2cf84e15e368d199fdc17083f9319f4d50e5d7a2c21c0179d87091b9", "pai_cert": "308201d43082017aa003020102020828c893a7a03b5015300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049c433bab616a79c7b9b65caf2d497527ff899a5a429b2cfd875802adab808ffa038a2c6d63b11d207f9a8ac2cd7b23d4a77406718f33d22819b9c7199242fcf9a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604146367ba130fd87aa3c438cfdcf41b241cf8321269301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202b2408789db2e47d5c0a04878f542f5a985c63c28765c33bdbe55761ff2b81e8022100a6258588e1d045f14de82f943bcf3ad01b1a14aec661413f38c4f83f1af04419", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304606092a864886f70d010701a0390437152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002506ffff2507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220087385c9846e5d1ec7608356d9ae0597608686a47218820410ef4b2e0fa59945022100d1a0ede842c249956c5238a6a4084ac43a1920fbbe740f95f019abd41c98ce17", diff --git a/credentials/development/commissioner_dut/struct_cd_security_level_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_security_level_missing/test_case_vector.json index 1482d88cc91df4..46ffb2f91b22a8 100644 --- a/credentials/development/commissioner_dut/struct_cd_security_level_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_security_level_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The security_level field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020848ebeaa6effaa8c6300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b1ccb8b35d098507cb83f5275c02fa24b036596eb3be4d3f74c5ef15bbde05cfbcfddf3fd7799d0f1125aa4214cbac75aa16fc95380b9c0c930440559c639ccca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041416784a005e7a505f13d9086dcf6fab07bddf129d301f0603551d230418301680141b15686cf8e9a85132a6aca592145435ffcb42b5300a06082a8648ce3d0403020348003045022017a3caf6b18960695b2fdc5097a851886a8ae9d54410e1b589e51ea950b07487022100bb271f958f2bc17c654559bc2fe5bc516585dc68840a93a328c18065c6611ead", "pai_cert": "308201d43082017aa00302010202085e6d13de4408d344300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000402d85361c4d4c7a9192e820d7864f3b98fada105aeda108f7cabcd33dc0cd6222c5f1dd6fda7666af4062e97ef7ab78aa2c618ca1ffc3bf1960b083fe27d4968a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141b15686cf8e9a85132a6aca592145435ffcb42b5301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220425d3621f8a037ff10abcab5c55ee41f08af5633b6154c6a66f8c745bb1da844022100ab1c118fbcb73681a0492fe7479651c17c4c7c5ae529559d01b210fd6832c48f", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100a072d7b4e71515e0828a0a0eec39f90a008d0ce906c147bed9c672ed985847cc022100e12aacef50a0e61f482c73293ea2f9098240a1a3daae2db574c657399dfece40", diff --git a/credentials/development/commissioner_dut/struct_cd_security_level_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_security_level_wrong/test_case_vector.json index 460cf3ee650282..dde5ccf5f492ff 100644 --- a/credentials/development/commissioner_dut/struct_cd_security_level_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_security_level_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The security_level field is set to invalid value (different from 0).", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202080da10cfa103085bf300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042acb38b065a4b6e841ed078be69c436333eb4f3fcd3fba131c58fc550a3bbf2b26af1a4b075c465ecd8bcc3ebfe746ea77cff82c27f4eeb180239cb66857b054a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e76139ac056d314ff584a7087c19465c1614e5d7301f0603551d230418301680143698b9c4bfc47425bea49e984414c1048c4eef64300a06082a8648ce3d04030203480030450220532d60d475d105724d6a47be4643f0aa458f6d6785ee04f2c0529b72e6195088022100c0806be0fe17f1a0258b6ca20bc16ddd0b819bedb423617f748051007ab6592d", "pai_cert": "308201d53082017aa003020102020847139e5a7216dc3c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ab5566db90184e7fc7022d3edf7e1a2be3b1ebb766d7c155eac812eb9de16bb0ac8402f8a37fd821eb2175d3d8688f50d5b9cd0a2a1327ce7b30929302bdc311a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143698b9c4bfc47425bea49e984414c1048c4eef64301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b130f4fc0fdf7e6131082a17b697a5c34b26c7889216b94ea7daff49c7e486740221009059d04e3b9d5d9fed2f9306920838c74b0d5128fe428a9f3a92b979ea5802d3", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405ff2406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100f2429a0c926703d64c4cba672c919e9200603b3745211444dd84b21bebaa575c0221009c0d6e198957dbfdb88f2ffaec61496061071a9fabd2b8ac0246215fa1e805f6", diff --git a/credentials/development/commissioner_dut/struct_cd_signer_info_digest_algo_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_signer_info_digest_algo_sha1/test_case_vector.json index b59c8a9840aede..949a53ac942c75 100644 --- a/credentials/development/commissioner_dut/struct_cd_signer_info_digest_algo_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_signer_info_digest_algo_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid Signer Info digest algorithm SHA1.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202083fd918dfc8b2ab58300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b6387fd34152c23e5441d49ca6908963dcf491c9f52189ddcf989fa7812b91601f3f594a058c10f370df4c083d90d4550eae838af2edc6ae0badf9f97aac4ac8a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e1b81c9f7fcb6b11a16b3d06e2f17436f7ad344b301f0603551d23041830168014bfd5be8cf033ac82dedd9e3eb53982ee1bb1e014300a06082a8648ce3d0403020349003046022100a529d4b2b1134beccf3e85e8919ae0d710d22a05c4052120e7c9a30477406ab7022100b964a21ae055b24328fd7c20c70d0d19e5fd38a835de187b293c6636748e555c", "pai_cert": "308201d53082017aa00302010202083630ed293ceef824300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049f78c2ab73260fe70af9b13456b5eb28a94fa62cefa0d67cd95ae4b9286e42c3d6eacf970911b8fb0152b9bb610e8a82367381c19d0e0fe609a24f023c78f57ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414bfd5be8cf033ac82dedd9e3eb53982ee1bb1e014301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221009223d81d992907e9f7e6edfdd1903a36ce177b0f4175ed7e64e053ce6a36db50022100c6d630576e94cbb8495dc78601277ad8b1988869a43d279cbcde0220a9ff98d9", "certification_declaration": "3081e506092a864886f70d010702a081d73081d4020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408001831793077020103801462fa823359acfaa9963e1cfa140addf504f37160300706052b0e03021a300a06082a8648ce3d0403020447304502202c35d141be0c27a9bd5a5c69faa663b3f310d87e10899407061cebfd62cd360a022100f99c7b60e2b8d226129b4e87e0b38626fa6ef230539fb00b02d7a4d7123302b1", diff --git a/credentials/development/commissioner_dut/struct_cd_signer_info_skid_invalid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_signer_info_skid_invalid/test_case_vector.json index 791268974dd2a6..ac131dd75ea70d 100644 --- a/credentials/development/commissioner_dut/struct_cd_signer_info_skid_invalid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_signer_info_skid_invalid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The subjectKeyIdentifier contains invalid SKID of a certificate unknown by Zigbee Alliance.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202080449b1ba0ca6610b300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004476192ba7879dad903fde4281882fd9c31a932923794eec239011efac81c8f43fd679eb193215a01caafbde6a4e2416113554f898ce20d599efd2aae0d939f78a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a8cf7fca675bcb56264159cba7de9e50976f1e36301f0603551d23041830168014257bc2516e2e8f4a49eba7fcdcfad18132d89d42300a06082a8648ce3d040302034700304402202378a409779deef171791b30b8b8554a6ad795447ef68dfacd6ab2455ed3ce8d02206348fbcecea4c3867a597b0866b8327c3485b55e1078cf5a52ae53f5c9b52d4b", "pai_cert": "308201d33082017aa00302010202086b9fd2adb9fa9bb7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c56c72fa79ada0f211f0c1f80976ecc4cd20ce6eb107ad09454b35684c8e2e05c30f6ef41a5bd6382d1d8587c5d3dc4047a20e6b9e9b0e50c40821726c24005ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414257bc2516e2e8f4a49eba7fcdcfad18132d89d42301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402207bd148bc1deb4c4d2a57be1555e7151acd39ee254f49ad43b5fab8cfd4166a1802205db03aef7fe68dc04a68b84a4d4459b66b87c0b812e9e1e1d89cabdb7231d2ba", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfa56963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100843a5ae80128a72747c4813a2bd3e2d05399efe724c7e9fd96796be90481bdd702204a53adf892aae04987d392968f4e19f1d6b410f2980da7fba91ea64e1be54dcb", diff --git a/credentials/development/commissioner_dut/struct_cd_signer_info_skid_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_signer_info_skid_valid/test_case_vector.json index 18a7ae0cf3a447..6fb7844e370e40 100644 --- a/credentials/development/commissioner_dut/struct_cd_signer_info_skid_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_signer_info_skid_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The subjectKeyIdentifier contains SKID of a well-known Zigbee Alliance certificate.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa003020102020879d85bc8631fa644300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004cc3e63d50a1b6e95642df72a96d92017b528b34df8d6953c9b98482c7194017cb8eb7d87bbb326a37b4cac070dbacfdfbb1e64b0f0c0438b68bd70cb61431671a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414149a29058d0f857530f54686f995de0749434cb4301f0603551d23041830168014e42531c02856a9106eeee19ee9dfb3b360670708300a06082a8648ce3d04030203490030460221008a83809ac121294c36fbee051047e6e8580bc2d98bf29cf30a6c3028e7a41e08022100934913fb9f4265c5542461169de56e9b96c7c83be0d0059cd1cd5abf4f4e3035", "pai_cert": "308201d43082017aa0030201020208728baea41135814d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000423d95d94a1c9e4c4736795f260c37ebc8b7c8c6f3dbe5b1f9cae382fc778eadb3f3b25ec5505eaebff847e5820e4f6d8f471fc456bdbeefbde75f7f3325eb3bfa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e42531c02856a9106eeee19ee9dfb3b360670708301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100965f9a824426d8e2c4f223180b1f1622ae5fd96f9989ebc019942bd13a2bd2bb02202a3a72e40c36687602f4d73a979851b6e51ffd96f39febe42d2e1ffcbb0b16be", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022034b2293a7b5613f4cbc8a2f26b7da0ba28bc0915bb0142263d292d71789c271c022100d9039bb5de1d9d7250fe93562fd2adc897b9664bebbfbeb05cbfce5a3ddf3684", diff --git a/credentials/development/commissioner_dut/struct_cd_signer_info_v2/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_signer_info_v2/test_case_vector.json index 5755956e594ceb..75fae25b38822c 100644 --- a/credentials/development/commissioner_dut/struct_cd_signer_info_v2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_signer_info_v2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid Signer Info version set to v2.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208117917a583cbd6b0300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d939262dd82a30a9840f0fb114b097edb80808b7bc34ed999d048cfc64c54eabfa3e0c2b2cea96275392e7b69f6bc55a9d9e9d38052997ce47f331565a2bfc29a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145a29f560c9204c6e4f3decb4de05f0793d6bfd01301f0603551d230418301680149491d720f4889bfa448ab4986b445df01cb52df4300a06082a8648ce3d0403020348003045022100e9f0d2836cad376ee9152ca51f4f42ddc0846b151c47fda4f65be7704436918e022058bdd4dd12658d9fd6a356d063098d47085a06d209ab0c31f4fe7fbd575eb76e", "pai_cert": "308201d43082017aa0030201020208656b64005678b171300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e35323689b50ae5067c80a1a01f8c2788905617a4b763ebb266601fc5d96268e3e728e1761e06348e8985bb3c3e0090c62da47d4aa3e991ff54a760c33e5aa7ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149491d720f4889bfa448ab4986b445df01cb52df4301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022066273021cb039d8d3b44958addd88b95ef5487b63f6c2584b635b88c34ea9d84022100aac3275db29e500f9e1bed9dcbfc8382765837c6d9961a1c71f97c6f619db585", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020102801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100ee6175515701e2506a15163c7427596f5cc04af9ed42c0f2e30838d5231c95bb022100a2a6286141b7980fbe899f6b671617d3dc69289e86b6a5214c1c9f6bd78f3ac4", diff --git a/credentials/development/commissioner_dut/struct_cd_version_number_match/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_version_number_match/test_case_vector.json index 40c37bac4d6f63..e8b42883266175 100644 --- a/credentials/development/commissioner_dut/struct_cd_version_number_match/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_version_number_match/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The version_number field matches the VID and PID used in a DeviceSoftwareVersionModel entry in the DCL matching the certification record associated with the product presenting this CD.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202081622551da2d4d778300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048a940dc6c40efed5115ab4c5ecac5a07430cd076a0d147492923a1b33575c0808c32727eecc8c566a3a36fd36530d66d5282d95e1d2ce203f5074a376dbeb9d6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414316e558aed0f53a0cc88b5cad2459dcfe9b9ca28301f0603551d23041830168014518e46252f80867fc0469500b4dad94252a2b67e300a06082a8648ce3d04030203490030460221008fbb74877a92d7e721fa401452883242dab41cd361cf02d409da9c929f4718f5022100df09d5daea186377e943fe3b9369704287a6a4f3c79f7ab8f693de3d1dac9d26", "pai_cert": "308201d43082017aa0030201020208748e9a8416b212e2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004cb76fdac5fa085929c1ba9a9102d88e83582a8595a0db63a95329a693fe65a9b5a8eb9d19b515fb2e86eeb5adc8ef3be5789c232753f3f186a0fa9d77b3b9cb4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414518e46252f80867fc0469500b4dad94252a2b67e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022028ec372f5c36f2283ea0a41a15b2ec345f6ef701811859954bb9b6376b3df167022100e54a2b587e8616a4150cfeaefaf6b351b37e67264b6cd46f41f9b4c916c85bc7", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022012283adfefbe5c4a23cc33c6ec70201b26fe420a2b3da2f1ac147b70174decea02207dcfc97d3c49892086c6b719d70f82da7fff2220279524cf8c29add1c08f1330", diff --git a/credentials/development/commissioner_dut/struct_cd_version_number_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_version_number_missing/test_case_vector.json index 09ac52a80ae23f..904287ed7fd886 100644 --- a/credentials/development/commissioner_dut/struct_cd_version_number_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_version_number_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The version_number field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202086a7765b081a40335300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047e38ed35bc996dbef312cdf85e2eadd11c4b6c3843125082721d2590a5e5e8897d95b1120120dca618c683d7dade04623cb1a4258ccd47a05429c228b48d87a8a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414dab3eb82c3de0abef0ec250be90e26e673526228301f0603551d230418301680143274e481933e00139cd4e50e7f42cd52a403d821300a06082a8648ce3d0403020348003045022100cd7a6d0635e941363bb2424df39c1be8fbef4e8f4f7ba04ddd0fbb4a0008efd902207448d9b041a803f6b9d07788aaaf23e16ab15a44e7db9e573e5a926721dba8eb", "pai_cert": "308201d43082017aa00302010202081e737e8e518372b2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042b03124639fa4d89fca2aa66d5f671220772d1ca7605d17e24ac4d7e7b47bd8bd182a85fa16f466d7f635f46499abdea211eaec7146208cef25c90d3c62d14cfa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143274e481933e00139cd4e50e7f42cd52a403d821301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202802b12408cba31c5e097ef8ca46481d6c5ed22e8766d4c049a9d5131e81601802210085a2eb460b96399dff7b464e543c70d0a1d543c5af125c24a6a4f00642fb153b", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304106092a864886f70d010701a0340432152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060024080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e2135149a92dbe0ca02398b9dea402d46cc2149e20298050ccbbc102d6a2abdf022100b977c0aad94469db8fbe2305814997e3584494768d3baea235eccbc8ef6b820d", diff --git a/credentials/development/commissioner_dut/struct_cd_version_number_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_version_number_wrong/test_case_vector.json index db9807522e592b..5e5771102c0348 100644 --- a/credentials/development/commissioner_dut/struct_cd_version_number_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_version_number_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The version_number field doesn't match the VID and PID used in a DeviceSoftwareVersionModel entry in the DCL matching the certification record associated with the product presenting this CD.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202087833051dc59f62dd300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e828793a41eda8d9efdde853b217c5a17c0e16e2ce144120c4780cdc257004e8bf76f32cbd5a76294111afdd23cf8073592c77ad8414c460c6826f3b5a9f48a7a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145cd566edb8f6893abd4d1c04e74611931941d49c301f0603551d230418301680148e7778040228fc629f85dcc3fa1dfe10a5c2c49d300a06082a8648ce3d0403020348003045022100fd05569524e9054428e54c012fa6a7d6699af9ae7ca4af0423d055349c4c09c5022032c3b9ca820c120dc96bfa5c0c54d3916fdd2bdb357a18f0a7054c93e5a17f50", "pai_cert": "308201d53082017aa00302010202082b66d1b34a08c30d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d96ad82ce1bb46c468b84e98001a8704ff11a1e071f32bc8ea936226dfb9fee1e489675f5f4978a90331a22f59d994d3c5e37373122a27c06702e5f16a3e1620a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148e7778040228fc629f85dcc3fa1dfe10a5c2c49d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b92fd57713007c3d2774ab4717dfbe896f94e937e0039586c470839c16ed1dd3022100eb0521d25d3f3f285771c336258a8e988124be5419e03d6058c753185c1476ee", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507896724080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022020c748c4293aa2b81659b0a91d38d1e35bc3eb41ce36221fdc2fb58dd33a26de02210087aeae2865e0cc513c9911a69a82d6f2c796ed2abfd0c3a2779e79d76447fdab", diff --git a/credentials/development/commissioner_dut/struct_cd_vid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_vid_mismatch/test_case_vector.json index 8b6321d787ad43..e1827ceb6a6d6c 100644 --- a/credentials/development/commissioner_dut/struct_cd_vid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_vid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The vendor_id field doesn't match the VID in DAC.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020832adb0737dd0acd7300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000415f2697e787d00181354f898f65f7e018ced4c15c86164a69bcf75d20837376e524b991641ac066a2b20144c8de1b00bca902057523a7301b32d8ac4c450da69a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148f156be29da80c8230b174e8e83ec9927a25760d301f0603551d23041830168014d48b2c316539e3d42ad29a9b3b90775eb7a30e1f300a06082a8648ce3d0403020348003045022007b798ce60c8c0fe98c0444875e968fc2a1c402839989789863857851ea3d1c1022100f473c74cc7841444319f2d6f29570266451f7369f7418f42f92a5459cd971141", "pai_cert": "308201d53082017aa0030201020208157f8d400118dd85300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041532284406a7912580aeda7612483096a3dc644ff2882dcf6e87501790d2d256ab2beae2abc8d07b56394b0e14d4c6632493374dcfb67ccfb81e3c89fcc6b2a4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414d48b2c316539e3d42ad29a9b3b90775eb7a30e1f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221008c868b4f621fb63184c12022a43051bf73bbe981bcedf78c44b4dc7864323398022100cde48ee54a93c0c2373f2a5de308fbc247691ce91d8a2576d04f0850373ef451", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a03704351524000124010e360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c9b82be3af53917e8aff31d191207bedf84b37b38db9c9438c2b0834c4a98f36022022a5fa1ee66e3c620a879b8b64165238c72c136c0358187d3b4727454c105fef", diff --git a/credentials/development/commissioner_dut/struct_cd_vid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_vid_missing/test_case_vector.json index d9c704ea4a9a42..40f67b397d6c91 100644 --- a/credentials/development/commissioner_dut/struct_cd_vid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_vid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The vendor_id field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa0030201020208736178e6191897a8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048e3fe403838d9946a4f77157594ee7c28600f37487809f8303dbd565a85db0fe550956e121d4f9ccc113b82a4827857721b43274a8f7612ad486d036ea87b157a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041443a32ab12530dff0130d4851778e88eeb80a7ae5301f0603551d23041830168014b2350028b1fc772516e26f04be22f6c963a2a232300a06082a8648ce3d040302034700304402206ec4f784b52e2fb9a3733a3b074c45db84c3faa573bb2aef9e59647dd698716b02205767c6d2baf4567bbd412319020eb25304903af3b5b9a0874e303144c79693bc", "pai_cert": "308201d53082017aa00302010202084efd06d050ba2959300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040534d2d6c918c3a96e63f57be94ceb6d97bce8abe2e2d2c7d30ad9d12fec61a2fed0eff139332a152e40ef22720b3d5dc07ce1de84894c5842f4011c2e6e79f3a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b2350028b1fc772516e26f04be22f6c963a2a232301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b7229c9b630cec2c53a1c2098417a8418f4c48579336f6e0c6108dd8b384f388022100adb8085f4714917274c93fb919789528ba6d35ede12e47b3d4eb8d6b5c5f5c2a", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304106092a864886f70d010701a034043215240001360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210099fe1cb4ec023c66da5664313a73149bf5d8c3d4aea85bcb77adce5955b40bbc022100e4861d428bd36d52967a1054c950195e6b9f94baa87b2e3ecf875a74397b429f", diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json index 68a341172fa433..e86d10b0af2fec 100644 --- a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Invalid certificate version field set to v2(1)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010102083ba3eb7cb6fb2a51300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f5885a28e31cbc62c567542c3c1c8a3b54df9451afca02cf270f4b683f232e7087476332722d4981e3e9b7e3a26fb561ca1def1f2ad1aa4bfc3f335fa1cda037a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cefc2960347781458d49ae9f10ddcb124d8bfd13301f0603551d230418301680144f50dd7c6c853aca876237d9888b1d1ec3e60b9f300a06082a8648ce3d0403020348003045022100d063ad4c4b3b41eacdedefff0a76132c22f974b2d39188863c5b3913360ada3102201858dd9a65dd131e628d3d2c88bf9e772d2b9e068400893ffd0b136e661c3f33", "pai_cert": "308201be30820164a003020102020837029f464ffc10c2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004a8217a150f37a40310cf8429eadf6c8134c0f1f89366c6d2f74557990f056f62aa4318759930ffada0738864d913d239b6bb1e228a675ecdb59e3f8fc6dd14cca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144f50dd7c6c853aca876237d9888b1d1ec3e60b9f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210085998213b7727fb36e500a25af052e72dcce6b620ee45e5bf5c95b268abe5e17022015a7daedcd6489195dfe558da40cb3b1682eb8883e328d8bf4d89f84965afc01", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502204d3fb38c767492bbdd3811dc1f7457c065a4b670404656ae69f9151c5a03fec002210082239902f8046dee65d2b3354de83f292d4083c6f9dbc8a7487426762ee9c516", 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 index 5986030ae10785..b2b2643463ba27 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Valid certificate version field set to v3(2)", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202081908efc4bf218221300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000476dec962e5904000cd9f27bf234beb45f4c4a78c53937fb8e47389a4f68c2954dca78f0165f190015c9b0e4fc45855f3ffd1d34e37efcdb535c96edb8306381ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f1be91588378dcd745b2988757ce15d0ad9471b6301f0603551d23041830168014e31628f499bf0098610ad2b5f7a3e9de13d2efa6300a06082a8648ce3d04030203480030450221008603cd3f9dcc7778233d641b3182dd661d799179a0fc955525960bd0d4d898dc0220498a12f7160b037eaad711d4168e0d60962435d3cfab5dbd0cb7bc9210206f19", "pai_cert": "308201be30820164a0030201020208098e968682049bf2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042b2285059c4149c0e35089f640d60e7e6fc65dd82469bc1a9b931b507c0ed9a03c74f2f62854a7798d8934f0ccda282cbba0596b0668add094e722350c902e0ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e31628f499bf0098610ad2b5f7a3e9de13d2efa6301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502206b51e0affd4462d7af4985e27ccf20a15baa4b8b8b3d2dff7a8794419797d77c02210086cb585c5af3c09370f408360b3f6d13f6d09021ae58bc3ab55af035e5785f9b", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502202ef313c5feb221f1eddd34a97ea43444f9a86f97909e45dd05ec421e7fc3e965022100fdc7b7f459c983863a90cf590db765da9db6f9c83310536770fd3e12b14b78cc", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json index 58210e49605c04..fcf062fa0e8df3 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate doesn't include Authority Key ID (AKID) extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ae30820153a00302010202084b6cacca28f2d38f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040d678eabcb6d2ecaffd48577ec7d6ce32cee7fbb83fd88a0261db48a311ca4444220d4065d9a637b680146b51b58aaeb951391e62d4b6d9e6b1652418daef3bba33f303d300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414edf6f700acee89c30181b52cdc7ce035886c58fc300a06082a8648ce3d0403020349003046022100e39de7644bc6c7df2bee6ea677be430ec551eb6be466fc32a83273b5de82beaa0221009890aff16d4ba21f1e48286be90b70e37a31f5e6b96da253c762fe11e6c7e60f", "pai_cert": "308201bd30820164a0030201020208422ac4704756678a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200043d63829b651906834d8803cca3f7275a19b0107588ecd02efd15a90eac94bcb56ddc7ca53f90bd6c637a02b081fa26ef14b16308703ffe22120ed8d38b155ebca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141cb346961663080a366c07e5da9326ecb5d8393c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022054816ff16b3a3c6a8fbfb68c7121ed504f0d8c9820e32e5d0a01ad9b01d5236b0220748491a820cc39be4dda5d7773309b4f3759552a5da358ebe3684e986320fac1", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d94c50f3261628f77100cea34594e5b67acbefaa7e3ada07a5f74079bfd19203022100d96e258ae4ccc2bcc8bcf51537756e4e36046339f01e149bbe873129ea7af420", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json index 3438843c7872dd..b1157d6c97bbcf 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate includes optional Authority Information Access extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "30820206308201aca00302010202080f0adb750d58d690300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047cd0bc7ae419622908143e7dd44e58210f60f40f90153b8501440d9ef1c0998c042c06ec2d315ffbff161bf369f1e2798a41c3274eb024f927bec6019e115bdda38197308194300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cb73817e8b5134890901f64afb9947eec041bab8301f0603551d23041830168014443baf79ed2ce8ac121be322c591696d7c488ccc303406082b0601050507010104283026302406082b060105050730018618687474703a2f2f6f6373702e6578616d706c652e636f6d2f300a06082a8648ce3d040302034800304502202e1065617620a4cd52fe6a95bee5e7e93b731f75c5c60e2f6c495533e34a93e402210090fce33ff921169b5e90f81516f10583f7db861082651ecac035ba78f9aaa4a9", "pai_cert": "308201bd30820164a00302010202082ab9c139e3697f81300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004383bbdd5efbf439184db94779bc8872e613029ee241c9da12870a286c1a229ae40056338c75de07d538973692fa513c7fde5c2d35c72614411563b0a82eb4074a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414443baf79ed2ce8ac121be322c591696d7c488ccc301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402202e9cb6821140ff4352795ef52e3b95c97ea8360a8405855bc7439fb00eb22c5002205dbf0d04f9d74118467e6542d59e19432e824bd1a9bfb3d8825fad9188a32a62", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100a4978fe543e824a18c9a3c3f54ebd419893b4e4a22abdabcdc3fd6dce32869e3022100e22b532c829406ce468c0206c1b995a30801cb8a52b70b9278055c6f868e6930", 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 index 3b4c95122e1235..ee875e2cd0489b 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension CA field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a00302010202082a89723f6d68826a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004a8593b0eb959925294b794904335fb2e1890577033aeeae23d196118582c2e6b1ce7165135bb92f4416e6781eb1169459fa4fd4b36521ef8d4a8f6b9ca2b8e41a3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020780301d0603551d0e041604148b27a5fdd6d22159190befc07fac12de1c331a24301f0603551d2304183016801404647c4ceab82731e63d5a7222da36ad6c284ec8300a06082a8648ce3d0403020348003045022063baf9dc5b7fb720fc4e49ae80e662ce64834979453dda41965c3b3960b11c0d022100aa6d3c931a7d5b1da41e5716127ceb762ca4c1757f726b7d382f5d05602669c5", "pai_cert": "308201be30820164a003020102020815dc92eb5f39a695300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000419ed4905a90cd1eab92b974feeccda816e3c3556f467b1fd76515a88bad173900b85ea027cbe755b6f5d58cc415b7fbfb19db86bdeb0abc5fbd2a2c8783a999ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041404647c4ceab82731e63d5a7222da36ad6c284ec8301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207859f542713c2a0e756983b4a86086450456d48d389d1ff31d0aed8befa230c7022100afa3084ff5dd21ff3cb14ef9ca57aefa182cd95fa73d41f3c5b9aadb6a8be2e6", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502207582b5c46b19b264491a5bf4ea91dcba332fd38777c09255c71b16261127f96d02210080f3dab3e24ebb6e37586c3213e3d8227d7b72895188addc678548e09ff055de", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json index c7911dec9b82f6..039f4955b706a3 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension CA field is wrong (TRUE for DAC and FALSE for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a00302010202083b56a43ddd336667300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000445b4b2be47ed9b260dcb3e7083b62d826a65d798f5173daae437d43a44ebc471cdfa6f77259262643041936522f0ec35c84a3eb9589ed95279eba9afa8d81bbda3633061300f0603551d130101ff040530030101ff300e0603551d0f0101ff040403020780301d0603551d0e04160414da0e770aa51514be235842ba34494867f0a87d35301f0603551d230418301680145d227b7af2389dfcf038be059d03a8845fa5958e300a06082a8648ce3d0403020348003045022100f4d16c045c3b94aa44b4515ffe0db0af003a2edf98742c161401bb1223a6aee7022023a97ffc1d72704122ec036e9404b79a363d25bd9dd75e1420bcab33e724c4d7", "pai_cert": "308201be30820164a0030201020208399cc990009060a3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000436323ffb940179b7795f28f7b0777d5e92c8ab8fc258e2fab5efd7dc095402111c4d9ab60a9b3bcd761ff0c97ea88c39491a7e110efb2167407a0c1d95eaf95da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145d227b7af2389dfcf038be059d03a8845fa5958e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220038b785c2d8a1e213660b860d781b49794399a852bb303f5bbb34c5e6b247cc6022100e63ba37ecb72f10f8cb01075923a3f006808ff84cf8b8c997da657d7e1a6e3f0", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022028cc0043c6f627c9aaef3441800fa99746c1a5728157df2aeb4946fc6c071ffe022100b03185ac043cbb929dcdb20274350c5290128b214027235e4b5480d3ee559e8c", 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 index 18ddcb21e3562e..d642aaf2c9f2d0 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension critical field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a00302010202083c39dee6ad443f78300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200045d61999120ad734bc24c8c3e9a90a84cb6b51af16e0d37de263cafaf28d1d909b798576d25aa24d5626bec1c5d0b4c2657e0db398c94d0ba54ffe6b9734249cfa35d305b30090603551d1304023000300e0603551d0f0101ff040403020780301d0603551d0e04160414747770ef34ad307ca070906631fcb25fc2240e6a301f0603551d23041830168014de80b24cc570d05bcb56b30c3ca94610971aa597300a06082a8648ce3d0403020348003045022100e7a1b28d1e029ab2b4bcfb0f1b21288bc37bb25c54234af9f5cb2a2ba13174fb02206da535b89c9501e7a99a7dabf02981b61fe81841fcda04fd8f8a67421cc5b7b1", "pai_cert": "308201be30820164a0030201020208756697d1ce94f554300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200043400358a3bdf6236c43f4d2a315049b439c9129c9cd00af4f52b00b32812c267fbc117caf5683b68eb252b01430c9896bc49b1581546d9aaff4666c349cc985fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414de80b24cc570d05bcb56b30c3ca94610971aa597301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100ec865d2661a6b69a44ef4cd7ad7cf7fdafa6d82130e67da379fea4d477d40c08022058eb4a2ebfb940b71f0afa95f7619a911e7e051ab44b5de694a180a158c7b115", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502202490a27b9cb1b226d0b0995ccbcb6512a24d34dc49892d7bd9c8394776061e2b022100de5cc2332376522eb1dfee5e6fc9cd5933e5b9770b2ea597289a211f4b66fd21", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json index d350034e1f0bb5..0e8df7e0c0eda9 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension critical field is set as 'non-critical'", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a003020102020851d4a5d08cb1f84d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049aa9753a30ff3c64fd1ad087dab0d17adece618301e4169dc53aedb03c6dbeaa82b36bb45a33bb0c2b2ea04011595d8d9a61fe431aed07d7ca0f69b16a7190d6a35d305b30090603551d1304023000300e0603551d0f0101ff040403020780301d0603551d0e041604141893e06a3689a6ae4c7b9e3e8369b8c94ef457a4301f0603551d2304183016801494a409152a5af16b2e00d13c56af80a20322fa8f300a06082a8648ce3d0403020348003045022100f6acbc9b4df278a5bebd570e261bfa456a01eed1eca49a0c0e9a0d603978d5bf022007b769e544a8e3cf468428120f803e0d4b4182a67a03294ab4fabcd335d76eef", "pai_cert": "308201bf30820164a00302010202084ab968740d296814300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042fa2bb9feec3a00343693dd8d6ad018f81017e7824daf37ba64bcdaf6c5675ff10d7fbcddadacf4e4430e098da8c84c75a9c9af41270bc941299e7db04642ecea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041494a409152a5af16b2e00d13c56af80a20322fa8f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100ba40d3c8d1ddc146437b0ace816e269beb3240ff76f851944df16934282d6b40022100ffee871ee17f746f8dfacddecf30aa1a86eeed8a7ac31a467a373eea19999c5a", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402207a3b2f30fdcc229d11dce2e6ed02f9517603b40df5ed43453e4cb8c66ba8a87602202cd7245305a1091e35fe40d5e65214a6be88045f9ac85647579f45262606e85e", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json index 03aa9b93626d01..fa0a068e4d41dd 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate doesn't include Basic Constraint extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201bf30820166a0030201020208542ccbf9dad43cba300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000431e1d0a4f3806cf848bc6786abddf0414368c9e8e52bf92c8b29727f51ed12966d5a62dc7f1cb593a3cad939aa7a97c59cc0933363e964031b9197271065e3cba3523050300e0603551d0f0101ff040403020780301d0603551d0e04160414436b63c18e30d814b871bb3474a5873a4412c44c301f0603551d230418301680145f287b658fd9a7591673d80cd11f50018bb9035f300a06082a8648ce3d0403020347003044022026814c1a9939549333821c691205961ffb72853c1721cc30b2e4500b1d8cca0502200b4c23eb42ad94bea9e35afc44d0d084a894dcfd53435ecadd9b7540c2dce082", "pai_cert": "308201bf30820164a00302010202086f9fd8a98ab9867b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004f0fafdf21f5a7910fc1e8cead30ffe2361d0ccde01a59b43642e9f9a1d2e2dfad47c076f3742672b26821b5021cef6b2aecf80194cb7c1ba6b11a9a846f85ee3a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145f287b658fd9a7591673d80cd11f50018bb9035f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100ba450ce2dbc3863c543405cbb765b8dad28e1729521c503587d3b9068c06419502210080550950f0572aa0767805737b0f7dfd93ea11a30818eef071e39543de59e25e", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022049da2eccffd79253257db90af188605d300f91ffee448766e7268e17f8ba9308022100f29e915e4a179959d7f0192d2459a8e7b534f0abe60219de6a8ad7c9200abd37", 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 index 289f278da85469..fbadc9c9091149 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field set to 0", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a003020102020871174449215ddf62300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000429b58a07cf52b3f6efbb339c63b7b946c827125f99a1236a4c19f57faaefaeec9748cc3d18a2c9416fe0ee234c9d65e7653c5a20a68c1de45e48f3a2aac346b5a3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020780301d0603551d0e041604146ef90b0c8e122dc424ef5ddc9c36f922cd621640301f0603551d23041830168014ea2b3f73c70d1e91485a2a4c2eccc4ef88f0cc95300a06082a8648ce3d0403020348003045022025390c50ce52fcf58251cebd6c21a35faa2f760e56ba9fa553bfdb0fd0d4e29d0221009f30d5b20ac08f8543ebb4dd6a71c1889c15eb8029daa33b2b7d81075d41749f", "pai_cert": "308201be30820164a00302010202084678cbbf38e656de300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042c914c52129b7f1f4b582205926773676e0bc10f57f896889e460360d730734523d7fb614da73383459c1b2c00d1f5d2164145f2127d23e4148bbe142211fda7a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ea2b3f73c70d1e91485a2a4c2eccc4ef88f0cc95301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100bdb293acc0bb3a1aa5cd4d3b4c9fc59239b8684932932365bb42040571ae5f98022036e9bc2296d6e41e8bbb8c4e7960f8d91196644e4afcf53fb8ebf868d54a1711", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502200cbe95b5a51390421af00f726fb09796e4afc87cc64e6aa234cefdda1ff1b404022100d303c3cf20f95ddbade9090b6bb8862bad9068b721165a370d15a1f93db4ebd5", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json index b707f4cdf72563..fe4bba9ba9cbda 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field set to 1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d030820177a00302010202086fc58fce497f4fc1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043085781ed7aba5f074985a252618703bc6a590a0123257091b132b30ea41f6f6cff67245c9284201a5dc93f9e790e40617c2b1201f8c90dbb6aac2b6450c7033a3633061300f0603551d130101ff04053003020101300e0603551d0f0101ff040403020780301d0603551d0e04160414f10202fd24f013a98856b2f6b8e0737050a84ff7301f0603551d23041830168014cbcaab55db4778ce253aa016c4db01a67b1d83d4300a06082a8648ce3d0403020347003044022077f76c063eb3d61e1682d83571b15cc1af35b28281d13cfc54adefa3beca1bfc0220166661e380c214fed2198d656a7828a9525e5e5efa2153af9da3c4706c722628", "pai_cert": "308201be30820164a0030201020208279ddc8990db76e0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ea7f9047324cf0d380efda4b84487f9f25319436878beeaad973c6378ffe068fe7a439c6896e84f96e911309e331793fcccc54909399238136e8b6e3d0fa684ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414cbcaab55db4778ce253aa016c4db01a67b1d83d4301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210090b5d666fd5fc9572fb629a44c1602e45c512cd79d6fdd07fd00137f0a4bc75e02207d9e29fe8dbf530ff79950f5bf63be84e349e32b29692fa94ca86c4d6d2d5910", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100a1c34943dfe859c5f0a5359796dc6a10c04d39c7ef5098ae80faac357ffecd1b02203fe70b403dfb6f3437101f389dcb56bdc09add14897c222b6bf28cbbc4577d29", 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 index c21db084383862..74998c6f87289e 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field set to 2", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a0030201020208749b848de9fc6fc8300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049ffc39348e12c9a3cb9e4473baa867b0ea17a30121570dba19b764c96cde81de2d0a1483bbee43f1a611f8c3bab803b020f919f135cd052106d8ee4457dba018a3633061300f0603551d130101ff04053003020102300e0603551d0f0101ff040403020780301d0603551d0e0416041478a5e892cb6ec13e24751c611d75680c1d889b3d301f0603551d230418301680146cba764869bca2a7708c602b810b5a7fb7cfdd8a300a06082a8648ce3d040302034800304502210095d47efc8e5c1cb9fc87466deff1777b369fdb5e1bbb46986794b76546d4482d02207470ddab67618b1c684fd1b62a52b748704ba370bfc58bbe11c21fe600ccad10", "pai_cert": "308201be30820164a0030201020208360f4343b7b7f7d0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ab1f3b6308a2565fa2ee43880a9242c0261f90a06ec9a57f11a9b32c228512d4886f5a2fede0e401fdbe9ffb22260f39e613bcee26504b4322386245d6268363a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604146cba764869bca2a7708c602b810b5a7fb7cfdd8a301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502205b0843cdf3e909f9991ce8fb54d94a1ca1bfce42d3d044c00358cac93c1277e5022100c880ae96eab90cd3fa54939e97631a2e51086571dbf566219b7fa9d06dd01e2a", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502206f199c1ec502d8f15804f9ab1ea5fbb9a0f5cd6461d84cddb0f825702a6dc60f022100d57a257aaa10244c511b870fd9f803123e0df10b24e4edf669656ed1a0bdb9ed", 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 index d253e27cbc5c7d..4e591fb59c1ef0 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field presence is wrong (present for DAC not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a00302010202087d22548c9509fd23300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047a5f946faf1cac4d26d442e01acec757bb23033ed21f1aa9d66380a0570596ab983321a6622c41878e5a5e3d7274e6cce519e0673aa974450ba26165549f62bda3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020780301d0603551d0e04160414be9782bcc685ffa4348f4d548f9e2952bc3cce2e301f0603551d23041830168014aa8c521a1f45b4c5a352baf9b967c9a2189ebbe7300a06082a8648ce3d0403020348003045022100972e50f245c051eafb3f37b951a86d21413ab5a2d2f05940c5d164f878ff2aa8022009648b741f1e672a28df8c2f76a31d99396637b5553848aab541350c059c4f1c", "pai_cert": "308201bf30820164a00302010202084599ae62becfd7a2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200041ecb6f06cc52b8a26f9b9b4ecf3fb0d321d12bd1957cb03e466b7f0cd2a8fba696bc5210b30acbf2c483d7d4204382abf4d66f81303c96818fe485cb9b13a32da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414aa8c521a1f45b4c5a352baf9b967c9a2189ebbe7301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b1d26f42e3e4f049c9e5d6c3522e818982b04e59cb0a7a31b18c85bf11eafd93022100e36d9bee94de52af9d301a5c6c3313f48e29c43466fa8d211751d0e6d3abdd26", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022019367fc550de0d8f86325e9b3a1fe8a062894e97ad0088159c25421640d68631022100e78d14dfb028254f05a496eb027541ff71c13428f1bc6e2e56a4677852845eac", 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 index d50e7b59d3422f..36ec4fe1562d0e 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate includes optional Extended Key Usage extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201f330820198a003020102020826c07e13fdadaf74300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c1af73f31aadf87241edcf509a2e804781c4543f899e798eb511750c3cb4dc845ef9dc8b37142ac86f5805603840700b03883796097e4c5c45ed080e9bc3bad0a38183308180300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c66199baa73c7d6f96cf12ce7b65cf602504e64e301f0603551d23041830168014e83beedeb8b896935f5181271297c76edda5d0c230200603551d250101ff0416301406082b0601050507030206082b06010505070301300a06082a8648ce3d0403020349003046022100f5fbd1b41261451a44b0236b769d9f973e8083761bd56d246fdc2e25d6d1ed71022100e4cdc36166ba78593bb907b2065267838a595ae47edd80427e8b034201f8c8e2", "pai_cert": "308201be30820164a00302010202080676e3d48faf5485300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200046fa6974e916a3136a2fbb352686387bbfa03ced00f4fef8fe03bc52ef9850564b089bc48535e9177453c80fb6d5d1cb62924a52d87ffc93bce7a3841a83b4931a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e83beedeb8b896935f5181271297c76edda5d0c2301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502201f32b837f5fa576b91caa6bef6ae2500de51b0b9113474f36e4dde8bcfb93694022100d005466eca37d941a6329b8f790497fa14f4876e66e805aa7f5e9148950c1d0d", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c3dceb4a5486a898f6620304bd70b3030ea9b419455aca2f5a67ca9e192b5ba3022100b7adae5df4362351230f9579dbee9af8946fce3b64b5bf9d596c838e3ffe57bb", 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 index 0617f430376521..d8a8adb132de72 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension critical field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a00302010202085348b71d57879b61300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000404d635d5be07c4308366156e2209a5fdbf94cc18f11e3c724d9693d8f1e3baa12568282f42bbb55eede338c52dd45c112ad80741b68656a7058088e4138defbea35d305b300c0603551d130101ff04023000300b0603551d0f040403020780301d0603551d0e04160414cc5ea58fc66136108949afafd04ae350ee917300301f0603551d230418301680143cc58ec619899ee81c163ae8bde46544cfe0338e300a06082a8648ce3d04030203480030450220376e6a1f774cbbc0146cfdb0385c639f237a9a9256c9f091e640006fa3074808022100db7d5a67914cc8a987a5bce3f0e85cb73d9f44502e5b1842d579398ecc6f3361", "pai_cert": "308201be30820164a00302010202083d6fb5d8a98c2fe2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200040dd923d0de469285babbc47b2f3dc862f78918a6bee3279379b45b139dfc4aa6c1f296de9cb4995fc537dfee841a4a9f99fedce203f57943612f0d0f1946bc9fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143cc58ec619899ee81c163ae8bde46544cfe0338e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022045fd0514bced09f3e770cdf71e565523dd7c198bdc1a6c87d1d060abe2387c7402210089c258654f1a89f8feeb0f0ee42fbd9c0cd3eeb9878524a6e64ac6767b4e058b", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022074621792528816a56829309de1dccf9d15d6346f2023f1a664a16b647fe97a43022100eb2eb9a4b1f738d462c578c18737bb30d321a2a89ca2d496f9dd4b5cbfc9fb28", 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 index ca136fa6d03771..03acab338c5fc5 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension critical field is set as 'non-critical'", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a0030201020208099959334677fd34300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e9ccf6f8c208c955ce3e26924932ff176f3d79253e01335decd3eb05005e070552c9ae9c3a9b5a2c40b3da83bbd78fa51db04579f99d3a8e1e809cb44151db95a35d305b300c0603551d130101ff04023000300b0603551d0f040403020780301d0603551d0e0416041427e590aefc5446e019594cd218a24dd9527bd647301f0603551d23041830168014f5f420cf4f8968961caadd6d812281da1e447450300a06082a8648ce3d04030203480030450220463641e9ce1c371bd5827ad9d2c05dfacb21d4906b23093a2d06b1adf7e1ee76022100aa975a1db7a90c7b17cc8202917ae23bff5f6180f2bf513ff8313037bcd341af", "pai_cert": "308201be30820164a00302010202087647db73d75e27f8300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000435d4c111ed8b651ae24d39a66d7534c1ce8255f9f14e8ad060dcbc96969a0f7f49a4dd827ec6fcc925ba9ac55ffb7a3a001d7bafb03a3418c1982099b5fccd1ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f5f420cf4f8968961caadd6d812281da1e447450301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502206b3241d06d443f88962b9268ab8fc2e7456c038a591a29f2ef54ffbbe9f9ab25022100ce3da7a5235435b687fa17ae02dc878e756070c3808c0a356b32f912eb1ecf5c", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220298b626198b5038bb9a7f79ba3ccc271208db7c3df475f3697807ee601e273390220121e915fecc02bf1715a32ed36bf696c62bbf89cba7747d9be787a7dba7cb353", 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 index 4066f7d309dddb..49fcb1702240c4 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension cRLSign field is wrong (present for DAC and not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020868e0dac009f4c70b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000455e3fd5482e746ba7fdd5a28e01e58f02c5841681b5c94134e0d3386e4845b59765f065d451e01ba089b7a6d5d4aa71e8284b0c9cf5612582828297c45d75ef1a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020182301d0603551d0e041604143f7aaa92d6b76dc33647f689c1c5b38dcf1c1559301f0603551d230418301680145b740c56ac25d90bbccc73f87b63cd511a57cd95300a06082a8648ce3d0403020348003045022046122080b94fc7767fcb43b7d2b77e66a918fc0f8d792ab411912652c838259c022100a9eab5046dbcaef8d2a9193186a86fcbed42b651c6c74f6da6e524349bbc29dd", "pai_cert": "308201be30820164a0030201020208157c8cfe500deb91300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042dcf3568044c9481cd2c6b0ad4b6740500629a1318c8b73a741f17ae639fb5f59f16c715cdb27e995d39dce78bb805ed5099d68113116b41f9a78a2eb4c6d4a4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145b740c56ac25d90bbccc73f87b63cd511a57cd95301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502203b233512afda913788e740ce27fc06eddda62e06349acb066b90a9f11a3904430221008fa819829062bfd84d8e82732e891dcf3e7c6475fe5d8341e0eb9185224c9827", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022038de2b21625bd80e63b2789ca3165c934ed6880ca7785570e9eac250042639e3022100f97714fa8caa770eb151ee032ddcf91e7e12cafaa89a2930f260e631b9d98419", 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 index 9fe2a05cdd2a71..95ffd720f33281 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension digitalSignature field is wrong (not present for DAC and present for PAI, which is OK as optional)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a0030201020208611516cb5e8ce57b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000445b50fdfe1cc48523ea80ea86773611d507fd6d7df96b97a00e65118e908b2e8de80de34522efa043671c42648b8d1ad5d4d497f2b68bb275a7d5ef5cc977439a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020520301d0603551d0e04160414f3bc17e68fbb09ff2a77f7f06499b32b91d74d01301f0603551d23041830168014a66e9305a0a0bdfe507e29ae9e2e0fa9ed61c920300a06082a8648ce3d040302034700304402205352aed11ca8a49ab9fd1221cde5ef90a993f78af55480afce070ee92888069802202e40e6757b97f9a55aa6a7b2048b20a3537a27876b111e0eb2b321724d92ecfc", "pai_cert": "308201bd30820164a00302010202085ced6956be8aa63b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004cf18213b48c9bf7301785414ccde69bd6ac7212ccae0f41fd4d67b3b658d36f60a60978ab7522b3899c815fe374795e7a994d6d11ebfc2403210599fb778e97da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414a66e9305a0a0bdfe507e29ae9e2e0fa9ed61c920301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402205ce2d4931c0f16df3ee2d7b7c0566e103aff4d5a975c139ca926a781da50a3f002205e56862b0376d06f4379519b19e3731f21aa287292816baffe1570031aa50656", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100a561ca1272a12d7e6edd2b0cac5767b57e4c24c08ab9089b5494feea9090b6d902201c80bc16baca9f9f0c82f8fa96e3243e87506ac1061a0e3c4bf7ed99ab7bc43a", 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 index bb3c12e010b7c2..5a2802ff55c83f 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension keyCertSign field is wrong (present for DAC and not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202084ceca31fe8cc1d0d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004dc2019cdc198486fb105aa585ae2b7afe9fde3cd954ce68b7ebdaebd18bcaade8763af72673ce4b207b7740d8308d7087b68638fea8926496635d9c584adc7bda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020284301d0603551d0e04160414ad528529598849df671c22eb8526c9e0fd99ca33301f0603551d230418301680144adf4539d1902c0b9291fdcd1f5029bf352dd179300a06082a8648ce3d040302034700304402200f1948065b198f04554dd393b7d778b3f2fbe04a0ad677ad2e9991da822917a002202dc4540e2bb6393b768830547553cf5abd65cd4766b034a33f2b98e20a9e042f", "pai_cert": "308201bf30820164a0030201020208693f674e6ceb37a2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042edec26ffcb4a4ee30202a348962d50206a340a0a6719301300f9a7ef0b919b89c97139d705e52ff0b9795bbf785ef22fb7fb2e3270c553aeee331eff7006fcaa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144adf4539d1902c0b9291fdcd1f5029bf352dd179301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c9a5d2168863c80821ae8fdad1240ae832b5dc88d9548c62285b2c841b35e8c4022100f6e5972f2b1a33279fb7d41d47f23591977f358c409ef0bdf7012f8e8a3417cd", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e0c8bcd6f8b5eb6d16250a0687afcfcc61015d83b1ec39eb5bdcc189d0e5048b022100c6a3c7a04eb90cdf844ab205d61f86377829f3051f41509c505e94077ff39f0c", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json index 014486db725b2a..d009ce9d3c46c1 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate doesn't include Key Usage extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201bd30820164a0030201020208215044dce27eb102300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004612aac6db63e5765671fe50f881fc9e90a38ac1fbf4949076ce258c390e57e21ade916828afb2884bf8895a621272fb400d689163db116acdb5da464ff0460aca350304e300c0603551d130101ff04023000301d0603551d0e0416041489b91701325ce525f7c1fc5cccefecf6218b71f0301f0603551d230418301680147328ddbeece00ae84eff0cf947bcb0a858bfd0dc300a06082a8648ce3d040302034700304402205103c4420c96c641f974db5fedb3f2c12c2da211d4f20ba2d2cb55183b2dece8022001995dab82273f252b6e9e13cdde4c52afca7fe6d3d46d32dfe68bc6d2029c19", "pai_cert": "308201be30820164a003020102020810041d2abde2b12e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000458be50cabeb209738307adc953e1d7d9841b603c817d14128770eb320afa980490b749c2cd9d173c7fa70cf55dc523aa76c171a10df395b62e47a867d56e26dca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147328ddbeece00ae84eff0cf947bcb0a858bfd0dc301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100e596e48cd423eb9540f861336d7e7a1e05245a50101b9d904380ea8664629e6c02207dfdbc97e12b83e9a1fce02e532b08ca6e2abfbea8b323da35ad9b4ed7b90a2a", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008045ad78fe8fad5793f806a2b9f0a09cb1dfe5d56bf8634d5d8b7fa78783c9d402207463239b653f440d424d9ae9a3806918c6c9257e7ec0ed8f2813762c2487c45d", 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 index e5ae862e44b3d2..882bd28f3312d1 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate doesn't include Subject Key ID (SKID) extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201af30820155a00302010202081624edc6605cecfc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f1d31a47a1cd755e27dee511a2fc6d9d7b737242f42ff0ae0e30bbbdac292b5c0575ec2ea357b55f23e79f49b8a00dd6be753413b0354d60d7e64ace2869e4f1a341303f300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301f0603551d230418301680144baea6b29882dc8d950b25655b5125fa337dd193300a06082a8648ce3d040302034800304502203a1e77e24d4aaa8235f90fb986d8dd465023e1cfd8adc6f24453777b0a345fd1022100cf6999b65788156f482dcbb1894e9746ba8784f34919ad775d33510727680211", "pai_cert": "308201bd30820164a003020102020875e948035f22b7c0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042c4ff7bc3c1ea2ee45973921b1f5007ca11d4374065cbed6331a06774670a11a9fdf949b87c39b28441fd7297e5cb8bb776ad16c354c109d83d4f6580f530c8ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144baea6b29882dc8d950b25655b5125fa337dd193301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402206311a445fcbc207559893b6725803f100c40952ef548aca996a2aa1812c908e702205f7824d931e848b08870b7a13fd3dcd31288f9bb7736c570e27419a932e6a4ad", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220556a3bd62b64c80275221b1ed77ee92886edf238ccfc5c0aa45eaf2bb9d2a2d5022100bd8481340dc5e0d2d6c73fa131e32eed0d15e305abd5127e53e2a4e0164c2a6e", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json index 23db7bbf3ed594..e0f737e0511b69 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate includes optional Subject Alternative Name extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e230820189a003020102020863fd2c36c3425772300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004277673d904f61fdb8937ff76ce0f4526ca57519cbadc2a2b9575220b5b96eadf4753025b28f2873878a7dd24a2799a7ceae717e7bdc95dfaaee2413a63af7347a3753073300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a8172a9c541cc215c46c39a00245808a36d892a1301f0603551d230418301680149c0190bf16a2c24db91025bc806e7e86694c261430130603551d11040c300a8208746573742e636f6d300a06082a8648ce3d040302034700304402203850a8248d4fa35f358a5870e1528434a27c7daab752d0688b5710982b6a8c240220403309ed122ddf0a6a23335b65439a55e399a051b30cfae046401c9aefdf7a00", "pai_cert": "308201bd30820164a00302010202081d89c8f23d658174300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004306c393635a68d0f557dac73f1d4d17da33f80cc1b8f056a8f6513d28b44a59996087ac57f002628c3464475856555b175b055a76a3f79ff6ac306b0fcc90de0a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149c0190bf16a2c24db91025bc806e7e86694c2614301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402205a23780da0942070d5353875fae9df3241648ea458f30d3bf2e6edc796e97400022002170e33f252681cef2cd7d249771d6f390ecdc6d766b0792d071afd7e513528", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044830460221009942c494728d2f6703ad6df3c14d35d9df4e60d40fe62af4c74bf4e0c31924b4022100d3cf9ef9427fe415f121638660a5b22b1a314f4e485be6b6469fbcaafa1a73f9", diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json index 13a95b6b4eaf7c..b9d0199ac277ad 100644 --- a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Invalid certificate signature algorithm ECDSA_WITH_SHA1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cc30820173a003020102020864fb8736e4754686300906072a8648ce3d040130303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047420dc78fdb8cae68663f3a6d8516853d1b86026752e00ca1a8f283011c6dc143c38a91ae52c40588ea823f1ee82520656f0509d71405645f9df04d4e5646e19a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140f44403635d6eafd79b22ff6c901bb052c3bbb2b301f0603551d23041830168014b4edcb1351cd27facb24982c663cc803266760b8300906072a8648ce3d04010348003045022053fee0973bb4d8778f08fb8f00996ab6b109b9994e52f382eca00d8eca1f944f0221009b0c99672f16ea3947277f2bbef916267562dc990e824d1fa391685d1571c4ce", "pai_cert": "308201bd30820164a003020102020868cea4056d3de1da300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200041e4940f0f728561c933a879238c3c14a7b9268bc8bafe67eb4bd33a8eb84fa5d129535e8996e3447a35c32e7d808776c9c45c9c5cae4f6dc2c8faba1d4aa4d53a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b4edcb1351cd27facb24982c663cc803266760b8301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203470030440220689929a3c2e2da24d1ccee4764da7c2523aaaaca9f2835217108daf9a624d22d022062347d9d9c64259f4e354705e41dd92380fa6c33b683deba2430b020d934eef2", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100954bd416e8fc9d9e3732717e14248df49200cfb0264f9efbd2ef7e7dd5031013022100d9fcdeb6dc660c2fb9dc93518b3326e127a8ee52a56c7cfb3b1b108d5453af6c", diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json index 591298dea07bb4..eb5e3033a0de18 100644 --- a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Valid certificate signature algorithm ECDSA_WITH_SHA256", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a003020102020824f194f28e119296300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200045d288fc7196587d1aac5a77526009c0b8ea2adbaae92586a5849587314e0f7f6c648d6d5e367f62df669b3b3caa8becaddc0c9449efee47e5dd260af2cb10afca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ee2830029214d5da28183c52a557554cbfc2b943301f0603551d23041830168014f155cf235ed49b00fa8190434153698a284a8651300a06082a8648ce3d040302034700304402200c3ace47a075c421ea59fe213a239550d9ead779008d7bbf80614a540d32ab60022001055efd005ceb0d444a6688e27d6cea2f6647646710913a833d3129a5d33a6c", "pai_cert": "308201bd30820164a00302010202084f3894c89b211080300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004088513eede3ab06f4d9abe3a25923ae513f6777e35ba254b34613651376ccf78e6eeda590685ffe90b5e9189e45b7f5dafe0baa337cf18fa6a5dee42260bbbf2a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f155cf235ed49b00fa8190434153698a284a8651301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203470030440220052019ac1f580c3115008252de19ab594f200964d252c6d440c9d7f861d5911302203a54ae629a0a181d39ad3e9f43151ef8f240507db6d042bc89eab8341ec1dacc", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203599859820fc64f9229084378c292e1c5dea3cf6fd765d4ecb48cf70c2a2f9b702202825485a2177c59251ff7f3e4bc3a447c2eacfff5d29281d104193f634e00700", 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 index d31111b3a49436..941e3271ae7eea 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Valid certificate public key curve prime256v1", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202084fa605523a924039300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fb73081dcfa2edb8388ec783661740abd2774a4ef2faabc869d7ec3f805f8558bead9c2d13eb104ee8098941ee9eddc84bae682433c37e5fc95fa68535b120a5a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414fc8bbcfdb58cfd7cbd6473c19a827814a157d87c301f0603551d2304183016801446595df0f1411c1644e21fcaee47d4c02f248428300a06082a8648ce3d04030203480030450221008a1ee737ace2fd03cf6cf7b422436ea3c1a702530617f2ab0f22918579cd6e5d02201d57b49f7b1d564bd7b29a2c73c16fa412e698950baf2bec1e9c02bdfec3c7f3", "pai_cert": "308201bf30820164a00302010202084f92417a050994e5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000434e3ca01932672dbcbb2de13833866d814680b68c2e11d8632fcce66726753fe931badc727868a1ce79a205db626945163a9e231a2cfc552f7acb0559bf33d8aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041446595df0f1411c1644e21fcaee47d4c02f248428301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221008163aaede9e613c8f90c4dfe2f51be67294448fc0011e5ca8a2244a0c8b10d3e0221009d7014afbaae2b19905b6215276653802eb2fb1cc1188ac563937195fc79089d", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100ee94924e33c79dc11d0abc6ac93ca3a759d45524acc643f896056a8e32fd58cf022100e63935de6e1211a8cffc4877b6627478958fad5eca2fcf50f310d44c4f75d916", 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 index 2e6ed327486af3..3e17f75cde7958 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Invalid certificate public key curve secp256k1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a00302010202081866a3a6b7953852300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303056301006072a8648ce3d020106052b8104000a03420004f088ff60e922b7a96c21551efc6f1160fa48867b2e94950061c89ff7609670a96f1e08b9a85e39c04ae9aea903dcf23ae970386f21223ca4193011dd639c126ea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604149c8f72681f6ab4fcb1cb4a7cbbad8da23dbd50fd301f0603551d230418301680145853934314b362f5fa3516761838ebd60d68a0f1300a06082a8648ce3d04030203480030450220521d46359aec4710281048ca439e1416b8883224fa7f3ce76716a4d74eb255d50221008d714bd9347f081239f4c26b38e9c066bdee431bfe28f3c1eb062b3957fb769d", "pai_cert": "308201bf30820164a00302010202083072d109efc5d603300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200043eaacbcb56242620d0f15864fb9e97622bfe1375591ceb294a283ddacc5ae841c5e8ca5dcb908f22fddb57094885ed3688edd5559aa9fae96afd0cb44d5434a9a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145853934314b362f5fa3516761838ebd60d68a0f1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c4021880a744b21079ecf98533a63d674755650dc0c35cb849d8bde14895baf5022100e45cd3046e540c195ebce04b4080afc6074f826590909c5707ad174e73fd256f", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402202c7ea0026fee921c2266373c2134e14e7aaff35e4550b217db1f74ef160f7e2202207ba6bd9a23218fabe3ce14c34ef8a186aca257a34dc8e66ba10741c586a6c45b", 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 index 71e64580e6428e..de9dff5afb3641 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: PID in Subject field doesn't match PID in Issuer field", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cf30820174a0030201020208551e399f250c0835300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d0301070342000420fd52098a02c099a0b86a0f916d91e695ac582b378306417e531f2408f19a8b82844fd0a6c03a8fa661fd0b97f55d02a9ce9f27829a7bb66420359ac93ebe9da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041441c0285c10a3cc4e512bf66221faee35616b41ec301f0603551d230418301680144df465e80dad07c9ebb774f907cf6a43cb623f90300a06082a8648ce3d0403020349003046022100f076fc3bfe9ec463f57718d0a80e5cc88c7ae965e98e4235e17d811ecbe9633c022100b98dabdc08cb3ce17eb8cf2b3b78cb36340b09113b4ce6e34853488fce7c006b", "pai_cert": "308201be30820164a00302010202087c7b761799be9ebc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004e1044ce2148836899fa9ecb81478b0205816b5e5775eed2ddcab9d58c3e971db3e508786ac31047f5c854e98a3b9151959e76f304d118d2696bd68cfa75e5b30a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144df465e80dad07c9ebb774f907cf6a43cb623f90301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502200b6df23fb68eb1714ef2190b8b9195702c2623c21c6f81b3d991e171d7e650de022100a5bc3cc9cb5138ba0127e84dd7b5c5b42aa5f33757d6f231a9fb7f6534deab44", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d34a8ab1574e04baa20fc24877b4db32bcd0c6012369737f0408091bbf17c46a0221009c8609a1ab18c44c85ad54527adb49d94289ad0219717f931247877be416e755", 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 index 54654882246a19..7842af988a7b5a 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: VID in Subject field doesn't match VID in Issuer field", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a003020102020878b6ab2d77f820c1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000498d621a99b15a5f6df769e6c0f17041fad89164fa035e0d3f21e338cc257332186265663200b697997716dd8ed374e93714bcffe680b7174ac06061698f6cb92a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f54c3bee10d991c2f415b2851befbeee27c92609301f0603551d23041830168014aab0257418f9f8f9ae317f0de08edda1de9b3270300a06082a8648ce3d0403020347003044022030046109abb1dffa97c7bff48e46abbea1741aa0db7e041d4a08528a85c7754402205b12ba25c7b5e49b77e9fd1a4ef92bde48dda1db8776e50dbfdd2772b64f043c", "pai_cert": "308201bf30820164a00302010202087268af4a142801ea300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200044b4c6e509f3fd142ce7f91e2d82f2a0765e9a99ef150106f36bb680e6a9790fa6858a8a0ad2039265a240989b97d8278c5e9dfbda3e28f628734f8df1b6dbc1aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414aab0257418f9f8f9ae317f0de08edda1de9b3270301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100dbbc0a6300d09c989a48c2e640f6e7f759b4a0d716f719f03d77d84db0c249b3022100b60b0b242a0e4dba2903419e6eb145e5f7ef9bf2783bf1bab93492ff9d5e2c8a", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100eb10f6b73cfba8500f6cf106e36e7b11b5b8672872ef39f9fdd4f67701119916022100e0025a63abe9c70577dd58caa15fb18abdcdaf357e1ad663a28626984299c6c8", diff --git a/credentials/development/commissioner_dut/struct_dac_valid_in_future/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_valid_in_future/test_case_vector.json index b3623c513884be..29af9fff6ddcb1 100644 --- a/credentials/development/commissioner_dut/struct_dac_valid_in_future/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_valid_in_future/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate validity period starts in the future", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cc30820172a003020102020847f5c234304b0eea300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3331303632383134323334335a170d3333303632373134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004dffc8b46b0b48fff1cae51e2c6ecd0665f753872f4c449087eabf6f7ffa71236e61befe5ab5a8e999205f304cd2190370c3e796cb9dfa3c092f2a86c2609bba2a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414d2a45a15861772b85dd6c6424aa6e2bb2699e3bc301f0603551d230418301680143d564896f8107ddf5806a812ac6db916614ef69f300a06082a8648ce3d04030203480030450221009f09b8a2514bf896fc23c3887ef12d5d15e86bf8fb634b0041ef40a4f06690b102204e4ef9bc2c238c9df62ffb8846833f70501c9329538c4524f3e23095bd951651", "pai_cert": "308201bc30820162a00302010202087eee6a44e8b53a7f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c0446464631301e170d3232303932383134323334335a170d3234303932373134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200041d4eb35cd8828c1887806db9c283ec3c8eeeaaa7dc48e16f4c3f14af005e15a7a0add8a736a9bfa9fcfe3dca02a3093d679ecd3354d5081e2c839376e09d30a8a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143d564896f8107ddf5806a812ac6db916614ef69f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100cfe62184f758b1472e7cb1d4aba2c8bfd97a84d5ac4c31f61d6959fb65501f0702202cdc7eccca24b4df5f1d0325a20c2d42106b46c6f9236ecfbab634843ed32104", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100dba9d6d965f78bb8abad896e8adcfc6d282a4cecb5d8d6ce0a8a066839f29bf9022100e230a8ef5cf5bc455de07a1402fa9c8b83319dde36af7e88456a5c0ccc4865a4", diff --git a/credentials/development/commissioner_dut/struct_dac_valid_in_past/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_valid_in_past/test_case_vector.json index d48e04537ffa3f..092d6988c5b91c 100644 --- a/credentials/development/commissioner_dut/struct_dac_valid_in_past/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_valid_in_past/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate validity period starts in the past", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820172a00302010202087998c2933542a7fb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3230303632383134323334335a170d3232303632383134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004209d671b451f4b2578d2f933241b9d1935044757af06cb76e677fa37c16227726dca7384e34b0cb85ca51afd268a878e55963b65beddc5f40d2ccb2ac739ae1ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ffd806e2e6a889ac55f204ea0a8bb3f0c3d01f92301f0603551d230418301680149079fe1583f7b6ea355da01a02ddb614f11ba531300a06082a8648ce3d040302034700304402203a2ce7d7fc8436e212d6b0587a762f0b085b7eb607bdd8bdcbd4c86ae9b17715022030edf4169b2c96899849a42255c9bc7aaf8e04465eeb81a453aec3374f8620b6", "pai_cert": "308201bc30820162a003020102020816f012fe28135023300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c0446464631301e170d3232303932383134323334335a170d3234303932373134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004eebfd588e5d8957dfd59433e7cf86edc419fcb657424015bbd1fb4567775391e02644a382ace6c9000ea79c45e58d0f8a52b4e7918f29b946db412169a52840ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149079fe1583f7b6ea355da01a02ddb614f11ba531301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022077691f6f34428bde66acf50b95aa31be46274f4264dc77a3a52b2f7ce3f041bc0221008662090c1105194d42d5192c88877dcc1b4df0ab0e620869c89e806b131760b2", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402202b43d330506c1dee3c9c1b2d40a91600567630ee881814994d8993fbae8a6ab002206f91e1a6a1a6b75f830f72cfd5fde5490567783c936b51f67595c7a5df1f2c5c", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_01/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_01/test_case_vector.json index f503b4acf3d6dd..c8d3948ece98e4 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_01/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_01/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid and recommended since easily human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201db30820181a0030201020208218c28889f5dcf84300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d0301070342000454255cc112ec505476e1b979a7935fa85f7126c4567c261be5d282fc26f6c85113db4043172eb3c7cd8135b907bc28e740839ba0215862210728524efbcd8e6ea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041467885bc65c513e9f715aba9bf2a09930e244c1b3301f0603551d230418301680144710b9dc061857dfb72666f42648b9108b3ee007300a06082a8648ce3d040302034800304502200ffa0ca4b1fee309d87542e3b00ce520cdbd6b96d587ac8f947dde61f29e0d11022100a9b28c7e6d379582b6d97ca05a0f4a51b4fb1895a8233b4dd56cf2908107cd24", "pai_cert": "308201d53082017aa00302010202080dc4ea29d33c798d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000499fa98d8811876dd5f5208194d13ff917ef4aa0f33a604a27e38ea218507dfaf07db0bcc8ee09be80fb668e0896f6cb9679bb4e278ff54ed190a1e359d6be1e1a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144710b9dc061857dfb72666f42648b9108b3ee007301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c8acebfbe735bb9a69af26f77472af404a2cc1ec6dbc5094c62fd1a42e8679e302210094df643736bea83e987a029b82c819a2b40c9d1253e0c38115174c9778fd2be4", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502210080094e7ed4e6513c65aafc6ed4a62c5ac44b191c0101b3678a3914be841913c702200642b29f67f492a898ede088c207a448d108cdc4ae992016d1e0dec1c599e750", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_02/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_02/test_case_vector.json index 8f7047b8b3c101..ee4df7f78ec28a 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_02/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_02/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid and recommended since easily human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201dc30820181a00302010202082bd17a8aec741a87300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7069643a30304231204d7669643a464646313059301306072a8648ce3d020106082a8648ce3d0301070342000462ee4e03f4e5e0f9e995e5bdc8b8ac822e637a5d4da1b8f0ab84414741d109b1cbf2e5c08210c445888afa14d5813744a0c32ed1ae74098e66d778b8e92199b6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e68b0e84e1452483fb9ff6414e045201d6754546301f0603551d2304183016801495e3dc38383b32b155de4430f1549acaea15ede9300a06082a8648ce3d0403020349003046022100eae3d005a98989ee75b09667c159b9a2c4b8ea506e5cae15018de3a39b3edd8d022100e002e74dbd037c90b77997112856b3b9012ae8f8f1106c79dee376dffe2e2171", "pai_cert": "308201d53082017aa0030201020208118f5672c3cd3bb7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000446e6ca5c4e0591b98886ee982274b1fae00b0635fba2a418a9d87c7f88b88735e0e87c012676fbb6c3aead87181f237a3eccd95c545786191a57da1061902609a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041495e3dc38383b32b155de4430f1549acaea15ede9301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a97b870a7b44e36d6b760fd854454f879c496da6d358b1a5d16450b15ff5d999022100cfd5091a46a0b9ad7793ff783258652c04c0d1b7869e33647223f6b2c47167c1", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c345f58fbdd7ed83339dffada42578b622301fc930ea5b93d166b075174179de022100a83e0a21d78bddf8f4c67eafa98da04fe212fe10345168a44f94c564d53d1269", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_03/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_03/test_case_vector.json index 63c39b604b1c54..451663474dfd6d 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_03/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_03/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid example showing that order or separators are not considered at all for the overall validity of the embedded fields", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201db30820181a00302010202083756dd5e5948e624300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c324d7069643a303042312c41434d45204d617474657220446576656c204441432035434441393839392c4d7669643a464646313059301306072a8648ce3d020106082a8648ce3d03010703420004b60c4242a83072da725974f05e9c378e8c5e9199a0075c27d5fbb3c3516be1b19dd359330396c7d7289e0f62257b29aff2af10925b651421a849853fdc00cf8aa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ac88377781ab961af7a0a3f3d460a95ffc6b213a301f0603551d23041830168014f93941ac2d56ffba3a7eb9c6cc48c236d6739485300a06082a8648ce3d0403020348003045022100d9970cca51d4f368cbe877af4445f8338b00c5db600be3c5dc1128e3072e6dde02203818d384eb817c30f12f531556f2ef0dd3dde8b674915c84586ee11b817208f2", "pai_cert": "308201d43082017aa00302010202084d2be5dedf5d3af1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004013ba7ac6a3b1f23d62b0b55822d903be033f001807ed79f0bacdea514c4dbbeb649004fe13276dad1bf3141973c2badc705da8995f9f4b4c610e146c8c95affa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f93941ac2d56ffba3a7eb9c6cc48c236d6739485301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022054a160e148f4b1aa3027e69abc31d67b45613466f10933c5696960f10aa2d5e5022100bd34c3285635c0b84c86582b3d0716d8c84d620099ee008e6f27ef0ba69f2750", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c652b84aba698335386111a799fb3443520ce1b2814daeebf86abd85f9730e48022100e47e0a508493fb4c1cbaf88b52bf71d958799452b7739540925987c44a71fed4", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_04/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_04/test_case_vector.json index 2ecc078555da1f..2d2a34eb8469ae 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_04/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_04/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid, but less readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da30820180a00302010202086e7bbaad3ebfa8d8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303c313a303806035504030c3141434d45204d617474657220446576656c20444143203543444139383939204d7669643a464646314d7069643a303042313059301306072a8648ce3d020106082a8648ce3d030107034200044f0de20910c7136428ce428a85c0f7339ac0ecc6c25075f86b2bbd3a3e45768987834215d62ae2d17a253f3d0c7e7c3706f91f3e69a4f71c5cb2e58fd1dcc416a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cd814efbaa0fea8be236fd6d7e235b541193e16c301f0603551d23041830168014bd410eaf521aaa4e90382e6d464ffae404dcc07b300a06082a8648ce3d040302034800304502205e5e78c65005711d60068a717c114e9540eb5fc89a082bd347230fdd18e28d65022100c48a04a1d307d15fb9b62965ac66051915af50c87ecae4e43a28f74b4ab909d5", "pai_cert": "308201d53082017aa003020102020827c6ddb3cfcf32f1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004405df1a48a5a2f58245848934fec18b7cd66ca2730c2bbd53111ff24b4b9b4bac51f458bf2c6bd344fb6504aedf8f456f77c6407e156154317f53500b356c62fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414bd410eaf521aaa4e90382e6d464ffae404dcc07b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221009fd6463bf0201e3287a713f925d668b6c54f075b554782256c4534784cdfb5ef02210090820447701b0cc663af7fff6f15590e7a443e4d6788d9078c92ed766315b877", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220100e16ff557c192bf3ed3d07598599ed5cbf264ad6f60bb5b033fa35a2eee1cb022100d51aef4415d156224a22c8ad01c9910fcfa094b18e5ca17188e07a7cd0016bd8", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_05/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_05/test_case_vector.json index 0ae04af0363c25..7bc4d1ea2e0881 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_05/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_05/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid, but highly discouraged, since embedding of substrings within other substrings may be confusing to human readers", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da3082017fa00302010202084488071c48c43872300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303b3139303706035504030c304d7669643a4646463141434d45204d617474657220446576656c2044414320354344414d7069643a30304231393839393059301306072a8648ce3d020106082a8648ce3d03010703420004ee4c5bad28b2f0523c0fcbf5560fabc01d08c73efd1f6804de97408bcee7c583814e2cb8e249f0377b30fdf149f37374d584fec389f1ae381efa8a29f658167ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414854d2bb3666656944d04a0a6ff6feb43966a2cf5301f0603551d23041830168014cf50a43f2fde415036c0d339a83279503e1520d2300a06082a8648ce3d0403020349003046022100f069e4ff73b8b15435c163da275ee51cd04bd65ea4f31cd2d6adee9158ff5c230221009b8c6bb3d694bf68a705835f30f10bce400b728812bbe69a68489264fb165bb7", "pai_cert": "308201d53082017aa0030201020208055f644d34af6fe2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000401e61a17689fa5f057c474f0dd495d938365081687b8325dd37feb99072bfc7def72b04bb890deea110bdfbb44516d6eac0f6e68a285f057a830d30f179f5a59a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414cf50a43f2fde415036c0d339a83279503e1520d2301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100f0e2ec517536a6e74fd8b543229dd6b0397e259063405b32d4002df3a2e26c38022100e593dcd186470449fe26264cada693ab361c5789887dd2553049767597f9a7a5", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502205e1ea3ed215af5407a4d0b15f57b9456a7338a0ca60451a35d75adcf6ee5ca7a022100e7f6a4d997457a40d1cc798d00b3166e0a35e4b362f098dc5f6a952ebf044aee", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_06/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_06/test_case_vector.json index d8bf73a4323047..7c8a06915131e0 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_06/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_06/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mvid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201d930820180a00302010202081e8fb8b53313faa0300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303c313a303806035504030c3141434d45204d617474657220446576656c20444143203543444139383939204d7669643a464631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004d79211241a9aed2da74e1ab50f93c7379f1b93151c9c887144b8dd12bb285faaa2e83dd2ebbc856e135fc5c17b09c57a60a60ac9700b13d8110e4c5e9a66acdaa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414508e71f1ea785992e921ab1449a43ad58aa4f3af301f0603551d230418301680145cdf2fabbf52c17fa5e7b2c9974e1ebb19c71b1b300a06082a8648ce3d040302034700304402202686df38f7a27c889481fcd722cfcd36c62eb5c5887c8614bed3ef2f7eddb40e022026f8c3c00e971320590fbbf7c7b84526b43deaa02a66364b68f9b01383346a02", "pai_cert": "308201d33082017aa003020102020829ff9cd0d4fa3679300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004a052c3ba7ffcf738e3b9dfbbfd809aee3b7694b3eba78d6da2d7ca31339d2e5e6ff33b22719c26cfaa5da93297cc77e1506a9b333548cdfd82081a16e9b7406aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145cdf2fabbf52c17fa5e7b2c9974e1ebb19c71b1b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022033828a26306e2f18315e270cb26cdc6ee42be922ee69a5aed49a0cf8fb53ca9002201ebe4167282c703ad9b5f05ff7774ef819cc07050288f930cc7e98b625788b79", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e1a9240f055e6c87e0a4f870d24664cc6a1bca1b32041e41ee5423a835ea6452022100a2449e952ac701724ea2f44c6650d4e0281887e3f3506a1d6163723749ad7b91", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_07/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_07/test_case_vector.json index 0da0d32f3e62de..116c5079385001 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_07/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_07/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mvid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201da30820181a003020102020808cb431057aecabe300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a66666631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004bf1ba2406b80a7c0c9d2253aae44fce12c4c4b67655a6482af03d8427aa7f053dd5fdbbfd12d5021128e612bd450ac5bd0b287b4d6bdc5295b5b77cea8312b61a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414566544693fc947f0744779ff1612d27191d4173e301f0603551d2304183016801465c4094c43bf88b432b816f7d25d27a229a2f313300a06082a8648ce3d0403020347003044022064693383f20445ae19986ffa44cd335c19180e75795f2710abbc44603d64c54e022054fec013f7943cd789948495376771e70383bfc1037d2c85b1f06c1046175106", "pai_cert": "308201d33082017aa00302010202081d3d8dc0c2c28f5a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200042f0038158c9fa863429af0b9ece6452b47ff594f0fa4d934020f0c3dded9d345d8312b91e170907f70772d9a2eb382b045042983376b9407886ccc2db62d0297a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041465c4094c43bf88b432b816f7d25d27a229a2f313301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044021f2fec41df9db50622935573910be33482bdef484329824fe63e1af37282efdd02210084b3e0dcb437299232e83c919d65527a608154e1f40a8c4f8af72828e1c316ba", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100d8b1c71d5289d9b26d25d64c2c1e33b5d9da868cedf796924f3d2ecce3c480a602203d452031217f0759733d9fef6b5dd4946fc6c1bbec8800cc84927b4f54a7da71", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_08/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_08/test_case_vector.json index 15b13083dab8ca..07641d5a15fb30 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_08/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_08/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mpid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201da3082017fa003020102020815118084cc202563300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303b3139303706035504030c3041434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a42313059301306072a8648ce3d020106082a8648ce3d030107034200049a4ba942340178f5572b97094d7013eddcaf575ead694b179f6ec4c9d400310c1ef0aa8c35d416d4c623436b4b04dcb95bf19f3cf8fbd30254563ce38c9a3599a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414680fc332a9f467a85f67acb3cb11cc74f0e66209301f0603551d230418301680142bb7cbab0af209ab02a54bd74c9f2355e1bbe51f300a06082a8648ce3d0403020349003046022100a4fe134d392b7514d910d10328ad58d8f1514cdc1734e2c70463b40c2e1fa0970221008a97360f3a3dd383785f699cd0f9899a8d3cdc8a1aa39a6e79b6992bbfd76d20", "pai_cert": "308201d43082017aa003020102020842b162c932382dac300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004bdb42970bf96e40e6683146fd55ea5f44615c7dbd065264820573804a97cfdc886183e300a546a040b0f79a4ef35a420d67be4a09eddc94be52269aa512567c6a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604142bb7cbab0af209ab02a54bd74c9f2355e1bbe51f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502204ca398a053c3cc55eee29bb386cd493c4a411be38f8907e21433f0e0159d91aa022100aecd14c9953b544fd4d8ede7885be59611385a18bfb104e5426228bb801b5319", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220580f20832badfc322185a629da2b41a0341aa12dd72f592852722191efee5162022029c288ce573eec499ca06e84aafecdb538cb2da979021437c6788a0bc1156cd2", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_09/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_09/test_case_vector.json index 485d082b3da7dc..1c75f3253d66b6 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_09/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_09/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mpid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201d63082017da00302010202086ffa2e5eeb61d406300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30393137303506035504030c2e41434d45204d617474657220446576656c20444143203543444139383939204d7069643a204d7669643a464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ce4d70843a23252eba74614a37f5a5309b4e13be66a8b5db3baf44bf80d59a4e838deb550e9fd4481d9f54d214ef5ed9af822307440272fee7e166d863eac66ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414de00d539bd03626849da26b45fdacf7884ffcc8d301f0603551d23041830168014dfa8b46a49b566b099e2bcd09bd449a0d5f52e49300a06082a8648ce3d040302034700304402207fb82f1ebe6ab11a1e5133feef13c6d6d63c6dad64133dab8d81910c99e6ee9502203fa0c22ee58177489661cd2a4d0f034b0c358732de7bdc14cce5ef4ab2c95f3d", "pai_cert": "308201d43082017aa0030201020208054a79fab29370b3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200042416a7d58bbbb41bc77fc9b3c793a8c7d2a2f7f85815754c4545361d918062d82bedc5e987d47a48e72a576841646d1269a783884075f23e0a6ca442da8b2129a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414dfa8b46a49b566b099e2bcd09bd449a0d5f52e49301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502204c3f22a3d37c42f228eb9441815bb05951ada27977e428e814e3122c44f7891c022100fb8c458dbb450d16ab904cd8a43bf0bb0f330185d68f3e00a40ed394d05776f6", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402201dde96d7c08e23175c5052dfaa521bb8a063f84c5899a52436b5d032aab93aea022029a551c50d0d52133c388cb23d3adc1389149ea22449fc42390241bd67f3b2f1", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_10/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_10/test_case_vector.json index 22e6fb2f2de4b7..2d018aa2b25a1b 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_10/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_10/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: invalid VID encoding", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201bd30820163a003020102020830a812bc7c5c45fe300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a301f311d301b06035504030c144d7669643a464646204d7069643a3030423130783059301306072a8648ce3d020106082a8648ce3d030107034200048065be52b8f4ab2caf3013d05346c16689ecd45d5cd779f323d62f61d864866ccb2703987409dc8d5b99b16bb7c24b11b35bb134f9df21425ba39da0172540a3a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148ca0167efc3c765c91adf0e6cef7d662e1eb1538301f0603551d23041830168014e60a5e4b9217965291327e05b6eabcfd80326640300a06082a8648ce3d0403020348003045022100d17449f3cf83a85d16e7c4343bc10e264bdc92875a8051ab7f3f2eea6481b45102201ebd3950c7be50ff6222dfec1590e7b201d9aab8bbf7f18a0f9ae23f0014009f", "pai_cert": "308201d33082017aa003020102020832ba94c42f74da1e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004688ee8607b720b9997ae51bd6db5b4467dea88794583b43f8ee79e19b9f4120e31235ae9749127e780591131090d2114721d14f0883f5008a7cccaad4e6156eca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e60a5e4b9217965291327e05b6eabcfd80326640301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022014c85a0afc1bb6f24d8b9eff1fba7ef049330e7cd49c973be00a0e6f59e99737022004ff84dfb14274ce375126e609e679d34c6f5e86d1b6671b5f25f22ddafc5711", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220664fde5adea91e45342122a9d1d6df5cb634b50956bad69157b91aa8ccba0084022100ba2c1fb85725104068eaead244ba215aed326a21433d1e712771b9a8f3bc4de3", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_11/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_11/test_case_vector.json index 461b111e9870a0..2599481a26b64b 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_11/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_11/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: valid, but less human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201cc30820173a00302010202082b65e3dc5275db3d300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d7069644d7669643a4646463130204d61747465722054657374204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004ba680af819b925bcdedc9bf8adb080cd4bcfc7b287236a499e0c1fe6bb33c30c18c95455aa07a98ffc65945a22d6e3e725b43bb070fd02f47d50e6859f02acfda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141bd5a542acdd410c440c1224b492951f594ae3a9301f0603551d230418301680141c7b7b8c9b9444086455ca4ce3b6563d2db6fc5f300a06082a8648ce3d04030203470030440220506754efadb8356f065731f8ebcf22fd7d577978c9dc854b38e9fff872dcb401022017ebcb6fe47212cd883dd9e639283c69e819e248086bd5951591e2a0e93cbcc3", "pai_cert": "308201d33082017aa003020102020818b1e076dc0aaedf300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004383f11ca89935c512504a4c39539b9aab4e11f292d89ef271bab8051d0b51572824b41a3e2c8e8ee55338d143e9930b47b47aae438c9b4da95aadd06cc7d63ffa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141c7b7b8c9b9444086455ca4ce3b6563d2db6fc5f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022058540296ee569d219b66e12ea142dda6101d65be04485ca5feb514fc8e8ff6680220194efcf508d4adfa3e1e68203603e280e3dfd99c1f057a7faa358564571a5e44", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220427a3a99df86e798d5b7a2a840b0b260058873852a384eb67d8604eb3b78c500022100f59b32440d29408adcbcb3b608b1ce68382f6981e230fb5e7d637da4dbf878d1", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_12/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_12/test_case_vector.json index c947eb0d00da7b..895ec2b48fc7bb 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_12/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_12/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: invalid, PID not present and VID not upper case", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201c83082016ea00302010202087c8421ecfe7949ba300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302a3128302606035504030c1f4d617474657220446576656c20444143204d7069643a4d7669643a466666313059301306072a8648ce3d020106082a8648ce3d03010703420004bd4ba68cb580e099310b890f1ab893dabe7dfdcd7969e64e307a3565b85ff613ec36b355229cec16ede8b797d86bfc34e1c48c5a79c4662b784d920810fb0115a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604142ec709463ab3334a1fd77c81ed982dffa1d14f22301f0603551d23041830168014ddf00375d43c65047c1f08f5810164623a6fa713300a06082a8648ce3d04030203480030450221008d9cfc8c4e869cad6336f68266260da78872bad3696fc17b16993b8a2f4e545f0220423cd64e619af9bcbf5faacd44a3ae6cf5fe8d0e5bb5e0bbb465361238dce282", "pai_cert": "308201d43082017aa00302010202084ae2fd4c611e745b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200041e0609f32b8e09d499769c750ca07a13a1776e88d3c5c0b70942d2478865c6a8208d9f32ed3a5d6e8febc29a0bea7c8ec42bc958ce4bcd057a02e37d68abceaba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ddf00375d43c65047c1f08f5810164623a6fa713301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100c1550f3aa8778dfc255032f2fa2321df90a45dae082949c2118b3cd49a2c4ce702202430ebf9bdab7a68da642d631f3e5b6a41e94ab46a14d4ae558375dbb11ad9d7", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402201af8cbecbb93be21db9bfe79c87ec7a1ded945770b575ca07d0d3cbacced41620220794cc4afd4f78c505d6dce4f370d62d3baf077f19da4cf9880da21eed8190fa5", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_13/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_13/test_case_vector.json index ac2017d012a1a7..eec0ed8f0ef5f2 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_13/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_13/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: invalid VID prefix", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201cc30820173a00302010202083f8263fb83bfe6ae300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d617474657220446576656c20444143204d7069643a30304231204d5649443a464646313059301306072a8648ce3d020106082a8648ce3d030107034200049c0038fd271daee28494a945f6470e84c40e0882edb6244dd2df37cbb0da0b5a62e8f4a527d92c37ffd721dacec95676ac477e1ca9be4e348fd0bd75982984d5a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414df04f63745fcdf01b3670c6c24bd3595192aa4cc301f0603551d2304183016801420e0fd720609784388c6eff1f54c904157c70c44300a06082a8648ce3d04030203470030440220497a5592ca7b49b2ceba425167f00051c04d683c9ac4a1966ecf26a526bfd7c502204ac15272ee4224d300d8640493622fd120f72522d57d9a2f33c9bb9b6e51e460", "pai_cert": "308201d43082017aa003020102020821861c678a0297c4300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004eabc8faa45012e9e2a153ca7244da524cfa1686555490d0da5981076b19c5667e17b5444f95c7ef8c89ca322687d0930828558b2ffc7b9e54161ec5bf34c9a5ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041420e0fd720609784388c6eff1f54c904157c70c44301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202819789de8214bc07d64951f2ebc74a59ec20f59c915599e5e40b15f7ddd9b18022100e7ded830e374dec8f0d8b65c2e42fc5d30005a7c0df5f4ef6734069093c51166", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022012193cc131c18e54fc39553eafd3819ca98e40bdc6972de116322888006a0552022100ed76446da827bfc346940b396e7a2ff41d451733972bb707762b6bea864b30c7", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_14/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_14/test_case_vector.json index 2d05374bcdf6c2..990d26d0c60de3 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_14/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_14/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: invalid PID and VID prefixes", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201cd30820173a00302010202083450a052182d2cd6300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d617474657220446576656c20444143204d7069645f30304231204d7669645f464646313059301306072a8648ce3d020106082a8648ce3d03010703420004d4ca44d3452d78c8272daae93b6f9ce5885146e82a8f8415612388fe3ef94580b4fed9093f1008639017801e0125cf3792ba473b37d305576e984ca8bdd72ffea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140223a890046a4bb69b719552fd74bc8af09682c2301f0603551d23041830168014521d2fc8ae62dfb20fd7f5ddbe3a798380e31a89300a06082a8648ce3d0403020348003045022100cb49911425ce8e585513bf06ee68dc9fa39d6ad9e1492082d42ddbc49b9d6e3302202fe59c8e895e86095c7f47858725445a1b5d17a8d9848a0ea60ba14162968cab", "pai_cert": "308201d43082017aa0030201020208165f8b7932120930300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004078a4476badb7b22fb9713707d9f9a4c3ba556bc937fc346a7e4083abbdee63b12402c347502ede77f88962109a7a7e573e3bc2f96970d7980a2797ac6384c34a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414521d2fc8ae62dfb20fd7f5ddbe3a798380e31a89301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210091ac483821f0810c318bccf17763aa2001fb7a0b81b9f9b5ac6848ae5eb4ef940220737e0e7af6d1f4686dfc919e4f2c635a31cf4f7516ed33738657611de7909f4c", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100f1da2112b47840cd3598b14f5e9a305724b89041869b6c8f3a248d48669b99fc02207203ef330fed84804ea37cb901fa0e516ed0ddbb78db798e3298410880428e80", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_15/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_15/test_case_vector.json index b0299181dcf5f6..69186cb3ce2cef 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_15/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_15/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: valid, Matter OIDs are used and wrong values in the common-name are ignored", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "30820206308201ada00302010202087f2f44adebfd0fbe300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a3069313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464632204d7069643a3030423231143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004482e4f2df94a413a6bf7598f8a5a8a0add1dd4e4ae32ffcc0c449a07c334fd5ca78d07296dbfc42ce8b106861328fa721d1203750ec1bf1fbef8ba3aa41d4168a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c39a416240515bddb8e098f4362665f4b7d6d0da301f0603551d230418301680147bcf35dfe7adb6c6ba01440ae2cd783a07c0ebf5300a06082a8648ce3d04030203470030440220487add268c7496438e82c4b1894f418ca748336175ef0fcc7db325b4fdae245702201786614af15ed5f62f92681115495f453898cb1290f7e22651954a64a172c37f", "pai_cert": "308201d43082017aa0030201020208771738ec2233c74a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200043667dbd8353646f14f82c21a3f204e44829ef4111d5a9b619af9eaeef18cf4329ff92cffd26a6e3c38df91ac9342eea582c814e6ee20c3559bf72ffb3cd8257fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147bcf35dfe7adb6c6ba01440ae2cd783a07c0ebf5301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502205ed27aaa89a3167abc38c0417dbe86c55489abea5d54449d11199dab8a4711fe022100debedfe7e6026dd26d2ebdacec63a252e86c8670f465ab89d11792c1de5ce4da", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402201219fcff318b3195d01aa3c4b240849bb3b3234ab2fb974b71ad11bb70ef728d022050dcba92eb4886ab90488dfde585184e19033b9e38fe1819826edc8619a58d1d", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_16/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_16/test_case_vector.json index 733a9965c7d559..c587e55f509a03 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_16/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_16/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: wrong, Correct values encoded in the common-name are ignored", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "30820208308201ada00302010202080a03470de9c83043300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a3069313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a3030423131143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04303042323059301306072a8648ce3d020106082a8648ce3d03010703420004e7840a07aa0063e0c297520bfeb2ef0f01dabfb0d422183a29389a208569d7a589d42cc91311e6c2784efe9c6014bb0ef4da910daeabe72c81fbe64f79532a13a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041459e179e39d784efbcc8ab5724c8f0b192b1677cb301f0603551d2304183016801441cf771c87daef27d962d08e1a5d01a96ffa6bfa300a06082a8648ce3d0403020349003046022100db985b1699bd68cbbe8d4766af64570278401d069e4ce301e0744d7801ff0e11022100ca900b1dedd5732201d189de06a1324ecf7329ad293d72ab431b0eb4c72f6492", "pai_cert": "308201d53082017aa00302010202082961eae45ffb0ece300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004d50a4fd8812153d6abb41aa6f2efc40ca72c0d6eac26efffb137a762ee15fc7d0cec02b27591e7b67ed8412f14bb2e9cbf999d6927733164f914351eece7f469a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041441cf771c87daef27d962d08e1a5d01a96ffa6bfa301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100ce95bbb8317d27966a9e7cdaad4a48159bb58692076b19312dcd467e7ecb9c150221009e9638acb3cc4de3170e975cecf855495a4a10ec3325934a997ec8570c038f53", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ec1c30f9f1faf9d449e3dcb911079759f5218b2c046cf4439357a4c97555309702207629f39b6819882403f061008ba6b5839a0bb42b62211ee70a382e168199fa94", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_17/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_17/test_case_vector.json index dd60dd1a87ed20..feef4ef79c4f9d 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_17/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_17/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: invalid, PID is using Matter OID then VID must also use Matter OID", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201c83082016ea00302010202081ba0df19c6aa35e2300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302a3112301006035504030c094d7669643a4646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200043070b6bea8a294089468f19f351f6bcd16fb16237ad1039d5ca72e35ec63ca32fd1420ea34058b3671d66ac7d8fa6370628b625711c20646dd29262a8a110305a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414fdfe4dae471eb7cba37742b3c97ef7c6ed36c5e8301f0603551d230418301680143b6885a0010569ceb25af20b26968ef1386a882b300a06082a8648ce3d0403020348003045022025e3cdf47e060f9099fc5eb11d1268a370ae7014c93336e925ef2690f52db010022100985ba7e0d07335f8d952f528f22a721397003613dbdc364bd084619e301e3b76", "pai_cert": "308201d43082017aa00302010202082b94a3b21c530ab1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000497f9659ae16a8244bd4698f822174443bf4655a415275f477661d59c3954a2a1b20ed40ae2ca7e512253ad03691ba0b5cdbd6dd00792b31a5ecc7c853c93f86ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143b6885a0010569ceb25af20b26968ef1386a882b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502200bca5acf0b4a0530dea70af719217122de931c44cb1a87be0c8af33c04ec97b0022100d0eb16b1fdeac91dcec53fce2decd4ac019d09d1becb722452808d63588e1293", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220307a9a66f9aca664b34c8a14eaa71358395e7961599c88aef48b5c1af143bc4a02204895f6bf1127b829d31f7dd4c4bfd6b838802c5f6de4641beb93626557ad1b4e", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/cd.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..24e6e9dec05f5ce33a3f2da9f8c8feb82512566d GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0P?UMT`r~SxiM$ z7#LLEz}IS*f_M>JkHs&Ff$pr8A=$4u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsL=$D=VKFc;Ff>pQ=QT1h zFf}p<@_-;pg5MGd42_I|$kfu*GRnZ#(AvNfVv~`hv#+ZH)H;{cveX;}7e{9WQ)d@P zOAAX&1>dsF6f2Nr3cdwE7SKFHgGd8mHg>SHnHZt&XJ%w)c4A4sm7=1_M_nMTYlp zQi~g(%6ZAMSly}m_EPC-jr!V-l}#PzCcbyC^oZWfq+tFkErjQ~sKtw=yVv>4Ca5f5 Uzk@%!Q+W5u`R942IDgg#0Ql*V(*OVf literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.pem new file mode 100644 index 00000000000000..09da4ecbded64b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB2zCCAYGgAwIBAgIIB5qc0XSVOCYwCgYIKoZIzj0EAwIwRjEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQB +gqJ8AgIMBDAwMDEwIBcNMjQwNTI3MDAwMDAwWhgPOTk5OTEyMzEyMzU5NTlaMD0x +OzA5BgNVBAMMMkFDTUUgTWF0dGVyIERldmVsIERBQyA1Q0RBOTg5OSBNdmlkOkZG +RjEgTXBpZDowMDAxMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEfy5IIaX59HfG +8Xj+x06J6KWHOU/v6d0veBAjPiy9jGh4yyTDRIflyGmPrlucapOBNnu3nyJmFPX7 +b8/ymkIUiKNgMF4wDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0O +BBYEFBx5LoDsZ6pOW3IrrHwGQelecC8jMB8GA1UdIwQYMBaAFHiaFhohzYS8cSno +S4eCUb8nU0e+MAoGCCqGSM49BAMCA0gAMEUCIQDv7GVzgeUeSh0EOtx69uki5Xwn +rYipgojOke9HeUhbswIgN+pmVAzXFTjopbuuTx1gJKevuA9riRO7yZ/PDJRD8ys= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..466b687ad2ae85ae28234eb14f607a39a09bd933 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RzA2NxkM|2?LvQuNdy@!Js{}{bXc6MfQ<_xp~fdgJGZw1_&yK zNX|V20SBQ(13~}j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$AjZ6$ojm!2g%#7^JP7EyU>U|r6 zLxTGzsjr*3Td;BQlx=1@-<7)5efh>s6$0Eie zQZY+RO7U#Vom7|7%nWV zLk?tdLPO~Q;Nd2;Lm9oy(MdI(a@S5;n*uejFcdqqjCPjw+sghUc iKk2Ia?X=|0srTFW1}df3E?QSV>qqO94`(E-)&l?yMvfQ& literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.pem new file mode 100644 index 00000000000000..d4e9ac3c453fb4 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB1DCCAXqgAwIBAgIIRYduW1O7kEIwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDA1Mjcw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDAwMDEw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQHJ46wU1RTjpInrpG7EYGjlLY2LPci +iiYfV9X7YpWI86cGUKXNOfluiQqcyLx+SE5m2BNh+Cpq6sfdH8/VTrd1o2YwZDAS +BgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUeJoW +GiHNhLxxKehLh4JRvydTR74wHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGh +cX4wCgYIKoZIzj0EAwIDSAAwRQIgDTuPeVvtQpuTwGX0saojLLWiF+60DTQP0LAP +9bttO7MCIQCPlRnVn+SKevtCpOzK77e9USJnfaKuf5r4hZTwzBg6rw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..2a611532b61a2f76c76a8b828ffe23e8fa74b86d GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R#Uhl~8cYbs2(sYy0?JG!KPZ*Wd!%enR3|yu4s-2Q{Dy1_&yK zNX|V20SBQ(13~}<2PclOQ&dxqk|(Z_yAgq-l(sf3_acfWA6M1;VwH&Vrv^}^%{lpQ bi3*&^ynaYdX4n&9_$q4Z$K4;#)lRo{go8Am literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.pem new file mode 100644 index 00000000000000..5db35921210b97 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIIPYlVBwy3UZgnpr+/hdNA+FWtfgAtt+QuJZvLxgbQc1oAoGCCqGSM49 +AwEHoUQDQgAEByeOsFNUU46SJ66RuxGBo5S2Niz3IoomH1fV+2KViPOnBlClzTn5 +bokKnMi8fkhOZtgTYfgqaurH3R/P1U63dQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/test_case_vector.json new file mode 100644 index 00000000000000..28129abe2b152a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/test_case_vector.json @@ -0,0 +1,10 @@ +{ + "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid and PID numeric only", + "is_success_case": "true", + "basic_info_pid": 1, + "dac_cert": "308201db30820181a0030201020208079a9cd174953826300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303030313020170d3234303532373030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a303030313059301306072a8648ce3d020106082a8648ce3d030107034200047f2e4821a5f9f477c6f178fec74e89e8a587394fefe9dd2f7810233e2cbd8c6878cb24c34487e5c8698fae5b9c6a9381367bb79f226614f5fb6fcff29a421488a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141c792e80ec67aa4e5b722bac7c0641e95e702f23301f0603551d23041830168014789a161a21cd84bc7129e84b878251bf275347be300a06082a8648ce3d0403020348003045022100efec657381e51e4a1d043adc7af6e922e57c27ad88a98288ce91ef4779485bb3022037ea66540cd71538e8a5bbae4f1d6024a7afb80f6b8913bbc99fcf0c9443f32b", + "pai_cert": "308201d43082017aa003020102020845876e5b53bb9042300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234303532373030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303030313059301306072a8648ce3d020106082a8648ce3d0301070342000407278eb05354538e9227ae91bb1181a394b6362cf7228a261f57d5fb629588f3a70650a5cd39f96e890a9cc8bc7e484e66d81361f82a6aeac7dd1fcfd54eb775a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414789a161a21cd84bc7129e84b878251bf275347be301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502200d3b8f795bed429b93c065f4b1aa232cb5a217eeb40d340fd0b00ff5bb6d3bb30221008f9519d59fe48a7afb42a4eccaefb7bd5122677da2ae7f9af88594f0cc183aaf", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff3602040118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100dcf5d10789c25461065bb909766a014f49ebad35bf60afc890bd438bfc583f23022044caee28fa5e735e18171e692aa02d4652615ed78ef10417ae0741147da8128f", + "dac_private_key": "449949bde66409039b72af18eeebc1a03db3fd64643f45f69181b979ce7a8361", + "dac_public_key": "047f2e4821a5f9f477c6f178fec74e89e8a587394fefe9dd2f7810233e2cbd8c6878cb24c34487e5c8698fae5b9c6a9381367bb79f226614f5fb6fcff29a421488" +} diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/cd.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..844539ca54439224cb80108abf033edaaafcb5b3 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0P?UMT`r~SxiM$ z7#LL273TXkr-UWNd6;U|^_gWTL{#pu)zW%3d}@g@ZxD zu+E?cXm*20(yu1t$Th!KPP3EwCBk+0E6eA?1XTOD*f@ZWI%mtm%*5hh;KroL@G)k| zFF&c=Rf_-1@)oU9OMbU??I-VJA_?lR&pqb+GL09gO1V!py_( zn^;nkTBHz?T3n(K;OJ>6Vj#rErOn33!q~K^hKZ4f#m&vl5KWYchsD6a$x79;9CG>MMOp!8blfhv$2Dn&BO?GKQkjcvl9c$;>qd8pMJ-CZb|E2 z!zIylR*+pKY<}>(9Pa9sA7^fpeHLTpm%tHsfSvjM_i5sheoZmIR6hq4Y*`}EW#+tO zioMF>1cNvO9-zx)g&7(DvoIMj81R93{2(4MjMy6tWI=pB7BLnPo*TP=Hmwhp+Ed1K zU>9$c#kYnYJC~TsBT%2wuPk b1Ml~i7g2&RP;j)Q5Q;WKq?A7-M-njn literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.pem new file mode 100644 index 00000000000000..3942f4ac05a9a0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEPyI5pBVq3w4VbCah6rOhQFZeGZySF1dnG54DfgJZ50oAoGCCqGSM49 +AwEHoUQDQgAEo5NnM/L7X0m0ZousChiCzREHJFafU55sC3up8Zm2HeZcNk5gCF7A +BwPv95YXWU6CXPol81BwtKQQijZDpJQ/JA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..6c46c5c002b8ed776b3f419d80ce21605e5a2b5e GIT binary patch literal 472 zcmXqLV!UF|#8|a}nTe5!iG%AEYfaU*bQS|HHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$AjZ6&83``8bAWDMY z5(o^9jDg71($q4_zzwIFp4iPq6J_FIF)(m4G>9}1W@87tl!+1QWM)QoW+w)g?H+c9 zstps{eRoVYZ`&w6Y|!YzDF*J|Bx1 zi-?M!g7BC2kKEUs|DCmNO6Zg{4E$pt50X}90R~}%NY-Daa``~{H~YmLr>6_txnsDn zunsw>nLQW`T$vOZHW?N=N@{seo5sDKDbVhnT}0iN6DGnR_Sgr0n3d4>`!AD%>;I~U i+}AX|FuWF?nd!f0k)PlK#rv;&9CJRG&vz=jq67fRQj0+V literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.pem new file mode 100644 index 00000000000000..006a62ab9411b0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB1DCCAXqgAwIBAgIICuoFfHq2ZwQwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDA2MDQw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDAwQjEw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS3SD4xJYCRh024kzeGsRuY5ao/R0D3 +zOl2fQ8EyNdsUvOZnsmYcnTc0FDIFTjXJ6QTMu+u1bZIKzyS3smA50oOo2YwZDAS +BgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUJE4g +E/SH8QvWQ/7NO4JgiRkxUfwwHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGh +cX4wCgYIKoZIzj0EAwIDSAAwRQIhALIxcUEZKkuWlguvAlE+7j5YfvTINBPwvD9R +8Jpghvv9AiBF/3rhC9Yo9ADrE5lpT7yiThGgId/rjEFs83efQnbUIg== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..866ce56865af7f4895e256f83693d4cbfde38608 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$=a{TdRTR$oBen}xgtzWPG+cW|(T8k`Ev{7!=KtzMuC1_&yK zNX|V20SBQ(13~}7$k%LA^O>H>m~wR7 b&``(~IM*kn6Eg3v)wW10Jd)nYfagjMBn~!g literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.pem new file mode 100644 index 00000000000000..7d356675ce086b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIK6m/RoSnVZfQNybhbwEvvpC9HdwsIQanArN/E6C8K1eoAoGCCqGSM49 +AwEHoUQDQgAEt0g+MSWAkYdNuJM3hrEbmOWqP0dA98zpdn0PBMjXbFLzmZ7JmHJ0 +3NBQyBU41yekEzLvrtW2SCs8kt7JgOdKDg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/test_case_vector.json new file mode 100644 index 00000000000000..3e261feec13384 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/test_case_vector.json @@ -0,0 +1,10 @@ +{ + "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: PID is not a number", + "is_success_case": "false", + "basic_info_pid": 177, + "dac_cert": "308201db30820181a003020102020825d8cacaf219fed8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3234303630343030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a58595a313059301306072a8648ce3d020106082a8648ce3d03010703420004a3936733f2fb5f49b4668bac0a1882cd110724569f539e6c0b7ba9f199b61de65c364e60085ec00703eff79617594e825cfa25f35070b4a4108a3643a4943f24a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140cd8bbf982af551abc7602c0ba0d5a38eecb54da301f0603551d23041830168014244e2013f487f10bd643fecd3b826089193151fc300a06082a8648ce3d040302034800304502203bd871c41b8008eece6158ad4eab328e262825449443ba9f6869353b28fe22ca022100c7816cb1bf50252b8e69db7f0123afdafa31b3567aa681c775f81a16fe981d28", + "pai_cert": "308201d43082017aa00302010202080aea057c7ab66704300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234303630343030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004b7483e31258091874db8933786b11b98e5aa3f4740f7cce9767d0f04c8d76c52f3999ec9987274dcd050c81538d727a41332efaed5b6482b3c92dec980e74a0ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414244e2013f487f10bd643fecd3b826089193151fc301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100b2317141192a4b96960baf02513eee3e587ef4c83413f0bc3f51f09a6086fbfd022045ff7ae10bd628f400eb1399694fbca24e11a021dfeb8c416cf3779f4276d422", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100f15ca4fa4e1a6daa21ff766ea2aa2663eeb5adf24bc6146027ebcee309f4960d022100eb1e0bc129f4952eac5fcaf4cf7160a13aac1edf8208bb928de1a31e6052f5bc", + "dac_private_key": "43f2239a4156adf0e156c26a1eab3a140565e199c921757671b9e037e0259e74", + "dac_public_key": "04a3936733f2fb5f49b4668bac0a1882cd110724569f539e6c0b7ba9f199b61de65c364e60085ec00703eff79617594e825cfa25f35070b4a4108a3643a4943f24" +} 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 index 9e5e28fe05f7a1..8609753221ba61 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Invalid certificate version field set to v2(1)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a003020102020853499e9c955b61fc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f0a8942174fe219a54b7f6ad3c949301515de6de4194408f8116a475d7ea0b29f00feead0795e9a1e80e48d6a78949e8301aedb87652ff2671f8ad61d846ac87a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041414a140f46a5e334e943da00d8d5e66aad6850c13301f0603551d230418301680147023997434718457c8db8642eb761d711e33a348300a06082a8648ce3d040302034700304402207759805c4a05e63de5010259f857516182da37de51bebf1540bd0cd13520b64502203e90821c21ea3b6e047098630d1e79593398732ffc02bf156f957ca0e81f5ecd", "pai_cert": "308201bd30820163a00302010102071e1322349cf11c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000477285c42d8d1e7349a28c95f58b9e08d75adb20c5b44c2652996c8efcb313ae1f44e5ecad0d536373a9128bf1dc6d30958abd81155410132a122dfe89dae1e7ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147023997434718457c8db8642eb761d711e33a348301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022056248c4803fd254d197f55b901f0a3f33f9073068a1b9e750635d288f97ced8a0221008a0e687bfc73ece00b7795c86bceed053636a339c9c0cbf111ad25c82a02cf13", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100d59084416599184bb5169ee6a392ce3488eb86bd06e317752e1563a72add18e70220146e03a36e55eed8f4467b2426f853b91a157746618fca05662de230fcecd2d5", diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json index 6fcc37d0d05f16..e7918feccd423f 100644 --- a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Valid certificate version field set to v3(2)", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202082cc0bb7d7ebfada7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e8ca85d13d91dc036fa21a0c9335bd80e7f8fb76e2dd5d388435351c3cf74350002ceac9023918702083aae14eef77db21e7a737538d0df1edcc75ec1d6f8d0ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414d296cd819f482c86d9c1f8305a524b0daf473884301f0603551d23041830168014d1769a48f728c7f09b6f91ef9d80c7522a04a141300a06082a8648ce3d0403020348003045022100a8fc296d51d3f2cbfcdd846503021df9d7f8788467686558379f020ccc94d63e022011fcea517f1781205652d11ce7ac6fb0cb070f36be88b2b83b2f4a70d5181980", "pai_cert": "308201be30820164a003020102020861117a7f475c53eb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200045bef0c28d8dac3cb09e207947322e762c791864ba321754c8fc5749abae091393c7bbc24b4bbd2ffebc918eddb81172b56917b62702e95c88571c03bd1ddb478a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414d1769a48f728c7f09b6f91ef9d80c7522a04a141301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207f3799f2c535ad1d97268a0c90542c4792113eeed924d89cba7274a7825b3733022100a7856cc5665b8fab0e4447f4dae3a04c1a5fba459c0fb3d1faf77a3c8a41bbee", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100acded09e95dcbd884b869f5ed6cdaf524a1467fd1eee5bdb28b5958278175389022100f9d0e11ce33df0c97e9412d78828aa0ed1ac14b6324987a103274036c49c7393", 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 index fa54b4abe77c5a..b49eaf20ce6ac9 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate doesn't include Authority Key ID (AKID) extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cf30820174a00302010202081b93836c5ddad56a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047840aed224047eff722068ae926aa3f9ff4dc1aa8b95f2cf63c39fd6999ba35073d96cf78dbf2d3a6058556d75e175916d15b8563df6f1c99e768f89c8396aa2a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041472cd0b27ad47feb17aecaf0c6ff71a6628a115b6301f0603551d23041830168014f4bd62526842e86245a82d6a42900ad4e3386072300a06082a8648ce3d0403020349003046022100ca8d2134e7130334f9ceaecdc076bc7cce40198e23a3ef1c7be9d28643b40b0e022100e36aa2a1705fc4081459b6b53f3d218c77538d2da69c0ee2095aa4eefce810b9", "pai_cert": "3082019c30820143a00302010202084f12cae8e5e05ad5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004b2645a171296a7f51ab03f068547ac5ec69660c59ecb2ca1adcef1ca7e80bf241ffcf177049da9e4b4889f605415703cb77f128291a8426fb4d4ea6efdc8b481a345304330120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f4bd62526842e86245a82d6a42900ad4e3386072300a06082a8648ce3d0403020347003044022077c30a76932fe2b935732bbe9c68974b32d064f6c9f1e9c6920aeb09f23befdb022042a84cba15ec67ad535552b2c9ed29d7314c7391c45838d0aa4e55e31689054d", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100e0cb8b443946cd3594a80e9c18b3df41a16491fbeeee8892b895c6cd052e49ef022067594e7c83d152d1d91a955f9eae9e12de19919baa9000eaa92d52f754ab507e", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json index 38545eddb78cea..5c2d048b6706fb 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate includes optional Authority Information Access extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a0030201020208045f8fc2bf378703300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000448c64ef84c0632a6608d3cb364bf69a0079d29ab901d7ff3b4b597c436638ef428a2be74f4bf8fc3773e6cdfbbb176ddbf8c502f298fbddff84f97269a29e1cca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ea686fb79495b0ef9c6b6b561561964f5eac812c301f0603551d230418301680145a9fa55f2b054f3dd076b1ebeb2deaf5c18330d2300a06082a8648ce3d0403020347003044022022d7c1e9ac63169a27cdfe7bdff0f25fb78e5c3444ad92ec3d3890e2726a7bca022032f20a3181309bc75615d49c0cd6fd2b0c27ebbaee7181b8b36e38899e63db23", "pai_cert": "308201f63082019ca0030201020208592e0f65157b6c51300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004fd659aa96867d771e47a195f2ee510fa5594e8318cb48a65285d8e5b58a59007a0a56c72819501008b38bd785d7c67e4bcd03ecfcf8603dde9762fc4124f94a5a3819d30819a30120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145a9fa55f2b054f3dd076b1ebeb2deaf5c18330d2301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e303406082b0601050507010104283026302406082b060105050730018618687474703a2f2f6f6373702e6578616d706c652e636f6d2f300a06082a8648ce3d040302034800304502207350999eeaa0384f01e503791dc977a0489da4a3dab2730779a3dc3307cc759c022100b0bbbf0980cb7a37af2bd28f682030098f2503db43d7362da1e4ca951bd846f3", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100f36cb0e6769c61700f27a50387d2ce379705a0f223e52d5d8b6260cfdf28445a02204eb0bfd34be8d16a9b87cce43a6516fdd6655e52c4b5a6cde13ad407c42f2c98", 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 index 1c59b0639725f7..ca32b6b69efb58 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension CA field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202083da5054519e6ce3d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004064e5abc04fcb2b47d268d13fd4ff72f8ce55f1c3c293e1241d0a14a38d11a221fbb0dd9f6711d14c37e079ee7dde2467a28ab857a5a387a23125f0a36d82f35a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c67e05126f57c04e0abb6efdb4c9a011d25c32a2301f0603551d230418301680147f77d01bdf45599ccb76e0d373f179772c84f08c300a06082a8648ce3d0403020348003045022100d49fe259ba477edbde3f30c41f83d28db133885312a2d3cf10d0870fceb71432022020920412c466836d80c9fb1de72b25039893c07ada387854fec4500dbda2a98c", "pai_cert": "308201bb30820161a00302010202084ec927cae6554828300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004f34ae625b3fe0fbee4f596128d61f9deda5381c9831e50fe4e6bde25c85f8426bac7661d5bb6e43180bc4b1e1a91fa970b81e7d3b75c60d8e8ce534193ff1794a3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020106301d0603551d0e041604147f77d01bdf45599ccb76e0d373f179772c84f08c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207fb09866b5f6ce0d99aec5df54ac94c0e0fbb896023a15e027b553718033add3022100ffa43e9c1d02c52035e29391aa3a3748acd0ba1b9a70d796932cd6f3d911f0cc", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220538824384db76fd9c646a69a8f9db13e607e38b793bb7be892cf20c0ba1d3fd40220577258b59a9aa3071799525ff00596c24263cee0c4ce8c81a8bea92872c665c7", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json index 873c265f87537c..bbfcc82288e877 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension CA field is wrong (TRUE for DAC and FALSE for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202085f5697509d14da42300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b8a6c2a9787c84464beb4f7494d7b81aa010eb58fbe88487f3124d7971b09c37c7c82f8a6ae63365726364445ec8a0c2508530e3c9442d99b6e18fd649eaa1fda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414fcaf5898e4a3480ba3738c6b284f2185fd019a31301f0603551d230418301680143c576f9ada6b95c32c6a2f74450696f648afc7a5300a06082a8648ce3d04030203480030450221009fbbc2cfeb46c6c6a7d039ef1a059c0b02609aa0b323a666558e4a2fff1a12a102207d4135e4a55324231816e79fa9a0e51a8961e0232de7381fe0337412bed035f8", "pai_cert": "308201bb30820161a003020102020871d0ac32c5c88c11300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200040fe489d1fde9f4baff3c98a9f7c1ac148730ed42dacfcec0f60fabf3c235d280831eebc7a4b931489f1d289da0142c52a0024021b6e732e6eebb48f41fae317ba3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020106301d0603551d0e041604143c576f9ada6b95c32c6a2f74450696f648afc7a5301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207b57f3414541b34a8e90c35aa6aa0ab0c395afb7fc8cd5859e1a1af9091bd21d022100e6aea34126b617195fbc453e42638789e513d0c6569c67a64e60a0122da0642c", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ae657400ce20681866c99961b4ba2d88cdf61d3f7c618d9dce44545b89f1839702201ee4c334498527feafe8e987d83b46c72351ee4ccfcbbcd316be89f9ee5f4867", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json index dc74be67a4eb5e..ba6c1583a4f58d 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension critical field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202085735aa4df0fb78da300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000487c885471fe9ae6bb7f38408132097df241bf77ea4e7e334c52bdf46e2c55cbbb412bbf4081f21a24ecbcfbbef77713c5fe2cf96e60b80a8ef4eecb1de3ccb7ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041422adaedd3b8cb9ad9fb376582c9f2a433443d576301f0603551d23041830168014a1db0e2e2e7e02c0e672e1203884584afebd97f7300a06082a8648ce3d040302034700304402205680339414256c009b11e30554d45acdb04713189fa26754ac47e763a1ca1f910220705677cdbe689bbc07af8023915b8c90654a1d52b3e9304409ff737079b6ba3c", "pai_cert": "308201ba30820161a00302010202083dea43b1b8847394300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000410b0a48be19c83105351114cdf2dfe7d99352a504afa63506e0ea066d2fea9aea850b8cbbd42218b95b61617f3fcb27e3e911cfa8e8bdec7c7810fd3270413c2a3633061300f0603551d13040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414a1db0e2e2e7e02c0e672e1203884584afebd97f7301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402204706506e13bc371d04b9eee18ca902eb16f6e257556d5ed66d37d9c14b222d060220755831501c025255f5b69adc8aab0cd4d67a69c327dcab7e642f905d938601d0", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ee77d7928d173e1fc11ab55622df33f35bde695a80eac6320f029e9e9536c8d002204748360facc01b838b708fffb3e928c20a27f6526926baa3d32325abee5fd852", 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 index 2856d5a09fc731..bc3ff1b91d07e9 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension critical field is set as 'non-critical'", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020868428acfa7e73993300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042c7ed8ee0883e6c64e767e8b2d662a0df7e809bfd6df3ab5536261da71f333a76f852a78fe6e1705213c3de201fe90d62aaef5c2260f2330447c2dca16a0555da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b047ec75da0f7c894a6e911ce2fa4131c60ab8e5301f0603551d230418301680146e1c39b859b602e989412560645508a8ca28332a300a06082a8648ce3d0403020348003045022100a9907d40197990c189fa7b83a14db2e731fc0620483cddf8e7025bfb5e8649ff02202b6c48f282f032877e8fa58369657188118f1d81eae51e529f80764ada2a4d37", "pai_cert": "308201bb30820161a0030201020208439d87350c23c9ff300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000476a3d16e576b83313570ed8e8d398856c5988d3085c61b8bb0c0953683574f4e37e251fae65d8038e951852ac3f1f01212ca83d377aa9e63578b94b7612c1f72a3633061300f0603551d13040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604146e1c39b859b602e989412560645508a8ca28332a301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502206b0130bb0da4edff11454b97ea3073fc61d8c0207e10c836d1992ed5143eed66022100834f343586a204c6bc31b47fb09ee7b85b22ca9ade0e3f6e122fc7c985acab05", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ad10134969b09e9b74a0489d9621b79638fb9bf224d84be4ebe5eaf882593b1602200bd739740d0ff82387853b60beebd147eaac9274861d64a9044a79d25fb0deda", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json index e88f53c63ae608..344f4e244bb002 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate doesn't include Basic Constraint extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202087ad62b72306c96b9300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c7a3741f0af023a3eb364552cc16b3633f2b27f8ddd224aad9e8b9308f4216fc90f7d0ec0af850db936c19e363d033c5ade87c6d8c5d9fc5983d86f01c9ffe67a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414693f0a13b54495a8a2f668fa2775e6ee2f53266a301f0603551d230418301680147b0a00c60189441264e94b9a473049301200ea98300a06082a8648ce3d04030203480030450220422b0b365f5f893727a3ed71b2085299406444f35246a696cedc37678a0c22bd022100a0b67b0670aae4a08385268a743a73941403b88b7c99970b20bd41519c583b66", "pai_cert": "308201aa30820150a00302010202082d41c9cdfc7382ee300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200046e2940dca41b8edcf359ba47a5dd28cc0125f6831c09c2cbc6f49c90dc3404a01a7ed0cbc60340532d022970c13d42244ea172e35dd88ccb0e7cbaa237cd8e54a3523050300e0603551d0f0101ff040403020106301d0603551d0e041604147b0a00c60189441264e94b9a473049301200ea98301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207c5eb799ab5ffd32af857674b0db22b55096f813ec9b2b3e7ff6b9bd31fa8ce4022100b7df7ab6907bcffeddc683f48183ef08287a1ae5b6bc6f53e63dbec2634d4293", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044830460221009da0f7f0329a4287636107a5eeafa3d92ec28176079b24c2a79e53c299a26776022100e1569a19519b6fb1f885236524cfa1fa18cfbd427f64d5c33af00c0b39badba7", 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 index 626f1fb215c45f..c8913003e0ee1b 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field set to 0", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202081b0efb24062d0358300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200045f21d1a84085998650bd4bc6ce58c27d8d155269cde2d1dfc5c2a1a7448d506e857e38d7add3df5e5afbb13de23ecc86c56d64ca5f62345436cda6c61db9ce81a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041490d6e1ad41c80b124667b968ce654303a7636f57301f0603551d2304183016801410cde8ee32b2d118f49d7c67ab308e51fc0583f4300a06082a8648ce3d0403020348003045022100a1ec287ac9eaea60c849a54770104b4657b304c258189a6f634dc8bf1d4b52fb02200e6d3f2fbcc7f904cabb83ef5605d0e42c5e1a3d15fed462e89d219d3cbfd2b1", "pai_cert": "308201be30820164a003020102020852c9c7028e5bc313300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004e27260551a621b14c87cd1d0bed9b67a7928f0f3cf4e40114034e22743240baa309addb8d3928e3603cfc5cf6a4d55a10d3bd85d5a11297689979ab27171426fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041410cde8ee32b2d118f49d7c67ab308e51fc0583f4301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009c7fc7d6ce8700f80009ec49af5265e6659559f9bb9c2e31765edccde3738fc4022028ae84c2c73480f65538ebdfbe0ec68bcac4605fa33f7c4890e2c022ae8a7160", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220515f2129149d39d763f4741aac9cfd8d63f2854794e04d9910accc1a26905125022100affd2a0d45a97fda7507e93c3c0a61530e34ae2b58aa74393d79983025b3a5dd", 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 index 73b9d0f4485043..12c3553fce523b 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field set to 1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020845ddc355eb44cb0b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000497a72a93460efc389bd2dcd98d417b51684b300e6a2557732350b7536442ae84acd361ef369eb1a3c13632cb9cbf2e05042b1906b076eb34cb7ec700ccc50fc2a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414746bb4f5d6507f725492773f087ec9a129cbaf6e301f0603551d230418301680143592c45097add67f130549956a328d45ec65d7b3300a06082a8648ce3d0403020348003045022100c32916e1ba8794a674f851ef69790973a2461cb8b8436b9f5971b39f404e5ea80220428f059eee31dc407a2dca16a34e1512430c144fe2de0febd34afef36e101d84", "pai_cert": "308201bf30820164a00302010202081c6855b8c003bc1f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004c6e5d766d0276558b06b6719073942d2c4f82bb4bd68b3a2ad769610e66bc6710b982fff125c87d2304d3f22db8764bfc7e4538dd8cc4caa68ca833d6906c0b2a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604143592c45097add67f130549956a328d45ec65d7b3301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a0d8148f6b64ce392594d0b0740e411121b20ab2b32171b37a887d4b58c733960221009dfeb55fd3ed97e09b9388833e92d7628adcda2f980466cebc21f14ef61d4947", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100dbe77876c0798d5b2dd778fb2836f60c02e433d8dac1e268c910a8b312eb7d9002203d73c8347b3afdf61324fec7d3757401086950c5b3e202c2893339708fb02f13", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json index 2dc89941584741..50e4305252e1ff 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field set to 2", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a0030201020208536312714af9628d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000428a2ab42bb49a7d6c8f9bc12a39bb65395d8f7542b1fc120805e29fc95eec92a320f8395a8b00353d2e68a85bc34fa6ec52439ac79c237ee70e537d966eb0f52a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414193d5e2b787e4546689f37b760b034c05a182a14301f0603551d2304183016801465300898455f00e39a1cdf41722c1e4faa351480300a06082a8648ce3d0403020347003044022066b1464aa4287113e4d09ba0f5091d1fea5b1bf7d78cc406c7034a16f5ed0d6e022036cbcea757db79eeb18f58118c614a8293e2bc39113bba3b16fec623f47a9308", "pai_cert": "308201bf30820164a003020102020808fede6e9cfde69f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200044d5be8e5adeb82a780fe4843f61656bd66f8797e4d1d29b9ae3b5d85a3fd763a750677435e0b7c7d1bc31de5348724b777d11a50641aa7e939da89723a58a7d7a366306430120603551d130101ff040830060101ff020102300e0603551d0f0101ff040403020106301d0603551d0e0416041465300898455f00e39a1cdf41722c1e4faa351480301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a98155f54f94c12642f3cc2943def076896c59c56a6ef05b2b0baaac8bad5255022100d22675e47c094c20728707f336308e0506840d82efadefc2659fa50df0e14c3b", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022043857ce28dc06fc4f47dec75539d0fb06db7a83b004c33fa15aaec319c893770022045919bcf544eb9f9f2fabdb2d531086ff8d5267b1f2973178285bfdd3a0a8ff3", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json index c8299dddcc0703..6e8bcd13901af9 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field presence is wrong (present for DAC not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a0030201020208053c754c98e06d70300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f5db47972a50f94333082f22deb5441d9d3b689a27ed37f991613a4e4975584a2e63a6ee0abcea1be4167581a32557044cdd78e95530c3b91ad8f6249dd10489a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b4c1a2cea21341f6d5e37bbd18eccc2c51ce7793301f0603551d23041830168014933cfeb600529db3dab05fdbd807e47508955f3c300a06082a8648ce3d040302034700304402206d13aa5ee281423d98a602cb198953c85a49ea4af689ae21f0a46501757fec48022055f9dea608e26eeac0c72e535685a2d137f86b652cfb722edb534a292fd9912a", "pai_cert": "308201bb30820161a0030201020208745bea427d2ec5b7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ca752ea764c0a75c56d3035523ce48bee4d81f8d47782b3924130fb88f4c6f32b540d186f8f9b479bc803a75959f728386797f745d25c1cafb67c4fa0e058600a3633061300f0603551d130101ff040530030101ff300e0603551d0f0101ff040403020106301d0603551d0e04160414933cfeb600529db3dab05fdbd807e47508955f3c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022036474ef7f9807381c98d2a504cf8d1f3557a6a2c6e175e48d2e551bc0814b908022100ad3c08555de905e94dafcd89d36b6b4f0a897512edbdbd4d3a1cff69a241a0b0", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022070452625af7b0288d6316771c93405847db0b1d5baeaeb3fba505c55cd0e5c44022100ec154c7011209cad3e0b2a3f3286bb0c748bb2393612248d01a09c6943e2f932", 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 index be1806379c5af9..22ff0ccd71d8a5 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate includes optional Extended Key Usage extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202083c523c0b57effdb3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004055f2f885618861199a5db69764c7811cbfd035dbe1cc696e014bec17414e918203e0765ed0d293a4fb1fde2ff9c59e32d81e51f4a9cc67ec9413044e2f837a4a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141edff8148dbcaf2cc25ba42fc3c3cb0e3fbf6125301f0603551d23041830168014014bc0cdc665fb2486c66af5be4728cf6c900a61300a06082a8648ce3d040302034700304402203012eece615e9f9daf5d5e7f45a4c017c2d446dedbe0fdad70b1bbc07efb025202201bfc2b2dbc8c5443703dad78f7062f6ca7a40fac5210b2497210222ddf74a994", "pai_cert": "308201e130820188a003020102020862271f0ab28f7f07300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004bd2223da4d3069b6488c7cd6ee59e06af0fba4edd56b7d181ff3c833121b30d48d0f32db9259b98037b3526c7684cafd513a146a29d4d7baadc5782fb47dc785a3818930818630120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414014bc0cdc665fb2486c66af5be4728cf6c900a61301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e30200603551d250101ff0416301406082b0601050507030206082b06010505070301300a06082a8648ce3d0403020347003044022004636ce4b632b98b3431e57715979eaffcb138cb3abac44fd2cbec0f30c64fe902207386f51775528275449f09b4259e8296dd828497b8f59e7201ced3214ee12427", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c38a7f5dac777dfb5e8d557eb460d15ea2b681c1d167ae9ab96651e42f42f79f0220279eb7ba6f3dc379f37ac4b2f07cdfacf004c503a8a2c5d109f1cd239648ece4", 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 index 26119dc176171a..41fdc55e63a3e4 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension critical field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202082ff7dd31d12569f5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000405a5323abcd8edb41ac5a69fc6bacabb83dc0f75c5b43b745d53c7bbfabe839e019d3bc9be44d5360291cd8e826ce9626003c333fcfc99ce5b9d49dab87fb78da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141c99fd290b5709778a16cc3a68352b1edc4f8644301f0603551d23041830168014e4e747a7d0fe5105831ed079e820595673461bd4300a06082a8648ce3d040302034700304402203e1d07f6c2019695c6e1eb4e38654560ad30f82c38f4c8f231c95bd69553fcd5022058abaa2e7a82322b5d81f16786cc9237b3d10bdd5d621a5b2ce7ef5fef2c12ac", "pai_cert": "308201ba30820161a00302010202081bfdafa03b0d8201300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004645e57c86ecd4345faf4548c6192a42ed184fbdd59ff3700a1dd1dd97109a2fe2388065fcaa3278fd91cf16951c45b26d166a6b377b56e09b5d6ff2bad421c6da363306130120603551d130101ff040830060101ff020100300b0603551d0f040403020106301d0603551d0e04160414e4e747a7d0fe5105831ed079e820595673461bd4301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402201f1ca77038af496dedb9dbfca24b54809db0fcb8fe1841f8b900a36e625d22e20220577e6f488214267a3d3bdb8b3f76d693a0e1110aa95ebb4cad704728aadb022f", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c18d4416e5ce172103bd33a4282438c8fdcd40e965ee4c2d0602249c18f72f4a022100c705a866c0bfb10fe9cf89e0846b752f4b8447a110186ec311538258cb1d36b2", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json index 89ae327284be82..403a7bc9757ae3 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension critical field is set as 'non-critical'", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208390f18304e91f339300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000456a4433af46b51d3a9109e6b5a1c59bdd13e19b5a3d31047b25eb3bf5d96392152ada13f3000719771b7ef9affd85c265c7d901c10aac888af727bc24125754ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604147a6079d172001dbeccdb1c920af00acd76c2d71e301f0603551d23041830168014003b6b25e8cb0898ff00caef87a5a6f0fcc6ee0e300a06082a8648ce3d0403020348003045022029742df6bd63c94f3bf49b9eb907d36634b798eab6da0545c99b7ae06dc803900221008fd2e4925ade569b594365cef9717d00b7fc8dbef32f091500299a80edc21f4a", "pai_cert": "308201bc30820161a00302010202087910e2400eab872b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000417ce00698978d36f38cd9e3596c7640b18aa1fd4c6e8069865a584e8f1da13e7c5047c831ffc517d417a8cf8c8087a827891e9e9680659ac56a854ee300f8427a363306130120603551d130101ff040830060101ff020100300b0603551d0f040403020106301d0603551d0e04160414003b6b25e8cb0898ff00caef87a5a6f0fcc6ee0e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221008954e8a1d5ca5688bf724babdc15a6c9ac9c570c53c1a1ebfe8a983d8b2b2ae2022100ff7822f92b3a143f08c2f27912a849fcd387854f5891ae5a953046e7ac5bdeba", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008470dea64aae7eee67a213db62e7eab7a53af1fe0b1f8aa7ac137f102487cd0d02203e24b8cfd5abeacb19055071e01fc28b9de43567bcb300b070dc562ba0e77cd5", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json index b54cfde97e335a..00663111609102 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension cRLSign field is wrong (present for DAC and not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208021f05d9209b5eed300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d54d447e8096edc631867938576b4cde7ced88a3a201a7b5645b706fe1427071be4f8a2bfe3e53e2ae25b7540d08d491b05e0c53ecef7313fd32782882b7d21ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041499d27e55b5cc920feaa2062fbc5b045acfe87e32301f0603551d23041830168014de884c14c6f2bfb8911120f195130d1181f4df6b300a06082a8648ce3d0403020348003045022100c9a86509c9430ec42e9a4783451184f283c485d7ebaf0829865f473ca5deb99502207cde5f2591b80f0ad0b27d2f1bcb0e27b1b4e55a9d5034ff60a2b891e2b80ba2", "pai_cert": "308201be30820164a003020102020857c3959e77c71e37300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004c7b0a2a21b5cb8a8b04c7f074e44ab0d183b50623bcc4a7d58c7d9c30a4e6bdd4b7e03e4f6b8dd664c991894c6f805d7cb621e6a49d0c1a459550cc530fc1a48a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020204301d0603551d0e04160414de884c14c6f2bfb8911120f195130d1181f4df6b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009d9e282f05420d5c4eb9bd17d53e1dffbc485e621df668b96f9ea5736921ba0f02203d68a141312687eff02b58fed54caf96e6117481744fd4a7254fa7acbd0f66c2", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203a79f41c3abfc33d4a7341fd9613a1485015b659ebbb75dfc6ee9faafa8b3eb7022066cd96103af8fe1e9fb14471997ecef5aabae69e44eb0714a0417b29d7198e10", 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 index d24649ef06d780..0a5e5fed786a81 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension digitalSignature field is wrong (not present for DAC and present for PAI, which is OK as optional)", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208568288cb4b319ee2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000491d6c7888cf88fe930493409a59e9bffcb7da6dfe8a24fef4366368171c407d4ab2cadc2a4d3aedf78f86034b510644795e8d60503f3393024102ef1bb3445d6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ce4916a3fb7cca300ed9b27bcfa6c52b32ace0ee301f0603551d230418301680146501d5f9b760746c421ffa03f40ee1233d87bad3300a06082a8648ce3d04030203480030450220273649bfb1b74c74a583f18b43dc0e998c8187b0862d4d8b7ecd4a38d76db1a90221009f8f26312ef21f1525ab3b1872c2601acb73543b97aba395111c4604b388d1a4", "pai_cert": "308201bf30820164a00302010202085067032f9c6011dc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000407e035085865ff28c03934454eaa22dc1c4f36c0844f1d7c7ffaaeacfba0e777efa63547f59a4384448841476d9955f943372f43aa7d498c128dac0b3ac5b362a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020186301d0603551d0e041604146501d5f9b760746c421ffa03f40ee1233d87bad3301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c4cc07bb7c45d705406ff6d3b7ee858cec34822d97ded78593387bd708a0f219022100b5a010d2b5695dcee2ce4f4f3fe7fb0765671b4c29a556fc773575002c5c4235", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203b8a87ccaf348a4a13a6ce23504c741ec4a8a56c63c5c02601e7aff8b7adc86602201f3848c9ee0a4141091184dd7bbe75fd44264447d7d75c69bc80432850778dc1", 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 index 84edfb431b15cf..d33d85d9eb4e10 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension keyCertSign field is wrong (present for DAC and not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202087924884a38f4a5f9300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043ff5af3215758482cd3e77eec68c76311493aa69bc9135dffb142ca7f4fe943f5a5498ce135c7ff260af9bef4e95a83fc20b7276c9033999f3aa2cf744ffc794a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145d2e60837f18264fb553e58c21328969723c56f6301f0603551d2304183016801434a3a3a12ce0eaaaca884a4e022b4adc5147510c300a06082a8648ce3d0403020348003045022020ddefb0c44583276a368c74d61b2061f6c05efbb96e83700c15e03afe3662fd022100efd96ab7972c087230bb2b6ebf9da69e2abe69bd6ddaf68b4a9d64de847163ee", "pai_cert": "308201bd30820164a003020102020845bb60ecbb58ff00300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004a93151daa785620f6b04045438900303a6987e6c2a67cc1216fc37dd84c62b9c6e429084d6c5f24478b917813cbd92087c3210ceb16fd1fc1ab88cf03b2a0bcda366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020102301d0603551d0e0416041434a3a3a12ce0eaaaca884a4e022b4adc5147510c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402203d2d0a078afcdb2cf493d9e788b0d5eec81867f7278b4f6f4a667a4ac3155a5c0220452e9d85ea0e6be15989662ab7dd00cc49e8c7250648fb74b4c841f3fdef52cb", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100cf4f0659d5ce494fc94022fae7a010790cc4967f81385d05f3eaf1d73f9576bd022100d7d876e9b7f58cdc63413b5d8c9882f837baec2e0766d6c6359ddc5c582c823f", 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 index 07192fd11176ab..bfb135ef06cf1f 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate doesn't include Key Usage extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202087d057f834fe94eba300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ab4ce79364db7231c37b47fcc8f74842557750575ad601d9f0ec133f5822f0be460589c0bad5ff8a64632bf2f1cec2fb7ff8ff7c540abf412af029ab50144869a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141706f69bef3e85e7f2c404db903b3b15937a3e9c301f0603551d230418301680149ac3631ee8a6ea4db6d66f6ef8b48653415deda6300a06082a8648ce3d0403020347003044022061249ef479d1dae146c9fad56a596edb487f7f907f52c83831707b02cdfea23502205819279fe8bc41bb95eb2784f1e31b3261a7d54306772094de97b7a84225c786", "pai_cert": "308201ae30820154a003020102020839ded80c128124e1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000464e59ce6959d0a7ef1369052d40f3a7a1ff39896b6f2b93c41f7e09f8207af46af12e996c460d8c6e310825684d5d925169df233508cd511d989bfa54f3889a8a356305430120603551d130101ff040830060101ff020100301d0603551d0e041604149ac3631ee8a6ea4db6d66f6ef8b48653415deda6301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022043d0153166f4b8c4bad6bfea956f5beef2fe96febb2684ec92a2c99828b7a402022100e37b10e382e43ac44d759121d3faf7882598e46b3337ef5fdcd3edee383bf24d", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502201648c9173efde4f9d472307d760fba1dc8450db3b519a47b6e087d27eb5c5b07022100acf41d1e385382b6cbce70dbcef4735bbae8c57e8f69115d41fba11a807cb0ba", 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 index 42d8d45bfe2692..f248eb94d4b644 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate doesn't include Subject Key ID (SKID) extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ad30820153a00302010202086e2ed492bc70d71d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042072871fa6fc54a1885c486f01f8f98412aaf0c51b9565da9bb531227f0d0e2b3ae2ddac35c8f95e1b40b9e49c3af84fe9fec864a2a17cff7df6299349e2a491a33f303d300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cb6d33825513ad3ca95e666e46b402246ffd1b81300a06082a8648ce3d040302034800304502206a006730723f9b2935daa5e73a217b49de60195b01f9242d53d31ed901a59671022100a2720f5c12c542e1e559bfc38499449720baa863ce704233fd21142bfae0faa2", "pai_cert": "3082019f30820145a00302010202082d4efa1768bd9df6300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004e8c32f125ab85828abd0168b08e2e17637ee1a90bddc2a6621b45a161435711caf3cdfdfd7e5c994b6e2a033daaee3c82da0a38e9c9858ed7426a7b0bcb39094a347304530120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009b5e5d069368ab4c684368da10b1dacdd4861a0c4421d03dc47b8ce749969b840220656909b3a25b4d39965078f453022ec2c0192c3e62f344227144b08b970c4640", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220577d16c1b4e48f5d8aa4a2f89ab44684ea2b8c23eaf76ed4d62e0e4924c7df070220711ea523f0311b2aba70568b0e0dd3023b10a5887ee487f1a4db479d8f1ea7a8", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json index 9b3805eb26e501..d7dcdfbf34c0a6 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate includes optional Subject Alternative Name extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020876cd3daa9f77b736300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000480bb57fb5c29071c16c72dd9ca923f0a308395d1598589de90a67ad67efa0bbce89b9f24ca57112be21bd0782b3520c53289a3a55528134b3a3da80a5923459da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604142b39990c7d963956b520dbd4762edbdc9d2210bd301f0603551d23041830168014741a7b63672a6a1b52850d2c5fc610fe1b70bc37300a06082a8648ce3d040302034800304502210085d0d397c932ae4c614cb4a25038494333dea82c216227d9dbca696af684ea0502206f9d844bf37f4484798d089fa4fd442c9d74d3af1bae246dc89d64d6a0e58347", "pai_cert": "308201d330820179a003020102020847e8708a15a23c84300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ac0fe95dacbbdef66a9bf7d65fa16f396965708558f962ad654410b30c435837542e94c7c6bfac2ba5a5f5e86380a7a9084b5ce14fac6eafcf83ca3eae90494ea37b307930120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414741a7b63672a6a1b52850d2c5fc610fe1b70bc37301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e30130603551d11040c300a8208746573742e636f6d300a06082a8648ce3d04030203480030450220760375098e7b13fb67cd344eacdad6dcc82bafd169e2d1ac310c6bf2d8752205022100f4be9ef00b70882019241b2a6b76354313711962def73c3d16cb64b2ad8212a9", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502210090124c1624a6ec5f6ed299ba83ad2d2d640fa92290982a15f6e33fb3b06676dd022051ebaeaaea7e24f58c96540fc075dcdc0bc437c439c547b5d878e271157e9f6f", diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json index 4d0b865bcf34c6..880c2c100c0d8f 100644 --- a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Invalid certificate signature algorithm ECDSA_WITH_SHA1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cf30820174a00302010202084c92c16ce75c48bb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004bd174e9109a8e7cda6c486ea56e2f0b194f874a14a29bd2ba63f9a94e8eef8ef733b212fe230725ee424792ab41fd5a3ebc5326e41d0a9846b65e97a5a8b049ea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b1a07af3016f22fc71a32df1ef88841c6922ada6301f0603551d23041830168014ffb717ceb81d8d127e9cbc8588a2eaabe60419d9300a06082a8648ce3d0403020349003046022100b55b9ccc5734554e8bd0e3902424ca55837002ec307de04151c5bd72f0972ba70221009e5e620993c7a60341a796f21f0b3aea1e843ba8c0d4c97041b9782cada89cf4", "pai_cert": "308201bc30820163a0030201020208394bd8ef7c25fa52300906072a8648ce3d040130303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200049614adbdb52ebb9cd39657f43310decb7be7723cb52df8660ea86d49a294bea2ebd92c0188a72c2281c523d6b082f575fcf1a936c0040841467a14d7a31b23fea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ffb717ceb81d8d127e9cbc8588a2eaabe60419d9301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300906072a8648ce3d04010348003045022050539e0f36bce10825ebf4876f54d04e7de6f7aa40ff6232a444bfc345352255022100d2e05048e249ab2ba422d0e09a233aef5ba4719a6f7cb4f83e9b43ca8134dbea", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022062ace16c24819f25cef24ef481df62fbcb8ff6ab86f3225421adeddebcfecfd502210085cfd967564cd84698de4f4b1ff1a8032363d1b4f3a5ae4e463c75e0d4e2fb57", diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json index ae15b5319c4c8d..a4292047f4275b 100644 --- a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Valid certificate signature algorithm ECDSA_WITH_SHA256", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201cf30820174a00302010202080a6d20ec541a9788300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fef168ed076810e44c4d93f6e9b7dd63562f488dd8a562fdc14b4150d701d5fa864bb0b03f3e681c75aa3b92a47db445888b16c363e1e931903d8a6f5c994c8da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414684fafbfe3001b075b41233abfb8c2e9fa27e280301f0603551d23041830168014967d9859b09201222a48f2d3a06df7fbd0c0d605300a06082a8648ce3d040302034900304602210091b44bfd54e94510b67c9b325a1f00d9cb467bd5c12d336961acc5a3a37324d9022100e51014934fd403c7ab9f4f408b291098e744861fed66bb3e0c5754e7140a019d", "pai_cert": "308201bf30820164a00302010202087c76d8c6b0513e6a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200044a0345ebc50a500be2db044330f80bb7e64fdda251ee5323d5b96c56ae3d18f25fdf78f1bfdc8d4ab137aa0fc98fbaeb4d7aae565ce269fe01bbf40f2d3df168a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414967d9859b09201222a48f2d3a06df7fbd0c0d605301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b4a69ed8ae34b9e69ba5945154d66b59ae79c7685d644b31dad5061875d1ce86022100ae682994a517a96a454178a78d9e2e7f7e7f0036d518852485d7283b3fb372d5", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100ac0b49310f9c603472ef27b77b7adacb934bd62c225474f70d39eea62cd53a5a02210099a89f2297dd55e8f98992c3928c3d834b1ab27b287116f1a94eeabe4d68331e", 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 index 64a3e70734ecf2..fed4e721296cd3 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Valid certificate public key curve prime256v1", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208034c3cf7ef307f83300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000498f6b8f8c098d01a3c93bd4cf213af4758f48978a18172fe0e5b2bb0bf3fa0af666bb945e45ab4e2a5826d2ea4ae7cd1ec384d9d97022b3febab74557288208ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b350bdf1aad4fb3d74eaa03c2abdb2764d6cd535301f0603551d23041830168014da7a67a5f221866661471e808a6523dd55856834300a06082a8648ce3d0403020348003045022100d692846be1b39c154cd0f5ef0536c7fcc0e21c5cb24ef1d7794e12209f184fe102201731bebf38c51acd3913b7612c92f69f5a3d8c42fa5a921c0e62865dc06a709d", "pai_cert": "308201be30820164a0030201020208065cc0521db0ce10300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004f0d91b8f91e6722112f2f88021ff3e04731d6af15edc4ed0368c7e9d4098b442d437b7ef758ce7feca8eb100c81916c26ce49b8b0d3ae1d6c4b8d96dd7823b6aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414da7a67a5f221866661471e808a6523dd55856834301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221008a904657f43c8c7e43f002a812639a391870bfa51b482481ff4c50e8fcb88e2b022047ef3730d97d29198cf0c55e84b778d267a16ef17a10de9c6b9379b37c3a7d20", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210083107ee77d879acd4fc612dbb4d96f4ad5d40ccd7350b509f88f432f626f8ec7022100bfa421c220aa548d2fe939e4bdb4adb4e90194c89d9d93b79aa7c257de9bc8c0", diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json index 3bb8980e1f7c19..1d4bfd8c37458b 100644 --- a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Invalid certificate public key curve secp256k1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208159f2db80c8688b6300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d68bf47e479b220605e3a4a31ab9618609951cbc5a394a7d5ce7d8fa6c977f3dac3e32135f863af41133d42589e67246f9447508ef19ac8c21ee459c389cc350a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414d2ccafbcc0e990f3a7f49d5f57ad736ba401b483301f0603551d230418301680148532c4fafa4e2f896107e5e9b1540e20859792d8300a06082a8648ce3d040302034800304502206300b25907bd1fe1e2a88b9b8574686815a49314db8d151f9edf0bbf342e3b25022100c993b4c6ec106ff87fc748fa976994200b06b1d176e44d658ab45b3152f7cee7", "pai_cert": "308201ba30820160a00302010202076da356b4a721b6300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313056301006072a8648ce3d020106052b8104000a0342000453769340c2226a57d673e9f998a3f903fa017e9bce91f49a3bf5f064d9464c7a7a961864a4932c5bdcf9fbe19ea4da25fefca60bbc58b4c4dc93bba82adc3713a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148532c4fafa4e2f896107e5e9b1540e20859792d8301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220228543574dbd43da23f084df886c61619a876749e2a66226ab67c5d541565ccc022100976a69d6d0785de76d9852c172c32bbadbfb259a314ef134b07fc9ebc880e9d8", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220420e4db19950c3e205c427e9678bb78f701a93c2caaaf5bf54f2a3506e0a6a0302201493ac9216695935d70aad5b06e835efa1b49da6b7de9ed83224fa1c707170b7", 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 index d96f25dde02781..bac15b7737d55f 100644 --- 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 @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: PID in Subject field doesn't match PID in Issuer field", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202083c116225d1c63705300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d030107034200040e6d3bb1f6f06ce5db1b6aeb24587339fbaad8fb40b613754119e2d8c7b654801cd1ecc07c349ee88b9a53487cc201f9347f3e0564be7f60a4d6ea61ce17ea3aa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414df0ef175cececc49f84e2b5583b9eadf3497a93f301f0603551d23041830168014ab768451266a206497d304c55a9baddfb8afd934300a06082a8648ce3d04030203480030450221008924ea4a9581fd864cd9767f5a30c95b526e808fedeeb81fee60e6c9e3dde903022006f8c637cee3b4caf34207b9fcc8c87816460740fd73358051614c3c43d576f0", "pai_cert": "308201be30820164a00302010202086c4e02d4f7ee51ac300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000424f8a26698f7c85a69359fbb724a05485b7caf964796aaa4f02513e790a289f32d5add93e78fdc2820a855c024079c3d75bfc242b279a1332ec516f3097fcc74a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ab768451266a206497d304c55a9baddfb8afd934301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100c31c78e5ea4a825efcbfcc758b9dbe9401eb33475ffc02e8e9c01bdefa228e4b02205c076387c2d796e3509e0a6a9ae4993ee56c3d00b2f058cebff7b68b6c5b0977", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205018018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c843fccfdd89f6d5cc457f1f58f5184c975b19fd1178312328563a606fb93f8702206ed82aa8d3824d3ea9434813a49ad731702ed69650cf9be09151272294945a96", diff --git a/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json index c274c22d7538c9..4196d49a74bb5e 100644 --- a/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: VID in Subject field doesn't match VID in Issuer field", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020867c142f97f529383300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646323020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047e8d29adbd27901afd2ba88ee8127ab4890abb5883a28069a09b3af53b307dd1e0f530ba36a0a164fcc3eac230326629a59eb330b6bd1d8cf34f92a54e187e6ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414d5a162c530ee09695c6751392113e4f5c859a98a301f0603551d2304183016801441b45b408991886acac75afeb780845c93ceea0f300a06082a8648ce3d04030203480030450221008ce4aedcbdb09488f98205bbd013f986f023d402fffce2e079505b25a144227d02201de53d35dcfefaf0863e2187e90a84b176cf3f5f1e4d915c70edc345ae0821b8", "pai_cert": "308201be30820164a0030201020208178ee14bbc76933e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646323059301306072a8648ce3d020106082a8648ce3d0301070342000477731ebe24d0f7889902843c7b37c3aa05f65f3c527d3cebee0838a9edda8ec4db1ecae4ad671b8acdf115654d032975a85782600b937896a9d69de1a50f5c0ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041441b45b408991886acac75afeb780845c93ceea0f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100fd6966017df84701e73c105c862fbde730e02101f86c4a3f4ded69a33ae225f102201cde0e4dafb66f426d4a5ef56fe2176f8852b51f89eedd6b51656043bf40048d", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f2ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022016558fc85fa9ddc2b6a8fd315465288e10df64a4fa5c7df97a4d4ad5d718624b0220369af39142dd44abc12fc1b9f9acd8896bede8f4325ba5aad422133adaea0be5", diff --git a/credentials/development/commissioner_dut/struct_pai_valid_in_future/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_valid_in_future/test_case_vector.json index 36ad3a635b65e1..11d762523e0540 100644 --- a/credentials/development/commissioner_dut/struct_pai_valid_in_future/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_valid_in_future/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate validity period starts in the future", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cc30820172a0030201020208454a6dc9e9a2974a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3232303932383134323334335a170d3234303932373134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042de758a70ead588db0aa679e72178fe3291b5e6a850f7994bc9c4a7af6fcffd2ff114461b29b86ef6bfc01208b83740dbcf11fdea4d1a196f98896bb428bd83ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c83ec91c2a4a2b72f023cba57ab8aebd1450d2ab301f0603551d230418301680141b52835b0aea1b0ca641e2ac307a42359efc373f300a06082a8648ce3d0403020348003045022100ab803db22f397fd7203cd196e47a71be404719a582429be2338fc4314bb4171702204c847835c3eef57f8dcb6e2dd361df8b5764d7d682a0a393d056834f0c6fb6ee", "pai_cert": "308201bc30820162a00302010202086f23132964c502fa300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c0446464631301e170d3331303632383134323334335a170d3333303632373134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000478e5567aa7cfa53759aa645e288e8ab50cc355723e98a6b9189fefaed87048917c294b106ec478a0f264afc05a5d7f1efb57d63ebc3abeecc0b48454a5c5d380a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141b52835b0aea1b0ca641e2ac307a42359efc373f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009cad628b2b80361fab025d2607ca9b44262ede96ed26eced42d3ba5b8276b4fa0220229cb4fa39f9e39e74623ce86612a30555b9f0a6ecfe2ef85b75fe97be148ddb", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220119f54818c1ab5e24f23be069a8e552a96aa2627bb5b431ec3769216822c96e7022100a8bfc1afcc6e3dcbd93faf9c93ac93e690fbe2558fdf22716a0c0933e03a1687", diff --git a/credentials/development/commissioner_dut/struct_pai_valid_in_past/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_valid_in_past/test_case_vector.json index 0f1e2e64544159..9f64d438cb41a1 100644 --- a/credentials/development/commissioner_dut/struct_pai_valid_in_past/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_valid_in_past/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate validity period starts in the past", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cc30820172a003020102020804a1377d00a6d962300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3232303932383134323334335a170d3234303932373134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048b8fab592168f44e47b6e5db325b98f7be98893588bae4a37d0e14c6c4c36b28f903de55eb8b20738cf941cdc5d1cb664798916c2c1272ad90240b5041c5e842a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a08873bc22f7d3b12c0413b1fc4bc907a09605f1301f0603551d23041830168014ceafb2800c542e5c7a25c1927f67fcc9e24dc317300a06082a8648ce3d040302034800304502205b59ef30fb501126afd11fb309822c45a03287fec0c709ed32bbb977f47bf0d9022100c98647b5e33a6a91e4cadafb66fb4974a6d4ddb2a044f8eece655852e58e28e3", "pai_cert": "308201bc30820162a0030201020208498271f690d142d1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c0446464631301e170d3230303632383134323334335a170d3232303632383134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200045f65df3af4144e4d2a8dff68620011a5a24f00081464281522a47823b84bc38e647d0ebf20d172fa6a6c0f810bfaf02ad6046e71b1f9bfb70f382fba4694b9b0a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ceafb2800c542e5c7a25c1927f67fcc9e24dc317301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100dd489d437280309b39dbb01a76c3be6e18c55c76913df455db9fd4b993e70237022002e0c2d331fb7abe0684ef467159bede7a57fa6a3212f86d925c90be1d33fdec", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402205dc619e5096ea45ea834b77bd680e9d766ea79bf537f77def6048eeead88696802202f6ed57530098471cb085fd2d10e32088abf227e066178fda7dc78a77ca0f244", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_01/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_01/test_case_vector.json index 18b22bc258ddfc..beb43d8051fcaf 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_01/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_01/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid and recommended since easily human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da30820181a0030201020208075b92e4e6b84e82300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004c17fc6509ae5a59424f3c708c0608fb7a6c0315e11d4b2225d1bdafa9086c3a14408da49d9c20b67eff3d682f3d04c970b6c4f635a20d41783481bf2ff49ee01a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414bba10e4b38e2c0e246051e84715e5baf6a13fd60301f0603551d230418301680148dfb62ca6a6bc48ac92ec1ac6a2371fe4fe3267e300a06082a8648ce3d0403020347003044022057b0b3d07ca9dff103f666d325028046200168451b599f091a8fcae50430ee74022057557b6bea2d6a8945a783b15b4b95697d815bb1f4fc99f2174ce62307ecd692", "pai_cert": "308201cc30820171a00302010202081798022b33fbf3d5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004bc34fa7fc9ea49b2731e65c1d78e13be11af24e7631cd36292ba3a7d6bdb56934717611170b9c989f64d5b7557081fb3a6504b3a443772528cfc5d0bf2699d92a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148dfb62ca6a6bc48ac92ec1ac6a2371fe4fe3267e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a0090fdd7dbdc51282166ccb310ea9fac1e099235bdd60d454366e889d287b170221008d86d2cf63e6e351a0185c5357186fd86e078895810e3a8a0e1af1c1cc8be0aa", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100b621544bb08ad4d9f4726bda7ee7d4401d8b371dbf55ecf23c5f77f9cfc99dec022100e3b4ea7d887641f74f88d53baab86c22b156c49a6f5d26c39133361100c52eef", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_02/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_02/test_case_vector.json index c45442381c8753..732d70cb510e00 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_02/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_02/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid and recommended since easily human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da30820181a003020102020827b0ccb4f6500d10300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7069643a30304231204d7669643a464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200043f9fd0355ae1d7e07718cdd18ef833424630cdfc170bc1bcc75fea873bb74fbcdb66ef0a146488433252c69a41e01c233d3aa055710308a1385c9fa80c5a945da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414264be0d1bace3eca7b1a402b913e33af96cbe7d0301f0603551d23041830168014d68f452a3f23173b4f09351fb28b94500a5cd815300a06082a8648ce3d040302034700304402207ee9bf16ab2d8ecf7f1dae17e13a276ada3823dada77d9c248ffd31490ce37ab02205e6c75a73c03a736b3d107b3f6b61eb5829ad7a41718e1c4c3aa954ea08c3627", "pai_cert": "308201cb30820171a00302010202083c82008c7ca9964e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7069643a30304231204d7669643a464646313059301306072a8648ce3d020106082a8648ce3d03010703420004515a9008f7a5bea6990873b1f97b413c701af0c92f345faff86688e1b5b918dda5792fa097d12196e94fdf06430b58e685505456126936fa896280eaf012ed23a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414d68f452a3f23173b4f09351fb28b94500a5cd815301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502205e6088ae22c474f3a74c9ccffadd5af64f2b454ce2f8be307231038721d088fe022100ba91ba65bc7ae67077e4cd359d8e8c62731976f7afe100bb1626e951fc0864c8", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c4d3874a8c4d4f346fde865cc123e2fabcdd12e5836ed35006673599df20d144022100e137b6a190860571970460a6926d8867d7bbed46c8ceaa0b9166ed85654c920b", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_03/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_03/test_case_vector.json index ae8d9f2dc9953e..796c4f0a8d491c 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_03/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_03/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid example showing that order or separators are not considered at all for the overall validity of the embedded fields", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201db30820181a00302010202086be6588a0c214e50300a06082a8648ce3d040302303d313b303906035504030c324d7069643a303042312c41434d45204d617474657220446576656c205041492035434441393839392c4d7669643a464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200040fe5f58712656d94acf12ca89e42de64bd93905c95f0c21b1450dbdbc5bd9b2c5f6dfbdd3379952a61b6dbb45db303423770ade5adf037c90fcfa5f089b00490a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414acc5e72ec60a3ac2916034340054df20d90ea6f7301f0603551d23041830168014fb76451848399889897ef5c1cf23e443c147c3bb300a06082a8648ce3d040302034800304502205c9a54117930e18b7ee39e5d694d1fc2c2841ff161a59fb52b575ebca9b19cbc0221009f1a4ed576680ea6c409deedc44d91f4fcb16224b49b84dbebd78aeaccad01db", "pai_cert": "308201cc30820171a0030201020208702ce8a9372b6270300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c324d7069643a303042312c41434d45204d617474657220446576656c205041492035434441393839392c4d7669643a464646313059301306072a8648ce3d020106082a8648ce3d0301070342000488a08cabc9aba0b4dcd4afe8b0d5af7947b14a282a5b68dde65fe243d556360ea9cc5f39c01915168b83aefebf88358ab8d1f1e1746a6865ab91439e5bb4adcca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414fb76451848399889897ef5c1cf23e443c147c3bb301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100913e3da905a8b6526eeb1a00060367688f7616512150c0a5aa902fdd60a58a30022100d5af59745c178cad737b59b81c3a5be5bb97c59fb1cc71d096f0a1b61f2cc91c", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100a446bdfd25f2f265c8e5af02a04e66b97cde7c110093ae69e1b30037936f060d022047ee346e38e0329c6376fd2412f946874aea76b4f8bc31380d71528020e02152", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_04/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_04/test_case_vector.json index c0fd626b74fff3..a42eaccb1defb1 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_04/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_04/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid, but less readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da30820180a0030201020208341c84535eef2a8c300a06082a8648ce3d040302303c313a303806035504030c3141434d45204d617474657220446576656c20504149203543444139383939204d7669643a464646314d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200043759eca89e16c6ea71d19373251b626735c40e4cc7676ee27d2d8b1a0b3adfebd30a1bb4c9debfb2bf38d884017f559b4ab643e3c1bccda8f95d2f190fa9cdcca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b10e44888842fb2a4baeee56310b35e27c922432301f0603551d230418301680145cde37f2a41f16a31733ce16d13a77ebf05c48df300a06082a8648ce3d0403020348003045022100c676782b8f33aa2c7bb4e91e07d078c3ef02bb985fbad909262768868d1f3f3902204fe363f95746e4f4473011cff3790b0b27d946a23fb307ab287e99845863d612", "pai_cert": "308201cb30820170a0030201020208607acf46f1d3e5ce300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303c313a303806035504030c3141434d45204d617474657220446576656c20504149203543444139383939204d7669643a464646314d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004141fe85b64ccfaf4cf08decd5e527efedb6ffbd894a57f4841bcc6786c404757f596f438dc32ce9203284ffc13fb4361d8a621e70ac1c7ea0c229a90286bf7faa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145cde37f2a41f16a31733ce16d13a77ebf05c48df301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a607e0db00ebf2410df9fc436d812c630e352d98f5353f0cc57d5bcc2c2707b5022100d3db92986d7187ff45f487b3033cab026645c64603461f95f48a57102351bb84", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220718da3c75864aaafae04ae718df356f20cdb4688a3b6934d37bff390e3111d170221008d6449aec65b2c295effd4f8136fc8fcd014bb7bf43e741947e56d744dbb05c1", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_05/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_05/test_case_vector.json index 1749235ae42c2a..589ff774d27cdd 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_05/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_05/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid, but highly discouraged, since embedding of substrings within other substrings may be confusing to human readers", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201d93082017fa0030201020208788c1dba87df1eca300a06082a8648ce3d040302303b3139303706035504030c304d7669643a4646463141434d45204d617474657220446576656c2050414920354344414d7069643a30304231393839393020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200047dcffdc020b98cf45243ff00b6e6ecb9b2104716acf58caada56594e15d9765c3ab3d5ef5915710be74b2a98e8c556cd7501cf54d11f381fda345e3ebbf891afa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414aa332dd474f438cfefda10c9de746d47a26c2aef301f0603551d23041830168014eb78ed1e616d294a4ba80c7143272368e8a15f73300a06082a8648ce3d040302034800304502210082eceb5aa56a1b4c55176520c8d36b059ce56c0523a902312d4d821fa750b71302207c24a9d3904db54a967c50e39cfdd88bd2600d5fdfbbb5b04305cc6b8d3b013e", "pai_cert": "308201ca3082016fa003020102020876d8e013abbff228300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303b3139303706035504030c304d7669643a4646463141434d45204d617474657220446576656c2050414920354344414d7069643a30304231393839393059301306072a8648ce3d020106082a8648ce3d030107034200044529d3117c1620b85bedba1625d0532dcf27aacabf727de5fd87718fa831c2219d7e290e5569a98383aeddd6535c1ce7f7132074b051cbc44941cd4b9f88c8a5a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414eb78ed1e616d294a4ba80c7143272368e8a15f73301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100d857ca39185d655e765ed86a8e0267c804ef370831abd643b49cc915d2367234022100cb42abba9290c7e98b541e44e1dea0836acf28efca6444339401769f9ee01e72", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008c5e26f9803a761df58dad43a982b9d847c3c5314e3f96f2ded64e141506dae402205fd7b4753013d99a84a7ffbedf849f637c2460aabe0aff798766cf9b4cc973b2", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_06/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_06/test_case_vector.json index fbb97c09628413..1ca355f8b9214b 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_06/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_06/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mvid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201da30820180a00302010202082cc0ab89c5737671300a06082a8648ce3d040302303c313a303806035504030c3141434d45204d617474657220446576656c20504149203543444139383939204d7669643a464631204d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000474c36871149a64e878220a79752c019edb7193c2144a4a6e882efb594a96ec9f7ca0953fa4238b9a49fe94d60c28c7df0ba1e0852c60fb1b82a9c4c6ab6b05eca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ba73a4cbefd9468fbdd7ea29bfab5069aacbcf54301f0603551d230418301680144039994c01e076690db8bde12379548d58249492300a06082a8648ce3d040302034800304502202a717bdb5ec4317bdc38eba5107f62a33fe8776638ef4e434a63a0493dab935c022100c73160c265f43bab397d8023bc50854de3cbc8f61e9458deb80233aa54b659a4", "pai_cert": "308201ca30820170a00302010202081c51c96c3a6e7917300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303c313a303806035504030c3141434d45204d617474657220446576656c20504149203543444139383939204d7669643a464631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d030107034200046d8237afd1aaa978d61d7bb45be106dc29c6513061b63cdc7af3004d7e88ea14da1855741e805f54dd8292676871d3464c25234c2dd54a567ccb84566ecd1dbca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144039994c01e076690db8bde12379548d58249492301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022027de262c9345cea9a8f45597d6aef12ef7dce0c3ccd1d12305146c5c940355be022100ea342226806500b0bf0ca69ec2f233afb6c440e0197cfa3ddfad47dbf3888a62", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022076a4dd713a309fecfa71e707b71519a76d545c4d9a5195a0d58a4c9c49464bcc022100d562b3b2ef277df2cf64873d9e308ab622b81abe89aaa9114bbae1ad3efa9c4d", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_07/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_07/test_case_vector.json index ff957566887a19..92c74a639578b0 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_07/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_07/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mvid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201db30820181a0030201020208459e7c161800bb79300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a66666631204d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200040d64bbd9912a0905f5e7a199dd2c0ca9dc9c9186f9a6401e74367f08eac15a6de1b2b11e67a45c8b01f3f017748f756900f15aa61397dd342e2e8e5b5860a5d7a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c61c03351d3689580e3d30793a0e98941308df93301f0603551d23041830168014b65bea13eda87ae7349b417429fcdc21b5e0c6ac300a06082a8648ce3d040302034800304502200631989f1bce923a41d708ae157f72d9a9b0dfa1cd6d85b013b46ef36e4fcc28022100963813cc6f68d125d4108a4e9dc30a4e7de9d1157e1b29732631b4682597172d", "pai_cert": "308201cb30820171a003020102020836de254c09e2c5b5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a66666631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004c305250f66442203f5d0a1d4a69b15e2a04d3234da18db17144171b1fc6e711399e532ed4e1cf2e7ea25f6939330b4200c2aa9957955f1a877673bdecff80ef1a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b65bea13eda87ae7349b417429fcdc21b5e0c6ac301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100ae883e1c02bf892d9735e997ea1e4e3fb457604d922156d69db0d56a2de6f77c022020c2548237913179861a2b7cffa998a490cfd8a7ad06dc5970f27f403429f036", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022078c7912cf529c6667355bdcc47943465c0e0938a39097b729944b8eca11b2c33022100cb500ec6b4291d8a1ec7fa4190e295ef1581af65fc79236dd728f36adc29a6ec", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_08/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_08/test_case_vector.json index 41d5d3d94211cb..2b19a74f79aa8c 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_08/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_08/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mpid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201d93082017fa003020102020846cb41af3a7fc9c3300a06082a8648ce3d040302303b3139303706035504030c3041434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a42313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004d3e1c5422ab213f118f959a33d2204342cf598dffcf5cec0474a1bba6e4c1a7263a59c605cf892038a704fd266149b5c89fe35e17e8dda279bb03cb1c7bf8ca6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041430616dcabe874ac65e3dce88de7c5cc5defd86f9301f0603551d230418301680148fa036268e8eedbc73e12a0eeadcb2fbec8faaac300a06082a8648ce3d040302034800304502204ef134d60bb150def30f7c2df8f88c46755e36f48a12831aaedf17c4944cd70d022100f61555085107e4e783a5ad6abc64e1ee1f0d719b7d83a5f8bace41949f85c284", "pai_cert": "308201c93082016fa003020102020821b17d362fe9afae300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303b3139303706035504030c3041434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a42313059301306072a8648ce3d020106082a8648ce3d03010703420004e72dbe2a0f600358978022ea70fb7ef3ef14de92a0dfb9cfb83b542fbccb7b8a7b13d3f37a26dfd2400224ae4ab82e1c13ca57a45e4ee54e862a192a6d4f1f3aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148fa036268e8eedbc73e12a0eeadcb2fbec8faaac301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210093a63c6f397d39dfa5b60c06c2839448ab5db0bf0728c7449c66bdc55e3ff6c302207b0c997ff95f1795b86828d1137b34f3f2aef1ffb2183a6e4c02836c1c735171", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e1d4967878513c474101db44c68061689be47443e21f6675c34b872edc5a319c022100a963e07bcd8e4abeb8b4fcb19f6a59c92f1a3bad4d7153f333684f93a836e3f9", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_09/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_09/test_case_vector.json index 210bc861b49deb..04737915883859 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_09/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_09/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mpid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201d83082017da0030201020208697ea481e17f0f9c300a06082a8648ce3d04030230393137303506035504030c2e41434d45204d617474657220446576656c20504149203543444139383939204d7069643a204d7669643a464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200046eb8078776faf91061011baca81d4577b5b6b64e6f3009ddbc05aea20eaa044dbde2f70716de1d0ea2221a57ba5ca2ab23995fff18e63c6c675e403f7bf7ed53a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141c1bdaa7b3c18076e81187da63295ee068a7fe29301f0603551d23041830168014bd781517ec524b8b752e7e529063de96d6c2deb1300a06082a8648ce3d0403020349003046022100ca59fb5cc9fd777641ba761c9fbf16dc24f044fcfca5dead17ed7cae02a3f64d022100bb501e52bef2e0ff3d9b6c9bc8dac1c6adf94a19d66f38cf840b89e0bbd7dc12", "pai_cert": "308201c63082016da00302010202082dbfc034ee2ebe32300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30393137303506035504030c2e41434d45204d617474657220446576656c20504149203543444139383939204d7069643a204d7669643a464646313059301306072a8648ce3d020106082a8648ce3d030107034200041a872e39c4f8337945c51b1a5dfa009e0f8402a59d996da057aa370acb18450bc3316babcf7c6eed0555300d7e9e4ac42c0e9556857835e8e8de2d91a1bbd27da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414bd781517ec524b8b752e7e529063de96d6c2deb1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402205c38ff93c407961a98e61bc23ea65381a760f97ac0481ece8ee21bcd451b8c2002201d6c7ee510aec10ea02402f5f6d80bc74489fb8793d64a77e06b8fece69cd4b8", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402201f38b426df25ab4f552ded014845afb1a353e808e9250fc19dcfcab3d717679f0220575a610c996f0221628ff9a76123d3462922f91b6011ba727e6d42884ae88c08", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_10/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_10/test_case_vector.json index 3615a6d9a15024..d9feb73cd2286b 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_10/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_10/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: invalid VID encoding", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201bd30820163a00302010202086e40d9d03d53e04c300a06082a8648ce3d040302301f311d301b06035504030c144d7669643a464646204d7069643a3030423130783020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000414db8ee1d3c8e43a400352c581370f73bd380ed7b21ba20797f528c29dc980ec596df6819b2b71eb278c528f2d40a25371dbc576fa79bc1f94f54f49a1c58f45a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414603a7f4c6ccf6008057b8ae8262261fd7bdaa558301f0603551d230418301680149470b6ee8199d7d22da4759bf40c6c86a2e62d5f300a06082a8648ce3d0403020348003045022028af44d175bb2617ec5e526c252e58c15c4130ce70954e06acad5661d25a8185022100a22fac60cb1b01cc6d891f9339177ec5ab9cfa877773b81b2db9b10dd1acdbc3", "pai_cert": "308201ae30820153a0030201020208139e9818eb206aa2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a301f311d301b06035504030c144d7669643a464646204d7069643a3030423130783059301306072a8648ce3d020106082a8648ce3d0301070342000441ce3856f31dcd073f9c3ea26df801f476761731f5c19b57ca9fbb99ea7289df4545287ed407505e1b4f9550410b6d3b4d3d4d73721286b4f0554613abf6567da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149470b6ee8199d7d22da4759bf40c6c86a2e62d5f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a96cefd90329c9d9b3383e9d1afb43615851906d62fd46264201172fcb5e528d022100ee557e6c1fa5d5136c334561e3a24c083dec63adda0ed71f74a11dc1d4181829", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402206cd818861259869d69ed0b9cc2b32e31daccf37f7151336fa0c4f165f505d03e022050ac584e1fcd7cb6caca10b21f5c54ac6450610af6d7f2bf8c49905ca2e887ae", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_11/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_11/test_case_vector.json index e9a09a8272b614..a4cd10cafacd46 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_11/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_11/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: valid, but less human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201cd30820173a00302010202084bdb341f5fc5937a300a06082a8648ce3d040302302f312d302b06035504030c244d7069644d7669643a4646463130204d61747465722054657374204d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004e8254678b023c1734aea87337d4348a062e5766d98b185a7b411fd99e07058411fc83964936c48023ee62549792980e918da22631a8f4d26c570b417cec5a5eda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141443640055a45c380ea0a7588d0c146347e4c0aa301f0603551d23041830168014c50fde1ee7a77909db33145fbf848f088684cb32300a06082a8648ce3d0403020348003045022100c768aa66b6f1f4db7a3a7faa441066c51619ded33bf993bb926d4d1eb73fda78022010b7ada24220522a1a971952ab0c6d338533c84e2a755259ae6b2a23a95b8a3c", "pai_cert": "308201bc30820162a00302010202074750dd89bd3491300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d7069644d7669643a4646463130204d61747465722054657374204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004c391114e7fd627e3c152235bf1615eac8a879c7e9a51ba7c9e64595891bcac89b066416948376bb4f4f042d3f401918dff876013f99ec3d1f31bf78fcdda77baa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414c50fde1ee7a77909db33145fbf848f088684cb32301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100a8a04d5f669aa9b1f328dc875a4991631f425b930fc16728cd63c29f48dc465c02201e41ed42e59bb842749f457e062f73215cd60680fe478add46865bca36ab1dd0", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502200f2df28c96fdf4315f3aedc2047dc27b7e37b586a2748a6c06803be853289643022100d5f943449ab4e9e5424d425e3572569b784039e0f196fb12ebfae1ab7539fecf", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_12/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_12/test_case_vector.json index f6b538b9a7961a..60293876c966d4 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_12/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_12/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: invalid, PID not present and VID not upper case", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201c83082016ea003020102020822d3664b338a186d300a06082a8648ce3d040302302a3128302606035504030c1f4d617474657220446576656c20504149204d7069643a4d7669643a466666313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004e33d89b7d1a4123229b9040dddd131d1f233ac45b2b50773394b6d136fb78be57d6e0f0d89ff3065170d6e0b414fa8f8ec17ce2f56501ac3dbc649bde5ed3d68a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604146dbfd588aa275b31aaac6cf7275d4362c4829b45301f0603551d23041830168014e3da5c94dbdfacf38d137be8d4bf7a452af29af7300a06082a8648ce3d040302034800304502206932c2909878b6b14ad28da8805ec06e9f7976bb9174dc58b3793c99f6407816022100a2c6f4d90b4a70ff204e40ecc4340f3438f7baa1ae5a9fb854e4697ad4d232f1", "pai_cert": "308201b83082015ea00302010202082dbc38a238629a58300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302a3128302606035504030c1f4d617474657220446576656c20504149204d7069643a4d7669643a466666313059301306072a8648ce3d020106082a8648ce3d03010703420004e7c625c4c041fae1941c05256efb9b984c0730244d6d8f0da751e661b0799271e0d66b95ef9a14df8250e269929a2d8137996e2e95f852a001675b9bac436276a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e3da5c94dbdfacf38d137be8d4bf7a452af29af7301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022036e4641213b0979eac7fae35b2398250738c3506488b7e212ba39d3a60edf2680221009990708a87b42319c14b0be0003221ed0475a7f340206674490645a45634fdf4", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100b4d83918fdaf27d2be610752b8eec9e6d171bdb9bf9adbc3bef6454ff9e70f80022100d92c92837d48c482883ee4b5dbfda63803f99eddc48b771c50b6594a857b55c0", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_13/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_13/test_case_vector.json index 9aafc1fe40ce3b..250adcd5de6fb1 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_13/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_13/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: invalid VID prefix", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201ce30820173a0030201020208574a49bb6e801508300a06082a8648ce3d040302302f312d302b06035504030c244d617474657220446576656c20504149204d7069643a30304231204d5649443a464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004201bec5f397f2c81cde7e8982f4f8fae69ae2ace8bdd0bafce04d4dc56ffa1b2fa5eebdcb41afb93c8ca93fc414369e7fcf4645a1bbcb9a8ac4afb32b4610aeba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cdea6bc02803e30d56e95bfb5550742123869df0301f0603551d23041830168014b8aedf531ad42608d18dcd0e5d7bd1a28e897f7c300a06082a8648ce3d0403020349003046022100d3e60f58ac65a92c06ee6cd1b9fe05efaa407858b3fead97e5d93a69ed7b6c56022100891bc4ec5622f9079048d6a0de1395496ef027dd824b237e6bc40578bd0188bb", "pai_cert": "308201be30820163a003020102020869c1d77b203a0a2e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d617474657220446576656c20504149204d7069643a30304231204d5649443a464646313059301306072a8648ce3d020106082a8648ce3d0301070342000411c1801d3bdf4b502f672711747091621441c425f3f33171b86850a66c4140685ff7984331b4ee36aa1ba814313981feb0aad82ecaa912d4c0fc059a218a3d26a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b8aedf531ad42608d18dcd0e5d7bd1a28e897f7c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100e2356b850362726d3df98f26f7488f0fc73e957669ee5c125dc0a7ce659819f402210084b5c669d8fa4fcd4fa314f6084bf051e8f3159dba00bfb75bc5972e08c6d26b", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100e436f76060ebcc3f73aa2ec87de249727b57125160fb154d8b8ed9b4ce9092d202206eed7e11edac26e3c348a41a298507501afba8ad6842d82cbb1fa38a15022daa", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_14/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_14/test_case_vector.json index bb4ec7ed45158c..50ee40c6adae25 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_14/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_14/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: invalid PID and VID prefixes", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201ce30820173a00302010202086c9fdd8da9351b8d300a06082a8648ce3d040302302f312d302b06035504030c244d617474657220446576656c20504149204d7069645f30304231204d7669645f464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200040bd69bee62d407baa92d7b4c68dc403fc8b2fef5d9d180e9118debcca84ea66fff8a5a36dbde69f8d3d97f1cddf50c79633ba4292cc6f5bcdd412197fcfb1ecca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604144ee61e7b13c450a62d630433a01bb40ec43dfb81301f0603551d2304183016801490743e23c01d37d935d6a526d94dbc415178ad6a300a06082a8648ce3d0403020349003046022100f6205f88dcc23ea2aca9952bd714eff2f71dcdfb3f34a20cb71c833f8d6743e6022100b99dfdb0ab3baffd03298e2f5e584d92cab4da7bcd615bbc11d430c0edf1cda3", "pai_cert": "308201bd30820163a00302010202081d70ffaeec319495300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d617474657220446576656c20504149204d7069645f30304231204d7669645f464646313059301306072a8648ce3d020106082a8648ce3d030107034200046f34d25034b716e7f95139f6975328763cb9f58bd6cdbcd2831f0d3caa664b3eafbba86ab9cc8dfaae719e279e63b209d4af23e025f0ba30853491940dbaedb7a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041490743e23c01d37d935d6a526d94dbc415178ad6a301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100fb4f85ded34dfddedf619a032d1f455b06561fcc4e6422578bd37222833602b1022008c2cf2199e6406abcde6e53c76fe9f221bd2cfbd89c613f77d3b903f0fadfe7", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022040f04031f06158305cb23570f815684eda648cd9c631adf3533e72315d11892f022100e64ab06c1da4d959126bf1c7b816dfa495dc57451df41597699419b114ee45e5", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_15/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_15/test_case_vector.json index ea6f3cf8d2ada6..8716676bf8923e 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_15/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_15/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: valid, Matter OIDs are used and wrong values in the common-name are ignored", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "30820207308201ada003020102020829533b15b435e877300a06082a8648ce3d0403023069313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464632204d7069643a3030423231143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200048afa3ede5112dec9f6798199c8ffa0d1f03a0f2e3fb46536b4dac7d4992938da3d7d939a86a590942b20f92d916406f31359d1a7266f510603e5e325bbcfae98a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041488064d10fd091fd07a227335aa25992a856263f9301f0603551d23041830168014b5c1398fa5d54d71868582d94afcc2d4e1aa1cec300a06082a8648ce3d0403020348003045022100cabe598239debfc7a34cc2785c5c42c4a8ea9b0219f7cf79b19ad03e54387314022052ddc7703d3b622aab04f5cf7b2576ccedc41d76a326111a78c48d57329b350b", "pai_cert": "308201f83082019da00302010202081c4df132887a800d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a3069313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464632204d7069643a3030423231143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000466415c7ed0c8d2c281192083b84a304d1bce565fd9b7ef9ef37e05f747d9a064555cb6a1ad22fed19d279cfeedb45c904e2e0d2caabd412eced85ea784824cd8a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b5c1398fa5d54d71868582d94afcc2d4e1aa1cec301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c32bb6595944549a5e4eb08b44ead56b5accd1d26dfc0ed757ceae44f19aab6802210080cebaf169e855c6299b6f2bb3804f05ccf7d8135b06bf6c645456c7306ce73e", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100cefdbc32a0201dc87435343bb0e7da622955af7b2379f8222210dcf30a70d720022100968c705242ce3b863d173977abaebc43e9d1df8b5e7f7293cf9e389dd142bb38", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_16/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_16/test_case_vector.json index 41c2a7aebf0395..5726cbdc564037 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_16/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_16/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: wrong, Correct values encoded in the common-name are ignored", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "30820207308201ada003020102020875315e809fb604f4300a06082a8648ce3d0403023069313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a3030423131143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04303042323020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004ba2d344def6691a3f38ce971437c2841868d078d7d163629baddef4d3601eae9229fe3752a8d0a664271b3e49340c55dbc20b35b9db780910d91170a3551d561a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e68ac3723efd401494ce4b30d286d45479620516301f0603551d2304183016801456d6e273ea24e5dfeb570b1ff9f44f549b6d364b300a06082a8648ce3d040302034800304502206a255bb249a4dfeefd42ec6e04adff59338efb40299e323b72237af30db7afb3022100d60e8288883ec9e97116ffb571f2295bceafaf97ccd8318557b65eb15c8b0ac6", "pai_cert": "308201f73082019da0030201020208139609613795a5ef300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a3069313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a3030423131143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04303042323059301306072a8648ce3d020106082a8648ce3d030107034200041c7be69a1432aac427700729d16b4116bbe9269849ee7123d1e88ea2ed55da8ddea715fa754bf657ba4628972ab6de59efa5f40c085e35fe8a82a5f8aba51448a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041456d6e273ea24e5dfeb570b1ff9f44f549b6d364b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202e5a430a4e0e13ca4b8bac28f8f2a02e23779def59c93a7ed8b3419c92c4e38e0221008c3e9653298e9bdc23128aeab143e8e24d0b95700052617020d9342f8fb3e543", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100bf3f12a780ed57f091c7954f4ead03785b333ce9c1b50c4591cf98bb338add83022043898fe00565598e0e2308aa67d232179d7c5e84a76ad08a99f52365dbb33bca", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_17/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_17/test_case_vector.json index d77bc898dd40b4..edef7e2ac3490c 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_17/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_17/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: invalid, PID is using Matter OID then VID must also use Matter OID", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201c73082016ea003020102020853a06a36c4eab9bf300a06082a8648ce3d040302302a3112301006035504030c094d7669643a4646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200047b52109ce0e498f87b5effb42e7d69f0950ab8f2b1a25039436bd4dcc249b1f9240f291c43b7880078c25bef91e0428c988ce91c710f10a6cb112d2ad2bceac4a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140ef4cee4b1073d60c236291562705ac3884ee03f301f0603551d23041830168014e37d6ed3c0603d3bf0ca20dc925ba48c44c7482d300a06082a8648ce3d04030203470030440220132e0b4da310c490a3f2c4b05d6b042a80d286bd7e740cb5f375fb68f0d9f7020220661a046b87a32229d7d78bc70d307956304805bbe8e0522c011e4420ca71911e", "pai_cert": "308201b73082015ea0030201020208603cb8419e67f161300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302a3112301006035504030c094d7669643a4646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200049c722b78bb7967f39787fb4c50e2b3b225240742917959eb8c5302b7df678e52eb3cd49597e7996f62a15cb94089b2ad848447971196b2a7c10e0956795d607ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e37d6ed3c0603d3bf0ca20dc925ba48c44c7482d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402203e2304d6633f0c7d79399ecc40af655a0b7006a550849e15114f24bd837bf15f022032c314c6226b8a7dc91d102b5fa862b555da33884adf80491b4156bdce6bfd0a", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c3d32a2be9bf2fb5b82199dde590e1af5304c05739de1556fa089a3cab58938c02204915813b12f18101383d9be2157ca725645da86c011c29506f8ac6412cad4d77", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/cd.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..e1b469faa5e1fb2b9dcb2d6e2efb5a4fa6fd5d40 GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0P?UMT`r~SxiM$ z7#LL9y)`$r$= z$i%?Z$Q;N6f+z`oOCT^bG6o`3OH<1z12;nn12KpN{7|z)Qj1FzTpXPZMGS=4xU|_A zSs0rZ)i5#guz*ZQ6J_FI0UB&*5NROH#twEi6C>39%#7^JP7EyHU&q)j=2)I7oqFcI zO7ouyDwRJLyF^$dtkrAVzI#=LpkMk`iR?V7TFbIiQ*Q3Hc-|c-)))CEw`!dl!%OQ4 zaUF{j4B`xUfKHSZW@P-&!eqc;zz5>-gLuF&Vs9{z1@ZY<#8^anuUt!SH|myN{K%!h z^Wu>SPY%ACU?2~YR%QWuv_T|1XIHg$&NLO4v&n^-C#9zC*FKPe9OBF#36fqX?&I8)eMzB!m2rBzgFwL|8artuBVQyQ+8*PG{8^Yi=5S bId;mF*}XXDi%}MiS?q0kt|kEKJCI(8@JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L?UH8M8}tyyvEQZU@r%<8Qh3xh_&{R(ATeN=FtQoQg7|zaVk{!zIlHR0bEc`VoJ}swJSjD8 zzxII)19_0NG7B)|8bq@GDwWFz%D>q!<~TiF;LaVxg@tvHO%*wN#_FoD&QM7JaG{c- literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.pem new file mode 100644 index 00000000000000..c31efc8b053f4a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByzCCAXGgAwIBAgIIE2lYAsHi5rIwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDA1Mjcw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowPTE7MDkGA1UEAwwyQUNNRSBNYXR0ZXIg +RGV2ZWwgUEFJIDVDREE5ODk5IE12aWQ6RkZGMSBNcGlkOjAwMDEwWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAATDxm43+EAMinF+njGtuBO7vjnCMvkh+ErO9vxmON+g +/y0D/0kbcKud7DGhj/jvDWTQ7jHpmOHgxtWEzBb7dTdfo2YwZDASBgNVHRMBAf8E +CDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUV2y6eytsliQEzWNx +ackalr8rwGgwHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGhcX4wCgYIKoZI +zj0EAwIDSAAwRQIhANt6a6UBwW3gPjypFnSu7s0IGhMCFpGeBtKyeMtggIe9AiB9 +jOAQqo78kEf8Zf4C7VwKcChkg7TO/yr1mKt6VolVGQ== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e2f6a204faea2ff4be31da8a50e20ef8787ff560 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%$%NWaNHYQrZ={KrN;dyix7{ymfPVQu2TyEY_R!M&gg1_&yK zNX|V20SBQ(13~}@lH_`0ov5(C#tmnBm~Y)r8Cz`*k;8+SEGO literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.pem new file mode 100644 index 00000000000000..2ced90401e4572 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIMeqSL/JP2rDJ0r8x0Y9e49j7f49k/NhbeLAuzYkWsG9oAoGCCqGSM49 +AwEHoUQDQgAEw8ZuN/hADIpxfp4xrbgTu745wjL5IfhKzvb8ZjjfoP8tA/9JG3Cr +newxoY/47w1k0O4x6Zjh4MbVhMwW+3U3Xw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/test_case_vector.json new file mode 100644 index 00000000000000..a935f55d85df7d --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/test_case_vector.json @@ -0,0 +1,10 @@ +{ + "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid and PID numeric only", + "is_success_case": "true", + "basic_info_pid": 1, + "dac_cert": "308201db30820181a003020102020843650dd556554085300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a303030313020170d3234303532373030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303030313059301306072a8648ce3d020106082a8648ce3d03010703420004f7eb5c3ea308a7691b65ccef2483fc902479f8a344583860ad2e86b7bbaa78114e67d5186b6e1a7d3976ca94d9bd38e78b51168e59ec6d7aae2600e93b905e88a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148dd4d66787328b1ba3e2448f89d1c490e4c1ea90301f0603551d23041830168014576cba7b2b6c962404cd637169c91a96bf2bc068300a06082a8648ce3d0403020348003045022016b9473083a3c99f544e66d31556ba8cfd6d177142190dd5abd852b5cfd33d0a022100a10bd9bfe47cbc409c9f9322491ee65132c540c8bdedc26236bf47f64319a610", + "pai_cert": "308201cb30820171a003020102020813695802c1e2e6b2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234303532373030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a303030313059301306072a8648ce3d020106082a8648ce3d03010703420004c3c66e37f8400c8a717e9e31adb813bbbe39c232f921f84acef6fc6638dfa0ff2d03ff491b70ab9dec31a18ff8ef0d64d0ee31e998e1e0c6d584cc16fb75375fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414576cba7b2b6c962404cd637169c91a96bf2bc068301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100db7a6ba501c16de03e3ca91674aeeecd081a130216919e06d2b278cb608087bd02207d8ce010aa8efc9047fc65fe02ed5c0a70286483b4ceff2af598ab7a56895519", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff3602040118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100f3240528a1ce8a0154892dae718c47ba1d2db84a9f2e941bc0efffba46f7333402204ac1df237392e052e5d5ff5644852fad8949cd62721cae2e852c0a1c314cb0c2", + "dac_private_key": "ec810973fb09d207496509d81a14aff5da33278f12e35d085e1769565facc1b6", + "dac_public_key": "04f7eb5c3ea308a7691b65ccef2483fc902479f8a344583860ad2e86b7bbaa78114e67d5186b6e1a7d3976ca94d9bd38e78b51168e59ec6d7aae2600e93b905e88" +} diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/cd.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..7c52ac3e97aa07fd6fd84634284f81c61e3b4f03 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0P?UMT`r~SxiM$ z7#LL273TXkr-UWNd6;U|^_gWTL{#pu)zW%3d}@g@ZxD zu+E?cXm*20(yu1t$Th!KPP3EwCBk+0E6eA?1XTOD*f@ZWI%mtm%*5hh;KroLuyI?b zk+<)|NgWgBAGj@Yn$;;mcKxGn&EAbyXTRUO=1UY%$>ez=4F(pbadR|Z-}U$^^>b3N TgNnoN$`dbJZ*85lKxHEUVbx2? literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..d72cdf58c690c627e5faa7ea2bb4acdf08aafb16 GIT binary patch literal 479 zcmXqLV!Un8#MroinTe5!i9_W7w+VHnKMf7I*f_M>JkHs&Ff$q08d@7zvN4CUF!LBW zI{UgR_$HQ=q!uZ-q?V=TCCM$lFOam z)gl|d>hbTDY+G~k74JItBT`(?Ed<4Oe7q)caD}y(b7cPNiOK@pGqjyITv%eTdV{cm z1$W2d1cNvO9-tFtg&7(DvoIMj81R93{2(4MjMy6tWI=pB7BLnPh1Um4Zk4Fn?Wt!` z@5$&f{n5G6!$2M+t;_=SXoJYCFP5GIZq#!TM zn~PnUk=uU!yT_-x*t2N&LyEEQv6Qe=3(`1aJVx!Lm;8Ql?A%KCQK Va3)*jQL||7ov|m3?L4 bJ4!=YZ>y0b5DS~{jYF%=H#av!0|jwjBNGEN0}}%_8?)s7sj{*_oXfSein6%*Ct?A`71LoELf9HTS*v(hWYb z&Pu+)d+!^cnZ+o`()_AI>pQQ~j-&Et*S|_ymhgOT%CcFD0_qGxtfeY47N;4c0R6-q zDl5#$_@9NtfDK47F)|qNfyDShV!$wAWHXQj@%dQ9SVU%hvGmmGyO;FsZL84EKdG9! zpASzokOxUCvj9V`K_u(1Qn`Gf{G0t^j?>cx?%Xk4SXhS~!pt5F2ChsBdef8&uAP|w z=w;qrx8E-=EDE@~F5tbhJ(KK*`%{umDkd{2GIWO6n7Eo;^Hn%#cA>{;&MxD7&CZPK PSGSw@PC4~-eZ^G(Bbkl> literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.pem new file mode 100644 index 00000000000000..9cf14e01b2a1b0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByzCCAXGgAwIBAgIIOWRFZRdrJTQwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDA2MDQw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowPTE7MDkGA1UEAwwyQUNNRSBNYXR0ZXIg +RGV2ZWwgUEFJIDVDREE5ODk5IE12aWQ6RkZGMSBNcGlkOlhZWjEwWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAASCVYw3FjswWXDnDM8U7Yqd7xelsExdQyJNU73fM8ya +AREEg+p4KvcNIrjFH82v6mKmYOedZKaaolB+MFQ7Gnhoo2YwZDASBgNVHRMBAf8E +CDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmvQ5SSyO3mL27YUS +ufxlKS3zw5EwHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGhcX4wCgYIKoZI +zj0EAwIDSAAwRQIgLpYicNbIn+Lpbt1G++jQolDVrlDvQz8CHfDflGLJIWMCIQCJ +VDw0RTTWTSDBNtCMMpy6M96DQwEn1bc3jZTK5a941Q== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..91cd0c7c6196f02404dc7d2f75188b501dcfb82d GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rwy@Ai1_&yK zNX|V20SBQ(13~}n$+7CSImaOVuq6zz(g?-!-8OkG1FO;f$!Gt8O+5d?$kcq;b| bBDlpL&9CZWreNotWTu*;P<}8}I~sUs<$W;T literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.pem new file mode 100644 index 00000000000000..652b95059d958f --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIAT0pLawB2gz1l/XLScbWT8+aPTnGbkQTGOyzoeGMuuVoAoGCCqGSM49 +AwEHoUQDQgAEglWMNxY7MFlw5wzPFO2Kne8XpbBMXUMiTVO93zPMmgERBIPqeCr3 +DSK4xR/Nr+pipmDnnWSmmqJQfjBUOxp4aA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/test_case_vector.json new file mode 100644 index 00000000000000..9dec5504865db1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/test_case_vector.json @@ -0,0 +1,10 @@ +{ + "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: PID is not a number", + "is_success_case": "false", + "basic_info_pid": 177, + "dac_cert": "308201db30820181a003020102020814fff6907e75f931300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a58595a313020170d3234303630343030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004a01980a18949212c6244dc8dab14b0f52e0fbd1986acc9ea0dae47c41a0ae7381116b8f1d618c1a83b4a43596fab9123100b982b43b0d0a430abb01330380b88a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041420ebc074da74263ebc7f04278c688c35f889b148301f0603551d230418301680149af439492c8ede62f6ed8512b9fc65292df3c391300a06082a8648ce3d040302034800304502201f130d6914f3a61a5d171dedfa51e5a5f10f7da05a71e69edce0d0ec74a51604022100e7a3db95f56d6b9ea232dc17226af6dd31990679c5365b0bb95dc833de2373b4", + "pai_cert": "308201cb30820171a003020102020839644565176b2534300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234303630343030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a58595a313059301306072a8648ce3d020106082a8648ce3d0301070342000482558c37163b305970e70ccf14ed8a9def17a5b04c5d43224d53bddf33cc9a01110483ea782af70d22b8c51fcdafea62a660e79d64a69aa2507e30543b1a7868a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149af439492c8ede62f6ed8512b9fc65292df3c391301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202e962270d6c89fe2e96edd46fbe8d0a250d5ae50ef433f021df0df9462c9216302210089543c344534d64d20c136d08c329cba33de83430127d5b7378d94cae5af78d5", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100b1b689324b4de19288909fc0db14cb0542601dafe28b298db1d59befbdacf45a022100939e14803038355e9c29ebdd48f51af99253402440fb79c8e985dab592a024b1", + "dac_private_key": "6ccf019fff6efe049efb74f8c0cc2fa2c5d01e0ae28f3b4930fb245f88773a6f", + "dac_public_key": "04a01980a18949212c6244dc8dab14b0f52e0fbd1986acc9ea0dae47c41a0ae7381116b8f1d618c1a83b4a43596fab9123100b982b43b0d0a430abb01330380b88" +} diff --git a/src/app/tests/suites/credentials/TestHarnessDACProvider.cpp b/src/app/tests/suites/credentials/TestHarnessDACProvider.cpp index 366dd5752c2fb1..1eddfbb8282b92 100644 --- a/src/app/tests/suites/credentials/TestHarnessDACProvider.cpp +++ b/src/app/tests/suites/credentials/TestHarnessDACProvider.cpp @@ -177,6 +177,11 @@ bool ReadValue(Json::Value jsonValue) return false; } +uint16_t ReadUint16(Json::Value jsonValue) +{ + return static_cast(jsonValue.asUInt()); +} + // TODO: This should be moved to a method of P256Keypair CHIP_ERROR LoadKeypairFromRaw(ByteSpan private_key, ByteSpan public_key, Crypto::P256Keypair & keypair) { @@ -205,6 +210,7 @@ void TestHarnessDACProvider::Init(const char * filepath) static constexpr char kFirmwareInfoKey[] = "firmware_information"; static constexpr char kIsSuccessKey[] = "is_success_case"; static constexpr char kDescription[] = "description"; + static constexpr char kPid[] = "basic_info_pid"; std::ifstream json(filepath, std::ifstream::binary); if (!json) @@ -272,6 +278,11 @@ void TestHarnessDACProvider::Init(const char * filepath) data.description.SetValue(ReadValue(root[kDescription], buf, sizeof(buf))); } + if (root.isMember(kPid)) + { + data.pid.SetValue(ReadUint16(root[kPid])); + } + Init(data); } @@ -288,6 +299,8 @@ void TestHarnessDACProvider::Init(const TestHarnessDACProviderData & data) // TODO: We need a real example FirmwareInformation to be populated. mFirmwareInformation = data.firmwareInformation.HasValue() ? data.firmwareInformation.Value() : ByteSpan(); + + mPid = data.pid.ValueOr(0x8000); } CHIP_ERROR TestHarnessDACProvider::GetDeviceAttestationCert(MutableByteSpan & out_dac_buffer) diff --git a/src/app/tests/suites/credentials/TestHarnessDACProvider.h b/src/app/tests/suites/credentials/TestHarnessDACProvider.h index 5904aa52e98cb0..91b848791f2fbe 100644 --- a/src/app/tests/suites/credentials/TestHarnessDACProvider.h +++ b/src/app/tests/suites/credentials/TestHarnessDACProvider.h @@ -33,6 +33,7 @@ struct TestHarnessDACProviderData chip::Optional firmwareInformation; chip::Optional description; chip::Optional isSuccessCase; + chip::Optional pid; }; class TestHarnessDACProvider : public DeviceAttestationCredentialsProvider @@ -47,6 +48,7 @@ class TestHarnessDACProvider : public DeviceAttestationCredentialsProvider CHIP_ERROR SignWithDeviceAttestationKey(const ByteSpan & message_to_sign, MutableByteSpan & out_signature_buffer) override; CharSpan GetDescription() { return mDescription; } bool IsSuccessCase() { return mIsSuccessCase; } + uint16_t GetPid() { return mPid; } void Init(const char * filepath); void Init(const TestHarnessDACProviderData & data); @@ -60,6 +62,7 @@ class TestHarnessDACProvider : public DeviceAttestationCredentialsProvider ByteSpan mFirmwareInformation; CharSpan mDescription; bool mIsSuccessCase; + uint16_t mPid; }; } // namespace Examples diff --git a/src/credentials/tests/TestCommissionerDUTVectors.cpp b/src/credentials/tests/TestCommissionerDUTVectors.cpp index 55beafdc044313..c512776cc89a69 100644 --- a/src/credentials/tests/TestCommissionerDUTVectors.cpp +++ b/src/credentials/tests/TestCommissionerDUTVectors.cpp @@ -108,7 +108,7 @@ TEST_F(TestCommissionerDUTVectors, TestCommissionerDUTVectors) Crypto::DRBG_get_bytes(attestationNonceBuf, sizeof(attestationNonceBuf)); VendorId vid = TestVendor1; - uint16_t pid = strstr(entry->d_name, "_vidpid_fallback_encoding_") ? 0x00B1 : 0x8000; + uint16_t pid = dacProvider.GetPid(); EXPECT_EQ(dacProvider.GetCertificationDeclaration(certDeclSpan), CHIP_NO_ERROR); EXPECT_EQ(dacProvider.GetDeviceAttestationCert(dacCertSpan), CHIP_NO_ERROR); diff --git a/src/python_testing/TC_DA_1_2.py b/src/python_testing/TC_DA_1_2.py index 100f5813778966..759fa3eae3e2a7 100644 --- a/src/python_testing/TC_DA_1_2.py +++ b/src/python_testing/TC_DA_1_2.py @@ -17,6 +17,7 @@ import os import random +import re import chip.clusters as Clusters from chip.interaction_model import InteractionModelError, Status @@ -56,7 +57,7 @@ def parse_single_vidpid_from_common_name(commonName: str, tag_str: str) -> str: return None s = sp[1][:4] - if not s.isupper() or len(s) != 4: + if re.match("[0-9A-F]{4}", s) is None: asserts.fail(f"Improperly encoded PID or VID when using fallback encoding {tag_str}:{s}") return None diff --git a/src/python_testing/test_testing/test_TC_DA_1_2.py b/src/python_testing/test_testing/test_TC_DA_1_2.py index 99acdea072694a..296508ba2fa287 100755 --- a/src/python_testing/test_testing/test_TC_DA_1_2.py +++ b/src/python_testing/test_testing/test_TC_DA_1_2.py @@ -71,7 +71,7 @@ def main(): cert_path, "struct_cd_authorized_paa_list_count1_valid/test_case_vector.json")) run_single_test(path, 32768, factory_reset=True) - test_cases = {'struct_cd': 32768, 'fallback_encoding': 177} + test_cases = ['struct_cd', 'fallback_encoding'] # struct_cd_version_number_wrong - excluded because this is a DCL test not covered by cert # struct_cd_cert_id_mismatch - excluded because this is a DCL test not covered by cert @@ -80,7 +80,7 @@ def main(): passes = [] for p in os.listdir(cert_path): - matches = list(filter(lambda t: t in str(p), test_cases.keys())) + matches = list(filter(lambda t: t in str(p), test_cases)) if len(matches) != 1: continue @@ -91,8 +91,9 @@ def main(): with open(path, 'r') as f: j = json.loads(f.read()) success_expected = j['is_success_case'].lower() == 'true' + pid = j['basic_info_pid'] - ret = run_single_test(path, test_cases[matches[0]]) + ret = run_single_test(path, pid) passes.append((str(p), ret, success_expected)) retval = 0 diff --git a/src/tools/chip-cert/gen_com_dut_test_vectors.py b/src/tools/chip-cert/gen_com_dut_test_vectors.py index 599021b4b5ae14..702868c691be02 100755 --- a/src/tools/chip-cert/gen_com_dut_test_vectors.py +++ b/src/tools/chip-cert/gen_com_dut_test_vectors.py @@ -336,6 +336,21 @@ class CertType(Enum): "test_folder": 'vidpid_fallback_encoding_17', "is_success_case": 'false', }, + # Numeric only + { + "description": 'Fallback VID and PID encoding example from spec: valid and PID numeric only', + "common_name": 'ACME Matter Devel DAC 5CDA9899 Mvid:FFF1 Mpid:0001', + "test_folder": 'vidpid_fallback_encoding_18', + "is_success_case": 'true', + "fallback_pid": 0x0001 + }, + # Not a number at all + { + "description": 'Fallback VID and PID encoding example from spec: PID is not a number', + "common_name": 'ACME Matter Devel DAC 5CDA9899 Mvid:FFF1 Mpid:XYZ1', + "test_folder": 'vidpid_fallback_encoding_19', + "is_success_case": 'false', + }, ] CD_STRUCT_TEST_CASES = [ @@ -770,7 +785,7 @@ def add_files_to_json_config(files_mapping: dict, json_dict: dict): 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): +def generate_test_case_vector_json(test_case_out_dir: str, test_cert: str, test_case, basic_info_pid: int): 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" @@ -788,14 +803,13 @@ def generate_test_case_vector_json(test_case_out_dir: str, test_cert: str, test_ if "is_success_case" in test_case: # These test cases are expected to fail when error injected in DAC but expected to pass when error injected in PAI if (test_cert == 'pai') and (test_case["test_folder"] in ['ext_basic_pathlen0', - 'vidpid_fallback_encoding_08', - 'vidpid_fallback_encoding_09', 'ext_key_usage_dig_sig_wrong' ]): json_dict["is_success_case"] = "true" else: json_dict["is_success_case"] = test_case["is_success_case"] + json_dict['basic_info_pid'] = basic_info_pid # 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) @@ -809,7 +823,8 @@ def generate_test_case_vector_json(test_case_out_dir: str, test_cert: str, test_ 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) + json.dump(json_dict, outfile, indent=4) + outfile.write('\n') def main(): @@ -900,11 +915,13 @@ def main(): 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) + generate_test_case_vector_json(test_case_out_dir, test_cert, test_case, basic_info_pid=0x8000) for test_cert in ['dac', 'pai']: for test_case in VIDPID_FALLBACK_ENCODING_TEST_CASES: test_case_out_dir = args.outdir + '/struct_' + test_cert + '_' + test_case["test_folder"] + fallback_vid = test_case.get('fallback_vid', 0x0FFF1) + fallback_pid = test_case.get('fallback_pid', 0x00B1) if test_cert == 'dac': common_name_dac = test_case["common_name"] common_name_pai = '' @@ -916,14 +933,14 @@ def main(): pid_dac = test_case["pid"] else: pid_dac = PID_NOT_PRESENT - vid_pai = 0xFFF1 - pid_pai = 0x00B1 + vid_pai = fallback_vid + pid_pai = fallback_pid else: common_name_dac = '' common_name_pai = test_case["common_name"] common_name_pai = common_name_pai.replace('DAC', 'PAI') - vid_dac = 0xFFF1 - pid_dac = 0x00B1 + vid_dac = fallback_vid + pid_dac = fallback_pid if "vid" in test_case: vid_pai = test_case["vid"] else: @@ -944,12 +961,11 @@ def main(): builder.make_certs_and_keys() # Generate Certification Declaration (CD) - cmd = chipcert + ' gen-cd -K ' + cd_key + ' -C ' + cd_cert + ' -O ' + test_case_out_dir + '/cd.der' + \ - ' -f 1 -V 0xFFF1 -p 0x00B1 -d 0x1234 -c "ZIG20141ZB330001-24" -l 0 -i 0 -n 9876 -t 0' + cmd = f'{chipcert} gen-cd -K {cd_key} -C {cd_cert} -O {test_case_out_dir}/cd.der -f 1 -V 0x{fallback_vid:04X} -p 0x{fallback_pid:04X} -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) + generate_test_case_vector_json(test_case_out_dir, test_cert, test_case, basic_info_pid=fallback_pid) for test_case in CD_STRUCT_TEST_CASES: test_case_out_dir = args.outdir + '/struct_cd_' + test_case["test_folder"] @@ -1008,7 +1024,7 @@ def main(): subprocess.run(cmd, shell=True) # Generate Test Case Data Container in JSON Format - generate_test_case_vector_json(test_case_out_dir, 'cd', test_case) + generate_test_case_vector_json(test_case_out_dir, 'cd', test_case, basic_info_pid=0x8000) # Test case: Generate {DAC, PAI, PAA} chain with random (invalid) PAA test_case = { @@ -1049,7 +1065,7 @@ def main(): subprocess.run(cmd, shell=True) # Generate Test Case Data Container in JSON Format - generate_test_case_vector_json(test_case_out_dir, 'paa', test_case) + generate_test_case_vector_json(test_case_out_dir, 'paa', test_case, basic_info_pid=0x8000) if __name__ == '__main__': From e1b5fbe283ad3879033e3bb2067004b6dfd45845 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 10 Jun 2024 17:57:31 -0400 Subject: [PATCH 095/162] Update ZAP to fix codegen for nullable attributes. (#33834) Fixes https://github.com/project-chip/connectedhomeip/issues/33413 MIN_ZAP_VERSION is set differently from the tag being used, because the actual changeset tagged with that tag is from 2024-06-06, not 2024-06-10. --- scripts/setup/zap.json | 4 ++-- scripts/setup/zap.version | 2 +- scripts/tools/zap/zap_execution.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index 4e7da8f6d30a7c..c3e65c8bab9752 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,13 +8,13 @@ "mac-amd64", "windows-amd64" ], - "tags": ["version:2@v2024.04.15-nightly.1"] + "tags": ["version:2@v2024.06.10-nightly.1"] }, { "_comment": "Always get the amd64 version on mac until usable arm64 zap build is available", "path": "fuchsia/third_party/zap/mac-amd64", "platforms": ["mac-arm64"], - "tags": ["version:2@v2024.04.15-nightly.1"] + "tags": ["version:2@v2024.06.10-nightly.1"] } ] } diff --git a/scripts/setup/zap.version b/scripts/setup/zap.version index cdc8952361f654..8b3c20afc891f6 100644 --- a/scripts/setup/zap.version +++ b/scripts/setup/zap.version @@ -1 +1 @@ -v2024.04.15-nightly +v2024.06.10-nightly diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index 3256ba069c2790..80def9602dce77 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2024.4.15' +MIN_ZAP_VERSION = '2024.6.6' class ZapTool: From 47097e023a960f2cf5cb2d4dc4f00a2a9c02727f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 10 Jun 2024 18:59:02 -0400 Subject: [PATCH 096/162] cluster model decoupling - declare the codegen (ember) version and implement iteration (#33345) * Initial copy with a clean history * make linter happy * Restyle * Fix typo * Add nolint: assert will return before we use the underlying value * 2 more fixes regarding unchecked access * Switch some asserts to expects, for better test logic * Model renames * Add renamed files * Add some attribute iteration hint * Make use of the attribute cache * Restyle * Add a cluster iteration hint * Add a few more hints. Ember code still contains loops though, so this may not be ideal still * Add some TODO items for using faster iterations for data. Ember index vs value duality still needs some work * Add a cluster type cache as well. This relies on ember being reasonably static * Add global attribute handling * Fix typing u16 vs unsigned * Fix auto-added include names * Remove back the initialization and make the comment more obvious * Update src/app/codegen-interaction-model/model.gni Co-authored-by: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> * Code review feedback: added comments * Update src/app/codegen-interaction-model/CodegenDataModel.h Co-authored-by: Boris Zbarsky * Update src/app/codegen-interaction-model/CodegenDataModel.cpp Co-authored-by: Boris Zbarsky * Update src/app/codegen-interaction-model/BUILD.gn Co-authored-by: Tennessee Carmel-Veilleux * Some cleanup logic for event generation - naming and return values as eventid is not the same as event number * Comment fix * More naming updates * Several comment updates and renamed RequestContext to ActionContext * Restyle * Rename to InteractionModelContext * one more rename * Fix typo * Fix tests to compile * More renames of actions to context * One more comment added * Restyle * Address review comments * Restyle * make clang-tidy happy * Operator== exists on optional ... make use of that directly * Started renaming things * Use the right types in Model.h * Make things compile * Skip global attribute handling, add TODOs for reading extra bits from ember * Typo fix * Several flags and correct loading of privileges for attributes * Start implementing command iteration ... still feels awkward and caching will be a pain * We seem to also support fabric scoping detection * implementation is in theory done, need unit tests * Fix iterator name * Mock support for accepted/generated commands, start having unit tests * Better iteration tests on accepted commands * More unit tests and fix bugs * Restyle * More tests, one iteration bug fix * Slight update again * Aiming for more test coverage * More test coverage for edge cases in iteration * Fix code review comment * Restyle * Update src/app/interaction-model/Events.h Co-authored-by: Boris Zbarsky * Update src/app/interaction-model/IterationTypes.h Co-authored-by: Boris Zbarsky * Update src/app/interaction-model/Paths.h Co-authored-by: Boris Zbarsky * Fix comment about validity * Some kListBegin/End comment updates * Drop kListBegin/End alltogether * Drop groupId * Comment update * Update for data version to be mandatory, add more error reporting and logging * Update to use kInvalid instead of Invalid method * Update flags.set * Use IsServerMask on clusterr class * Use a struct instead of a typedef * Fix compile without error logging * Restyle * Remove command quality that is not supported * Restyle * Rename IsServerMask to IsServer --------- Co-authored-by: Andrei Litvin Co-authored-by: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Co-authored-by: Boris Zbarsky Co-authored-by: Tennessee Carmel-Veilleux --- src/BUILD.gn | 1 + src/app/ConcreteClusterPath.h | 2 +- src/app/codegen-interaction-model/BUILD.gn | 27 + .../CodegenDataModel.cpp | 548 ++++++++++++++++++ .../CodegenDataModel.h | 132 +++++ src/app/codegen-interaction-model/model.gni | 35 ++ .../codegen-interaction-model/tests/BUILD.gn | 35 ++ .../tests/TestCodegenModelViaMocks.cpp | 488 ++++++++++++++++ src/app/interaction-model/BUILD.gn | 3 +- src/app/interaction-model/IterationTypes.h | 99 ---- src/app/interaction-model/MetadataTypes.cpp | 35 ++ src/app/interaction-model/MetadataTypes.h | 155 +++++ src/app/interaction-model/Model.h | 9 +- src/app/interaction-model/OperationTypes.h | 1 - src/app/interaction-model/tests/BUILD.gn | 2 + src/app/util/af-types.h | 7 +- src/app/util/mock/MockNodeConfig.cpp | 30 +- src/app/util/mock/MockNodeConfig.h | 5 +- 18 files changed, 1499 insertions(+), 115 deletions(-) create mode 100644 src/app/codegen-interaction-model/BUILD.gn create mode 100644 src/app/codegen-interaction-model/CodegenDataModel.cpp create mode 100644 src/app/codegen-interaction-model/CodegenDataModel.h create mode 100644 src/app/codegen-interaction-model/model.gni create mode 100644 src/app/codegen-interaction-model/tests/BUILD.gn create mode 100644 src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp delete mode 100644 src/app/interaction-model/IterationTypes.h create mode 100644 src/app/interaction-model/MetadataTypes.cpp create mode 100644 src/app/interaction-model/MetadataTypes.h diff --git a/src/BUILD.gn b/src/BUILD.gn index d455a596b4e346..0c7597b11d94db 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -55,6 +55,7 @@ if (chip_build_tests) { chip_test_group("tests") { deps = [] tests = [ + "${chip_root}/src/app/codegen-interaction-model/tests", "${chip_root}/src/app/interaction-model/tests", "${chip_root}/src/access/tests", "${chip_root}/src/crypto/tests", diff --git a/src/app/ConcreteClusterPath.h b/src/app/ConcreteClusterPath.h index 58b2f5b477f139..8b701efa83967b 100644 --- a/src/app/ConcreteClusterPath.h +++ b/src/app/ConcreteClusterPath.h @@ -52,7 +52,7 @@ struct ConcreteClusterPath // to alignment requirements it's "free" in the sense of not needing more // memory to put it here. But we don't initialize it, because that // increases codesize for the non-consumers. - bool mExpanded; // NOTE: in between larger members + bool mExpanded; // NOTE: in between larger members, NOT initialized (see above) ClusterId mClusterId = 0; }; diff --git a/src/app/codegen-interaction-model/BUILD.gn b/src/app/codegen-interaction-model/BUILD.gn new file mode 100644 index 00000000000000..418983a2fc8b8f --- /dev/null +++ b/src/app/codegen-interaction-model/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2024 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/chip.gni") +# This source set is TIGHLY coupled with code-generated data models +# as generally implemented by `src/app/util` +# +# Corresponding functions defined in attribute-storace.cpp/attribute-table.cpp must +# be available at link time for this model to use +# +# Use `model.gni` to get access to: +# CodegenDataModel.cpp +# CodegenDataModel.h +# +# The above list of files exists to satisfy the "dependency linter" +# since those files should technically be "visible to gn" even though we +# are supposed to go through model.gni constants diff --git a/src/app/codegen-interaction-model/CodegenDataModel.cpp b/src/app/codegen-interaction-model/CodegenDataModel.cpp new file mode 100644 index 00000000000000..f917a8e9c9c4b0 --- /dev/null +++ b/src/app/codegen-interaction-model/CodegenDataModel.cpp @@ -0,0 +1,548 @@ +/* + * Copyright (c) 2024 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 +#include + +#include +#include + +namespace chip { +namespace app { +namespace { + +/// Load the cluster information into the specified destination +std::variant LoadClusterInfo(const ConcreteClusterPath & path, + const EmberAfCluster & cluster) +{ + DataVersion * versionPtr = emberAfDataVersionStorage(path); + if (versionPtr == nullptr) + { + ChipLogError(AppServer, "Failed to get data version for %d/" ChipLogFormatMEI, static_cast(path.mEndpointId), + ChipLogValueMEI(cluster.clusterId)); + return CHIP_ERROR_NOT_FOUND; + } + + InteractionModel::ClusterInfo info(*versionPtr); + + // TODO: set entry flags: + // info->flags.Set(ClusterQualityFlags::kDiagnosticsData) + + return info; +} + +/// Converts a EmberAfCluster into a ClusterEntry +std::variant ClusterEntryFrom(EndpointId endpointId, const EmberAfCluster & cluster) +{ + ConcreteClusterPath clusterPath(endpointId, cluster.clusterId); + auto info = LoadClusterInfo(clusterPath, cluster); + + if (CHIP_ERROR * err = std::get_if(&info)) + { + return *err; + } + + if (InteractionModel::ClusterInfo * infoValue = std::get_if(&info)) + { + return InteractionModel::ClusterEntry{ + .path = clusterPath, + .info = *infoValue, + }; + } + return CHIP_ERROR_INCORRECT_STATE; +} + +/// Finds the first server cluster entry for the given endpoint data starting at [start_index] +/// +/// Returns an invalid entry if no more server clusters are found +InteractionModel::ClusterEntry FirstServerClusterEntry(EndpointId endpointId, const EmberAfEndpointType * endpoint, + unsigned start_index, unsigned & found_index) +{ + for (unsigned cluster_idx = start_index; cluster_idx < endpoint->clusterCount; cluster_idx++) + { + const EmberAfCluster & cluster = endpoint->cluster[cluster_idx]; + if (!cluster.IsServer()) + { + continue; + } + + found_index = cluster_idx; + auto entry = ClusterEntryFrom(endpointId, cluster); + + if (InteractionModel::ClusterEntry * entryValue = std::get_if(&entry)) + { + return *entryValue; + } + +#if CHIP_ERROR_LOGGING + if (CHIP_ERROR * errValue = std::get_if(&entry)) + { + ChipLogError(AppServer, "Failed to load cluster entry: %" CHIP_ERROR_FORMAT, errValue->Format()); + } + else + { + // Should NOT be possible: entryFrom has only 2 variants + ChipLogError(AppServer, "Failed to load cluster entry, UNKNOWN entry return type"); + } +#endif + } + + return InteractionModel::ClusterEntry::kInvalid; +} + +/// Load the attribute information into the specified destination +/// +/// `info` is assumed to be default-constructed/clear (i.e. this sets flags, but does not reset them). +void LoadAttributeInfo(const ConcreteAttributePath & path, const EmberAfAttributeMetadata & attribute, + InteractionModel::AttributeInfo * info) +{ + info->readPrivilege = RequiredPrivilege::ForReadAttribute(path); + if (attribute.IsReadOnly()) + { + info->writePrivilege = RequiredPrivilege::ForWriteAttribute(path); + } + + info->flags.Set(InteractionModel::AttributeQualityFlags::kListAttribute, (attribute.attributeType == ZCL_ARRAY_ATTRIBUTE_TYPE)); + info->flags.Set(InteractionModel::AttributeQualityFlags::kTimed, attribute.MustUseTimedWrite()); + + // NOTE: we do NOT provide additional info for: + // - IsExternal/IsSingleton/IsAutomaticallyPersisted is not used by IM handling + // - IsSingleton spec defines it for CLUSTERS where as we have it for ATTRIBUTES + // - Several specification flags are not available (reportable, quieter reporting, + // fixed, source attribution) + + // TODO: Set additional flags: + // info->flags.Set(InteractionModel::AttributeQualityFlags::kFabricScoped) + // info->flags.Set(InteractionModel::AttributeQualityFlags::kFabricSensitive) + // info->flags.Set(InteractionModel::AttributeQualityFlags::kChangesOmitted) +} + +InteractionModel::AttributeEntry AttributeEntryFrom(const ConcreteClusterPath & clusterPath, + const EmberAfAttributeMetadata & attribute) +{ + InteractionModel::AttributeEntry entry; + + entry.path = ConcreteAttributePath(clusterPath.mEndpointId, clusterPath.mClusterId, attribute.attributeId); + LoadAttributeInfo(entry.path, attribute, &entry.info); + + return entry; +} + +InteractionModel::CommandEntry CommandEntryFrom(const ConcreteClusterPath & clusterPath, CommandId clusterCommandId) +{ + InteractionModel::CommandEntry entry; + entry.path = ConcreteCommandPath(clusterPath.mEndpointId, clusterPath.mClusterId, clusterCommandId); + entry.info.invokePrivilege = RequiredPrivilege::ForInvokeCommand(entry.path); + + entry.info.flags.Set(InteractionModel::CommandQualityFlags::kTimed, + CommandNeedsTimedInvoke(clusterPath.mClusterId, clusterCommandId)); + + entry.info.flags.Set(InteractionModel::CommandQualityFlags::kFabricScoped, + CommandIsFabricScoped(clusterPath.mClusterId, clusterCommandId)); + + return entry; +} + +const ConcreteCommandPath kInvalidCommandPath(kInvalidEndpointId, kInvalidClusterId, kInvalidCommandId); + +} // namespace + +std::optional CodegenDataModel::EmberCommandListIterator::First(const CommandId * list) +{ + VerifyOrReturnValue(list != nullptr, std::nullopt); + mCurrentList = mCurrentHint = list; + + VerifyOrReturnValue(*mCurrentList != kInvalidCommandId, std::nullopt); + return *mCurrentList; +} + +std::optional CodegenDataModel::EmberCommandListIterator::Next(const CommandId * list, CommandId previousId) +{ + VerifyOrReturnValue(list != nullptr, std::nullopt); + VerifyOrReturnValue(previousId != kInvalidCommandId, std::nullopt); + + if (mCurrentList != list) + { + // invalidate the hint if switching lists... + mCurrentHint = nullptr; + mCurrentList = list; + } + + if ((mCurrentHint == nullptr) || (*mCurrentHint != previousId)) + { + // we did not find a usable hint. Search from the to set the hint + mCurrentHint = mCurrentList; + while ((*mCurrentHint != kInvalidCommandId) && (*mCurrentHint != previousId)) + { + mCurrentHint++; + } + } + + VerifyOrReturnValue(*mCurrentHint == previousId, std::nullopt); + + // hint is valid and can be used immediately + mCurrentHint++; // this is the next value + return (*mCurrentHint == kInvalidCommandId) ? std::nullopt : std::make_optional(*mCurrentHint); +} + +bool CodegenDataModel::EmberCommandListIterator::Exists(const CommandId * list, CommandId toCheck) +{ + VerifyOrReturnValue(list != nullptr, false); + VerifyOrReturnValue(toCheck != kInvalidCommandId, false); + + if (mCurrentList != list) + { + // invalidate the hint if switching lists... + mCurrentHint = nullptr; + mCurrentList = list; + } + + // maybe already positioned correctly + if ((mCurrentHint != nullptr) && (*mCurrentHint == toCheck)) + { + return true; + } + + // move and try to find it + mCurrentHint = mCurrentList; + while ((*mCurrentHint != kInvalidCommandId) && (*mCurrentHint != toCheck)) + { + mCurrentHint++; + } + + return (*mCurrentHint == toCheck); +} + +CHIP_ERROR CodegenDataModel::ReadAttribute(const InteractionModel::ReadAttributeRequest & request, + InteractionModel::ReadState & state, AttributeValueEncoder & encoder) +{ + // TODO: this needs an implementation + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR CodegenDataModel::WriteAttribute(const InteractionModel::WriteAttributeRequest & request, + AttributeValueDecoder & decoder) +{ + // TODO: this needs an implementation + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR CodegenDataModel::Invoke(const InteractionModel::InvokeRequest & request, TLV::TLVReader & input_arguments, + InteractionModel::InvokeReply & reply) +{ + // TODO: this needs an implementation + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +EndpointId CodegenDataModel::FirstEndpoint() +{ + // find the first enabled index + const uint16_t lastEndpointIndex = emberAfEndpointCount(); + for (uint16_t endpoint_idx = 0; endpoint_idx < lastEndpointIndex; endpoint_idx++) + { + if (emberAfEndpointIndexIsEnabled(endpoint_idx)) + { + mEndpointIterationHint = endpoint_idx; + return emberAfEndpointFromIndex(endpoint_idx); + } + } + + // No enabled endpoint found. Give up + return kInvalidEndpointId; +} + +std::optional CodegenDataModel::TryFindEndpointIndex(EndpointId id) const +{ + const uint16_t lastEndpointIndex = emberAfEndpointCount(); + + if ((mEndpointIterationHint < lastEndpointIndex) && emberAfEndpointIndexIsEnabled(mEndpointIterationHint) && + (id == emberAfEndpointFromIndex(mEndpointIterationHint))) + { + return std::make_optional(mEndpointIterationHint); + } + + // Linear search, this may be slow + uint16_t idx = emberAfIndexFromEndpoint(id); + if (idx == kEmberInvalidEndpointIndex) + { + return std::nullopt; + } + + return std::make_optional(idx); +} + +EndpointId CodegenDataModel::NextEndpoint(EndpointId before) +{ + const unsigned lastEndpointIndex = emberAfEndpointCount(); + + std::optional before_idx = TryFindEndpointIndex(before); + if (!before_idx.has_value()) + { + return kInvalidEndpointId; + } + + // find the first enabled index + for (uint16_t endpoint_idx = static_cast(*before_idx + 1); endpoint_idx < lastEndpointIndex; endpoint_idx++) + { + if (emberAfEndpointIndexIsEnabled(endpoint_idx)) + { + mEndpointIterationHint = endpoint_idx; + return emberAfEndpointFromIndex(endpoint_idx); + } + } + + // No enabled enpoint after "before" was found, give up + return kInvalidEndpointId; +} + +InteractionModel::ClusterEntry CodegenDataModel::FirstCluster(EndpointId endpointId) +{ + const EmberAfEndpointType * endpoint = emberAfFindEndpointType(endpointId); + VerifyOrReturnValue(endpoint != nullptr, InteractionModel::ClusterEntry::kInvalid); + VerifyOrReturnValue(endpoint->clusterCount > 0, InteractionModel::ClusterEntry::kInvalid); + VerifyOrReturnValue(endpoint->cluster != nullptr, InteractionModel::ClusterEntry::kInvalid); + + return FirstServerClusterEntry(endpointId, endpoint, 0, mClusterIterationHint); +} + +std::optional CodegenDataModel::TryFindServerClusterIndex(const EmberAfEndpointType * endpoint, ClusterId id) const +{ + const unsigned clusterCount = endpoint->clusterCount; + + if (mClusterIterationHint < clusterCount) + { + const EmberAfCluster & cluster = endpoint->cluster[mClusterIterationHint]; + if (cluster.IsServer() && (cluster.clusterId == id)) + { + return std::make_optional(mClusterIterationHint); + } + } + + // linear search, this may be slow + // does NOT use emberAfClusterIndex to not iterate over endpoints as we have + // already found the correct endpoint + for (unsigned cluster_idx = 0; cluster_idx < clusterCount; cluster_idx++) + { + const EmberAfCluster & cluster = endpoint->cluster[cluster_idx]; + if (cluster.IsServer() && (cluster.clusterId == id)) + { + return std::make_optional(cluster_idx); + } + } + + return std::nullopt; +} + +InteractionModel::ClusterEntry CodegenDataModel::NextCluster(const ConcreteClusterPath & before) +{ + // TODO: This search still seems slow (ember will loop). Should use index hints as long + // as ember API supports it + const EmberAfEndpointType * endpoint = emberAfFindEndpointType(before.mEndpointId); + + VerifyOrReturnValue(endpoint != nullptr, InteractionModel::ClusterEntry::kInvalid); + VerifyOrReturnValue(endpoint->clusterCount > 0, InteractionModel::ClusterEntry::kInvalid); + VerifyOrReturnValue(endpoint->cluster != nullptr, InteractionModel::ClusterEntry::kInvalid); + + std::optional cluster_idx = TryFindServerClusterIndex(endpoint, before.mClusterId); + if (!cluster_idx.has_value()) + { + return InteractionModel::ClusterEntry::kInvalid; + } + + return FirstServerClusterEntry(before.mEndpointId, endpoint, *cluster_idx + 1, mClusterIterationHint); +} + +std::optional CodegenDataModel::GetClusterInfo(const ConcreteClusterPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, std::nullopt); + + auto info = LoadClusterInfo(path, *cluster); + + if (CHIP_ERROR * err = std::get_if(&info)) + { +#if CHIP_ERROR_LOGGING + ChipLogError(AppServer, "Failed to load cluster info: %" CHIP_ERROR_FORMAT, err->Format()); +#else + (void) err->Format(); +#endif + return std::nullopt; + } + + return std::make_optional(std::get(info)); +} + +InteractionModel::AttributeEntry CodegenDataModel::FirstAttribute(const ConcreteClusterPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, InteractionModel::AttributeEntry::kInvalid); + VerifyOrReturnValue(cluster->attributeCount > 0, InteractionModel::AttributeEntry::kInvalid); + VerifyOrReturnValue(cluster->attributes != nullptr, InteractionModel::AttributeEntry::kInvalid); + + mAttributeIterationHint = 0; + return AttributeEntryFrom(path, cluster->attributes[0]); +} + +std::optional CodegenDataModel::TryFindAttributeIndex(const EmberAfCluster * cluster, AttributeId id) const +{ + const unsigned attributeCount = cluster->attributeCount; + + // attempt to find this based on the embedded hint + if ((mAttributeIterationHint < attributeCount) && (cluster->attributes[mAttributeIterationHint].attributeId == id)) + { + return std::make_optional(mAttributeIterationHint); + } + + // linear search is required. This may be slow + for (unsigned attribute_idx = 0; attribute_idx < attributeCount; attribute_idx++) + { + + if (cluster->attributes[attribute_idx].attributeId == id) + { + return std::make_optional(attribute_idx); + } + } + + return std::nullopt; +} + +const EmberAfCluster * CodegenDataModel::FindServerCluster(const ConcreteClusterPath & path) +{ + // cache things + if (mPreviouslyFoundCluster.has_value() && (mPreviouslyFoundCluster->path == path)) + { + return mPreviouslyFoundCluster->cluster; + } + + const EmberAfCluster * cluster = emberAfFindServerCluster(path.mEndpointId, path.mClusterId); + if (cluster != nullptr) + { + mPreviouslyFoundCluster = std::make_optional(path, cluster); + } + return cluster; +} + +InteractionModel::AttributeEntry CodegenDataModel::NextAttribute(const ConcreteAttributePath & before) +{ + const EmberAfCluster * cluster = FindServerCluster(before); + VerifyOrReturnValue(cluster != nullptr, InteractionModel::AttributeEntry::kInvalid); + VerifyOrReturnValue(cluster->attributeCount > 0, InteractionModel::AttributeEntry::kInvalid); + VerifyOrReturnValue(cluster->attributes != nullptr, InteractionModel::AttributeEntry::kInvalid); + + // find the given attribute in the list and then return the next one + std::optional attribute_idx = TryFindAttributeIndex(cluster, before.mAttributeId); + if (!attribute_idx.has_value()) + { + return InteractionModel::AttributeEntry::kInvalid; + } + + unsigned next_idx = *attribute_idx + 1; + if (next_idx < cluster->attributeCount) + { + mAttributeIterationHint = next_idx; + return AttributeEntryFrom(before, cluster->attributes[next_idx]); + } + + // iteration complete + return InteractionModel::AttributeEntry::kInvalid; +} + +std::optional CodegenDataModel::GetAttributeInfo(const ConcreteAttributePath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, std::nullopt); + VerifyOrReturnValue(cluster->attributeCount > 0, std::nullopt); + VerifyOrReturnValue(cluster->attributes != nullptr, std::nullopt); + + std::optional attribute_idx = TryFindAttributeIndex(cluster, path.mAttributeId); + + if (!attribute_idx.has_value()) + { + return std::nullopt; + } + + InteractionModel::AttributeInfo info; + LoadAttributeInfo(path, cluster->attributes[*attribute_idx], &info); + return std::make_optional(info); +} + +InteractionModel::CommandEntry CodegenDataModel::FirstAcceptedCommand(const ConcreteClusterPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, InteractionModel::CommandEntry::kInvalid); + + std::optional commandId = mAcceptedCommandsIterator.First(cluster->acceptedCommandList); + VerifyOrReturnValue(commandId.has_value(), InteractionModel::CommandEntry::kInvalid); + + return CommandEntryFrom(path, *commandId); +} + +InteractionModel::CommandEntry CodegenDataModel::NextAcceptedCommand(const ConcreteCommandPath & before) +{ + const EmberAfCluster * cluster = FindServerCluster(before); + + VerifyOrReturnValue(cluster != nullptr, InteractionModel::CommandEntry::kInvalid); + + std::optional commandId = mAcceptedCommandsIterator.Next(cluster->acceptedCommandList, before.mCommandId); + VerifyOrReturnValue(commandId.has_value(), InteractionModel::CommandEntry::kInvalid); + + return CommandEntryFrom(before, *commandId); +} + +std::optional CodegenDataModel::GetAcceptedCommandInfo(const ConcreteCommandPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, std::nullopt); + VerifyOrReturnValue(mAcceptedCommandsIterator.Exists(cluster->acceptedCommandList, path.mCommandId), std::nullopt); + + return CommandEntryFrom(path, path.mCommandId).info; +} + +ConcreteCommandPath CodegenDataModel::FirstGeneratedCommand(const ConcreteClusterPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, kInvalidCommandPath); + + std::optional commandId = mGeneratedCommandsIterator.First(cluster->generatedCommandList); + VerifyOrReturnValue(commandId.has_value(), kInvalidCommandPath); + return ConcreteCommandPath(path.mEndpointId, path.mClusterId, *commandId); +} + +ConcreteCommandPath CodegenDataModel::NextGeneratedCommand(const ConcreteCommandPath & before) +{ + const EmberAfCluster * cluster = FindServerCluster(before); + + VerifyOrReturnValue(cluster != nullptr, kInvalidCommandPath); + + std::optional commandId = mGeneratedCommandsIterator.Next(cluster->generatedCommandList, before.mCommandId); + VerifyOrReturnValue(commandId.has_value(), kInvalidCommandPath); + + return ConcreteCommandPath(before.mEndpointId, before.mClusterId, *commandId); +} + +} // namespace app +} // namespace chip diff --git a/src/app/codegen-interaction-model/CodegenDataModel.h b/src/app/codegen-interaction-model/CodegenDataModel.h new file mode 100644 index 00000000000000..43117fa48d2312 --- /dev/null +++ b/src/app/codegen-interaction-model/CodegenDataModel.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 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 + +namespace chip { +namespace app { + +/// An implementation of `InteractionModel::Model` that relies on code-generation +/// via zap/ember. +/// +/// The Ember framework uses generated files (like endpoint-config.h and various +/// other generated metadata) to provide a cluster model. +/// +/// This class will use global functions generally residing in `app/util` +/// as well as application-specific overrides to provide data model functionality. +/// +/// Given that this relies on global data at link time, there generally can be +/// only one CodegenDataModel per application (you can create more instances, +/// however they would share the exact same underlying data and storage). +class CodegenDataModel : public chip::app::InteractionModel::Model +{ +private: + /// Ember commands are stored as a `CommandId *` pointer that is either null (i.e. no commands) + /// or is terminated with 0xFFFF_FFFF aka kInvalidCommandId + /// + /// Since iterator implementations in the data model use Next(before_path) calls, iterating + /// such lists from the beginning would be very inefficient as O(n^2). + /// + /// This class maintains a cached position inside such iteration, such that `Next` calls + /// can be faster. + class EmberCommandListIterator + { + private: + const CommandId * mCurrentList = nullptr; + const CommandId * mCurrentHint = nullptr; // Invariant: mCurrentHint is INSIDE mCurrentList + public: + EmberCommandListIterator() = default; + + /// Returns the first command in the given list (or nullopt if list is null or starts with 0xFFFFFFF) + std::optional First(const CommandId * list); + + /// Returns the command after `previousId` in the given list + std::optional Next(const CommandId * list, CommandId previousId); + + /// Checks if the given command id exists in the given list + bool Exists(const CommandId * list, CommandId toCheck); + }; + +public: + /// Generic model implementations + CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } + + CHIP_ERROR ReadAttribute(const InteractionModel::ReadAttributeRequest & request, InteractionModel::ReadState & state, + AttributeValueEncoder & encoder) override; + CHIP_ERROR WriteAttribute(const InteractionModel::WriteAttributeRequest & request, AttributeValueDecoder & decoder) override; + CHIP_ERROR Invoke(const InteractionModel::InvokeRequest & request, chip::TLV::TLVReader & input_arguments, + InteractionModel::InvokeReply & reply) override; + + /// attribute tree iteration + EndpointId FirstEndpoint() override; + EndpointId NextEndpoint(EndpointId before) override; + + InteractionModel::ClusterEntry FirstCluster(EndpointId endpoint) override; + InteractionModel::ClusterEntry NextCluster(const ConcreteClusterPath & before) override; + std::optional GetClusterInfo(const ConcreteClusterPath & path) override; + + InteractionModel::AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) override; + InteractionModel::AttributeEntry NextAttribute(const ConcreteAttributePath & before) override; + std::optional GetAttributeInfo(const ConcreteAttributePath & path) override; + + InteractionModel::CommandEntry FirstAcceptedCommand(const ConcreteClusterPath & cluster) override; + InteractionModel::CommandEntry NextAcceptedCommand(const ConcreteCommandPath & before) override; + std::optional GetAcceptedCommandInfo(const ConcreteCommandPath & path) override; + + ConcreteCommandPath FirstGeneratedCommand(const ConcreteClusterPath & cluster) override; + ConcreteCommandPath NextGeneratedCommand(const ConcreteCommandPath & before) override; + +private: + // Iteration is often done in a tight loop going through all values. + // To avoid N^2 iterations, cache a hint of where something is positioned + uint16_t mEndpointIterationHint = 0; + unsigned mClusterIterationHint = 0; + unsigned mAttributeIterationHint = 0; + EmberCommandListIterator mAcceptedCommandsIterator; + EmberCommandListIterator mGeneratedCommandsIterator; + + // represents a remembered cluster reference that has been found as + // looking for clusters is very common (for every attribute iteration) + struct ClusterReference + { + ConcreteClusterPath path; + const EmberAfCluster * cluster; + + ClusterReference(const ConcreteClusterPath p, const EmberAfCluster * c) : path(p), cluster(c) {} + }; + std::optional mPreviouslyFoundCluster; + + /// Finds the specified ember cluster + /// + /// Effectively the same as `emberAfFindServerCluster` except with some caching capabilities + const EmberAfCluster * FindServerCluster(const ConcreteClusterPath & path); + + /// Find the index of the given attribute id + std::optional TryFindAttributeIndex(const EmberAfCluster * cluster, chip::AttributeId id) const; + + /// Find the index of the given cluster id + std::optional TryFindServerClusterIndex(const EmberAfEndpointType * endpoint, chip::ClusterId id) const; + + /// Find the index of the given endpoint id + std::optional TryFindEndpointIndex(chip::EndpointId id) const; +}; + +} // namespace app +} // namespace chip diff --git a/src/app/codegen-interaction-model/model.gni b/src/app/codegen-interaction-model/model.gni new file mode 100644 index 00000000000000..d1c4e85b90b433 --- /dev/null +++ b/src/app/codegen-interaction-model/model.gni @@ -0,0 +1,35 @@ +# Copyright (c) 2024 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/chip.gni") + +# The sources in this directory are TIGHTLY coupled with code-generated data models +# as generally implemented by `src/app/util` +# +# Corresponding functions defined in attribute-storace.cpp/attribute-table.cpp must +# be available at link time for this model to use and constants heavily depend +# on `zap-generated/endpoint_config.h` (generally compile-time constants that +# are code generated) +# +# As a result, the files here are NOT a source_set or similar because they cannot +# be cleanly built as a stand-alone and instead have to be imported as part of +# a different data model or compilation unit. +codegen_interaction_model_SOURCES = [ + "${chip_root}/src/app/codegen-interaction-model/CodegenDataModel.h", + "${chip_root}/src/app/codegen-interaction-model/CodegenDataModel.cpp", +] + +codegen_interaction_model_PUBLIC_DEPS = [ + "${chip_root}/src/app/common:attribute-type", + "${chip_root}/src/app/interaction-model", +] diff --git a/src/app/codegen-interaction-model/tests/BUILD.gn b/src/app/codegen-interaction-model/tests/BUILD.gn new file mode 100644 index 00000000000000..f543bc8d0cc24b --- /dev/null +++ b/src/app/codegen-interaction-model/tests/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2024 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/chip.gni") +import("${chip_root}/build/chip/chip_test_suite.gni") +import("${chip_root}/src/app/codegen-interaction-model/model.gni") + +source_set("mock_model") { + sources = codegen_interaction_model_SOURCES + + public_deps = codegen_interaction_model_PUBLIC_DEPS + + # this ties in the codegen model to an actual ember implementation + public_deps += [ "${chip_root}/src/app/util/mock:mock_ember" ] +} + +chip_test_suite("tests") { + output_name = "libCodegenInteractionModelTests" + + test_sources = [ "TestCodegenModelViaMocks.cpp" ] + + cflags = [ "-Wconversion" ] + + public_deps = [ ":mock_model" ] +} diff --git a/src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp new file mode 100644 index 00000000000000..e8175bf8d3f340 --- /dev/null +++ b/src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp @@ -0,0 +1,488 @@ +/* + * + * Copyright (c) 2024 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 + +#include + +using namespace chip; +using namespace chip::Test; +using namespace chip::app; +using namespace chip::app::InteractionModel; +using namespace chip::app::Clusters::Globals::Attributes; + +namespace { + +constexpr EndpointId kEndpointIdThatIsMissing = kMockEndpointMin - 1; + +static_assert(kEndpointIdThatIsMissing != kInvalidEndpointId); +static_assert(kEndpointIdThatIsMissing != kMockEndpoint1); +static_assert(kEndpointIdThatIsMissing != kMockEndpoint2); +static_assert(kEndpointIdThatIsMissing != kMockEndpoint3); + +// clang-format off +const MockNodeConfig gTestNodeConfig({ + MockEndpointConfig(kMockEndpoint1, { + MockClusterConfig(MockClusterId(1), { + ClusterRevision::Id, FeatureMap::Id, + }, { + MockEventId(1), MockEventId(2), + }), + MockClusterConfig(MockClusterId(2), { + ClusterRevision::Id, FeatureMap::Id, MockAttributeId(1), + }), + }), + MockEndpointConfig(kMockEndpoint2, { + MockClusterConfig(MockClusterId(1), { + ClusterRevision::Id, FeatureMap::Id, + }), + MockClusterConfig( + MockClusterId(2), + { + ClusterRevision::Id, + FeatureMap::Id, + MockAttributeId(1), + MockAttributeConfig(MockAttributeId(2), ZCL_ARRAY_ATTRIBUTE_TYPE), + }, /* attributes */ + {}, /* events */ + {1, 2, 23}, /* acceptedCommands */ + {2, 10} /* generatedCommands */ + ), + MockClusterConfig( + MockClusterId(3), + { + ClusterRevision::Id, FeatureMap::Id, MockAttributeId(1), MockAttributeId(2), MockAttributeId(3), + }, /* attributes */ + {}, /* events */ + {11}, /* acceptedCommands */ + {4, 6} /* generatedCommands */ + ), + }), + MockEndpointConfig(kMockEndpoint3, { + MockClusterConfig(MockClusterId(1), { + ClusterRevision::Id, FeatureMap::Id, MockAttributeId(1), + }), + MockClusterConfig(MockClusterId(2), { + ClusterRevision::Id, FeatureMap::Id, MockAttributeId(1), MockAttributeId(2), MockAttributeId(3), MockAttributeId(4), + }), + MockClusterConfig(MockClusterId(3), { + ClusterRevision::Id, FeatureMap::Id, + }), + MockClusterConfig(MockClusterId(4), { + ClusterRevision::Id, FeatureMap::Id, + }), + }), +}); +// clang-format on + +struct UseMockNodeConfig +{ + UseMockNodeConfig(const MockNodeConfig & config) { SetMockNodeConfig(config); } + ~UseMockNodeConfig() { ResetMockNodeConfig(); } +}; + +} // namespace + +TEST(TestCodegenModelViaMocks, IterateOverEndpoints) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // This iteration relies on the hard-coding that occurs when mock_ember is used + EXPECT_EQ(model.FirstEndpoint(), kMockEndpoint1); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint1), kMockEndpoint2); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint2), kMockEndpoint3); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint3), kInvalidEndpointId); + + /// Some out of order requests should work as well + EXPECT_EQ(model.NextEndpoint(kMockEndpoint2), kMockEndpoint3); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint2), kMockEndpoint3); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint1), kMockEndpoint2); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint1), kMockEndpoint2); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint2), kMockEndpoint3); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint1), kMockEndpoint2); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint3), kInvalidEndpointId); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint3), kInvalidEndpointId); + EXPECT_EQ(model.FirstEndpoint(), kMockEndpoint1); + EXPECT_EQ(model.FirstEndpoint(), kMockEndpoint1); + + // invalid endpoiunts + EXPECT_EQ(model.NextEndpoint(kInvalidEndpointId), kInvalidEndpointId); + EXPECT_EQ(model.NextEndpoint(987u), kInvalidEndpointId); +} + +TEST(TestCodegenModelViaMocks, IterateOverClusters) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + chip::Test::ResetVersion(); + + EXPECT_FALSE(model.FirstCluster(kEndpointIdThatIsMissing).path.HasValidIds()); + EXPECT_FALSE(model.FirstCluster(kInvalidEndpointId).path.HasValidIds()); + EXPECT_FALSE(model.NextCluster(ConcreteClusterPath(kInvalidEndpointId, 123)).path.HasValidIds()); + EXPECT_FALSE(model.NextCluster(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).path.HasValidIds()); + EXPECT_FALSE(model.NextCluster(ConcreteClusterPath(kMockEndpoint1, 981u)).path.HasValidIds()); + + // mock endpoint 1 has 2 mock clusters: 1 and 2 + ClusterEntry entry = model.FirstCluster(kMockEndpoint1); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint1); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(1)); + EXPECT_EQ(entry.info.dataVersion, 0u); + EXPECT_EQ(entry.info.flags.Raw(), 0u); + + chip::Test::BumpVersion(); + + entry = model.NextCluster(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint1); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.info.dataVersion, 1u); + EXPECT_EQ(entry.info.flags.Raw(), 0u); + + entry = model.NextCluster(entry.path); + EXPECT_FALSE(entry.path.HasValidIds()); + + // mock endpoint 3 has 4 mock clusters: 1 through 4 + entry = model.FirstCluster(kMockEndpoint3); + for (uint16_t clusterId = 1; clusterId <= 4; clusterId++) + { + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint3); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(clusterId)); + entry = model.NextCluster(entry.path); + } + EXPECT_FALSE(entry.path.HasValidIds()); + + // repeat calls should work + for (int i = 0; i < 10; i++) + { + entry = model.FirstCluster(kMockEndpoint1); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint1); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(1)); + } + + for (int i = 0; i < 10; i++) + { + ClusterEntry nextEntry = model.NextCluster(entry.path); + ASSERT_TRUE(nextEntry.path.HasValidIds()); + EXPECT_EQ(nextEntry.path.mEndpointId, kMockEndpoint1); + EXPECT_EQ(nextEntry.path.mClusterId, MockClusterId(2)); + } +} + +TEST(TestCodegenModelViaMocks, GetClusterInfo) +{ + + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + chip::Test::ResetVersion(); + + ASSERT_FALSE(model.GetClusterInfo(ConcreteClusterPath(kInvalidEndpointId, kInvalidClusterId)).has_value()); + ASSERT_FALSE(model.GetClusterInfo(ConcreteClusterPath(kInvalidEndpointId, MockClusterId(1))).has_value()); + ASSERT_FALSE(model.GetClusterInfo(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).has_value()); + ASSERT_FALSE(model.GetClusterInfo(ConcreteClusterPath(kMockEndpoint1, MockClusterId(10))).has_value()); + + // now get the value + std::optional info = model.GetClusterInfo(ConcreteClusterPath(kMockEndpoint1, MockClusterId(1))); + ASSERT_TRUE(info.has_value()); + EXPECT_EQ(info->dataVersion, 0u); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_EQ(info->flags.Raw(), 0u); // NOLINT(bugprone-unchecked-optional-access) + + chip::Test::BumpVersion(); + info = model.GetClusterInfo(ConcreteClusterPath(kMockEndpoint1, MockClusterId(1))); + ASSERT_TRUE(info.has_value()); + EXPECT_EQ(info->dataVersion, 1u); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_EQ(info->flags.Raw(), 0u); // NOLINT(bugprone-unchecked-optional-access) +} + +TEST(TestCodegenModelViaMocks, IterateOverAttributes) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // invalid paths should return in "no more data" + ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kInvalidEndpointId, MockClusterId(1))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kMockEndpoint1, MockClusterId(10))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).path.HasValidIds()); + + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kEndpointIdThatIsMissing, MockClusterId(1), 1u)).path.HasValidIds()); + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kInvalidEndpointId, MockClusterId(1), 1u)).path.HasValidIds()); + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kMockEndpoint1, MockClusterId(10), 1u)).path.HasValidIds()); + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kMockEndpoint1, kInvalidClusterId, 1u)).path.HasValidIds()); + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), 987u)).path.HasValidIds()); + + // should be able to iterate over valid paths + AttributeEntry entry = model.FirstAttribute(ConcreteClusterPath(kMockEndpoint2, MockClusterId(2))); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, ClusterRevision::Id); + ASSERT_FALSE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + + entry = model.NextAttribute(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, FeatureMap::Id); + ASSERT_FALSE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + + entry = model.NextAttribute(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, MockAttributeId(1)); + ASSERT_FALSE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + + entry = model.NextAttribute(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, MockAttributeId(2)); + ASSERT_TRUE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + + entry = model.NextAttribute(entry.path); + ASSERT_FALSE(entry.path.HasValidIds()); + + // repeated calls should work + for (int i = 0; i < 10; i++) + { + entry = model.FirstAttribute(ConcreteClusterPath(kMockEndpoint2, MockClusterId(2))); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, ClusterRevision::Id); + ASSERT_FALSE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + } + + for (int i = 0; i < 10; i++) + { + entry = model.NextAttribute(ConcreteAttributePath(kMockEndpoint2, MockClusterId(2), MockAttributeId(1))); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, MockAttributeId(2)); + ASSERT_TRUE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + } +} + +TEST(TestCodegenModelViaMocks, GetAttributeInfo) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // various non-existent or invalid paths should return no info data + ASSERT_FALSE( + model.GetAttributeInfo(ConcreteAttributePath(kInvalidEndpointId, kInvalidClusterId, kInvalidAttributeId)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kInvalidEndpointId, kInvalidClusterId, FeatureMap::Id)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kInvalidEndpointId, MockClusterId(1), FeatureMap::Id)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, kInvalidClusterId, FeatureMap::Id)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, MockClusterId(10), FeatureMap::Id)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, MockClusterId(10), kInvalidAttributeId)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), MockAttributeId(10))).has_value()); + + // valid info + std::optional info = + model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), FeatureMap::Id)); + ASSERT_TRUE(info.has_value()); + EXPECT_FALSE(info->flags.Has(AttributeQualityFlags::kListAttribute)); // NOLINT(bugprone-unchecked-optional-access) + + info = model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint2, MockClusterId(2), MockAttributeId(2))); + ASSERT_TRUE(info.has_value()); + EXPECT_TRUE(info->flags.Has(AttributeQualityFlags::kListAttribute)); // NOLINT(bugprone-unchecked-optional-access) +} + +// global attributes are EXPLICITLY not supported +TEST(TestCodegenModelViaMocks, GlobalAttributeInfo) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + std::optional info = model.GetAttributeInfo( + ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), Clusters::Globals::Attributes::GeneratedCommandList::Id)); + + ASSERT_FALSE(info.has_value()); + + info = model.GetAttributeInfo( + ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), Clusters::Globals::Attributes::AttributeList::Id)); + ASSERT_FALSE(info.has_value()); +} + +TEST(TestCodegenModelViaMocks, IterateOverAcceptedCommands) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // invalid paths should return in "no more data" + ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kInvalidEndpointId, MockClusterId(1))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kMockEndpoint1, MockClusterId(10))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).path.HasValidIds()); + + // should be able to iterate over valid paths + CommandEntry entry = model.FirstAcceptedCommand(ConcreteClusterPath(kMockEndpoint2, MockClusterId(2))); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 1u); + + entry = model.NextAcceptedCommand(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 2u); + + entry = model.NextAcceptedCommand(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 23u); + + entry = model.NextAcceptedCommand(entry.path); + ASSERT_FALSE(entry.path.HasValidIds()); + + // attempt some out-of-order requests as well + entry = model.FirstAcceptedCommand(ConcreteClusterPath(kMockEndpoint2, MockClusterId(3))); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(3)); + EXPECT_EQ(entry.path.mCommandId, 11u); + + for (int i = 0; i < 10; i++) + { + entry = model.NextAcceptedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 2)); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 23u); + } + + for (int i = 0; i < 10; i++) + { + entry = model.NextAcceptedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1)); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 2u); + } + + for (int i = 0; i < 10; i++) + { + entry = model.NextAcceptedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(3), 10)); + EXPECT_FALSE(entry.path.HasValidIds()); + } +} + +TEST(TestCodegenModelViaMocks, AcceptedCommandInfo) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // invalid paths should return in "no more data" + ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kEndpointIdThatIsMissing, MockClusterId(1), 1)).has_value()); + ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kInvalidEndpointId, MockClusterId(1), 1)).has_value()); + ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint1, MockClusterId(10), 1)).has_value()); + ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint1, kInvalidClusterId, 1)).has_value()); + ASSERT_FALSE( + model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint1, MockClusterId(1), kInvalidCommandId)).has_value()); + + std::optional info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 2u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 23u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1234u)); + ASSERT_FALSE(info.has_value()); +} + +TEST(TestCodegenModelViaMocks, IterateOverGeneratedCommands) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // invalid paths should return in "no more data" + ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).HasValidIds()); + ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kInvalidEndpointId, MockClusterId(1))).HasValidIds()); + ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kMockEndpoint1, MockClusterId(10))).HasValidIds()); + ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).HasValidIds()); + + // should be able to iterate over valid paths + ConcreteCommandPath path = model.FirstGeneratedCommand(ConcreteClusterPath(kMockEndpoint2, MockClusterId(2))); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(2)); + EXPECT_EQ(path.mCommandId, 2u); + + path = model.NextGeneratedCommand(path); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(2)); + EXPECT_EQ(path.mCommandId, 10u); + + path = model.NextGeneratedCommand(path); + ASSERT_FALSE(path.HasValidIds()); + + // attempt some out-of-order requests as well + path = model.FirstGeneratedCommand(ConcreteClusterPath(kMockEndpoint2, MockClusterId(3))); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(3)); + EXPECT_EQ(path.mCommandId, 4u); + + for (int i = 0; i < 10; i++) + { + path = model.NextGeneratedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 2)); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(2)); + EXPECT_EQ(path.mCommandId, 10u); + } + + for (int i = 0; i < 10; i++) + { + path = model.NextGeneratedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(3), 4)); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(3)); + EXPECT_EQ(path.mCommandId, 6u); + } + + for (int i = 0; i < 10; i++) + { + path = model.NextGeneratedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(3), 6)); + EXPECT_FALSE(path.HasValidIds()); + } +} diff --git a/src/app/interaction-model/BUILD.gn b/src/app/interaction-model/BUILD.gn index a0967289c6c65c..19dd3de6c26291 100644 --- a/src/app/interaction-model/BUILD.gn +++ b/src/app/interaction-model/BUILD.gn @@ -19,7 +19,8 @@ source_set("interaction-model") { "Context.h", "Events.h", "InvokeResponder.h", - "IterationTypes.h", + "MetadataTypes.cpp", + "MetadataTypes.h", "Model.h", "OperationTypes.h", "Paths.h", diff --git a/src/app/interaction-model/IterationTypes.h b/src/app/interaction-model/IterationTypes.h deleted file mode 100644 index 441dd3acb7b81f..00000000000000 --- a/src/app/interaction-model/IterationTypes.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2024 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 - -namespace chip { -namespace app { -namespace InteractionModel { - -enum class ClusterQualityFlags : uint32_t -{ - kDiagnosticsData = 0x0001, // `K` quality, may be filtered out in subscriptions -}; - -struct ClusterInfo -{ - DataVersion dataVersion; // current version of this cluster - BitFlags flags; -}; - -struct ClusterEntry -{ - ConcreteClusterPath path; - ClusterInfo info; -}; - -enum class AttributeQualityFlags : uint32_t -{ - kListAttribute = 0x0001, // This attribute is a list attribute - kChangesOmitted = 0x0002, // `C` quality on attributes -}; - -struct AttributeInfo -{ - BitFlags flags; -}; - -struct AttributeEntry -{ - ConcreteAttributePath path; - AttributeInfo info; -}; - -/// Provides metadata information for a data model -/// -/// The data model can be viewed as a tree of endpoint/cluster/attribute -/// where each element can be iterated through independently -/// -/// Iteration rules: -/// - kInvalidEndpointId will be returned when iteration ends (or generally kInvalid* for paths) -/// - Any internal iteration errors are just logged (callers do not handle iteration CHIP_ERROR) -/// - Iteration order is NOT guaranteed globally. Only the following is guaranteed: -/// - when iterating over an endpoint, ALL clusters of that endpoint will be iterated first, before -/// switching the endpoint (order of clusters themselves not guaranteed) -/// - when iterating over a cluster, ALL attributes of that cluster will be iterated first, before -/// switching to a new cluster -/// - uniqueness and completeness (iterate over all possible distinct values as long as no -/// internal structural changes occur) -class AttributeTreeIterator -{ -public: - virtual ~AttributeTreeIterator() = default; - - virtual EndpointId FirstEndpoint() = 0; - virtual EndpointId NextEndpoint(EndpointId before) = 0; - - virtual ClusterEntry FirstCluster(EndpointId endpoint) = 0; - virtual ClusterEntry NextCluster(const ConcreteClusterPath & before) = 0; - virtual std::optional GetClusterInfo(const ConcreteClusterPath & path) = 0; - - virtual AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) = 0; - virtual AttributeEntry NextAttribute(const ConcreteAttributePath & before) = 0; - virtual std::optional GetAttributeInfo(const ConcreteAttributePath & path) = 0; -}; - -} // namespace InteractionModel -} // namespace app -} // namespace chip diff --git a/src/app/interaction-model/MetadataTypes.cpp b/src/app/interaction-model/MetadataTypes.cpp new file mode 100644 index 00000000000000..48c2e3db733a52 --- /dev/null +++ b/src/app/interaction-model/MetadataTypes.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 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 + +namespace chip { +namespace app { +namespace InteractionModel { + +const AttributeEntry AttributeEntry::kInvalid{ .path = ConcreteAttributePath(kInvalidEndpointId, kInvalidClusterId, + kInvalidAttributeId) }; + +const CommandEntry CommandEntry::kInvalid{ .path = ConcreteCommandPath(kInvalidEndpointId, kInvalidClusterId, kInvalidCommandId) }; + +const ClusterEntry ClusterEntry::kInvalid{ + .path = ConcreteClusterPath(kInvalidEndpointId, kInvalidClusterId), + .info = ClusterInfo(0 /* version */), // version of invalid cluster entry does not matter +}; + +} // namespace InteractionModel +} // namespace app +} // namespace chip diff --git a/src/app/interaction-model/MetadataTypes.h b/src/app/interaction-model/MetadataTypes.h new file mode 100644 index 00000000000000..5b3c62f0be2247 --- /dev/null +++ b/src/app/interaction-model/MetadataTypes.h @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2024 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 +#include + +namespace chip { +namespace app { +namespace InteractionModel { + +enum class ClusterQualityFlags : uint32_t +{ + kDiagnosticsData = 0x0001, // `K` quality, may be filtered out in subscriptions +}; + +struct ClusterInfo +{ + DataVersion dataVersion; // current cluster data version, + BitFlags flags; + + /// Constructor that marks data version as mandatory + /// for this structure. + ClusterInfo(DataVersion version) : dataVersion(version) {} +}; + +struct ClusterEntry +{ + ConcreteClusterPath path; + ClusterInfo info; + + bool IsValid() const { return path.HasValidIds(); } + + static const ClusterEntry kInvalid; +}; + +enum class AttributeQualityFlags : uint32_t +{ + kListAttribute = 0x0004, // This attribute is a list attribute + kFabricScoped = 0x0008, // 'F' quality on attributes + kFabricSensitive = 0x0010, // 'S' quality on attributes + kChangesOmitted = 0x0020, // `C` quality on attributes + kTimed = 0x0040, // `T` quality on attributes (writes require timed interactions) +}; + +struct AttributeInfo +{ + BitFlags flags; + + // read/write access will be missing if read/write is NOT allowed + std::optional readPrivilege; // generally defaults to View if readable + std::optional writePrivilege; // generally defaults to Operate if writable +}; + +struct AttributeEntry +{ + ConcreteAttributePath path; + AttributeInfo info; + + bool IsValid() const { return path.HasValidIds(); } + + static const AttributeEntry kInvalid; +}; + +enum class CommandQualityFlags : uint32_t +{ + kFabricScoped = 0x0001, + kTimed = 0x0002, // `T` quality on commands +}; + +struct CommandInfo +{ + BitFlags flags; + Access::Privilege invokePrivilege = Access::Privilege::kOperate; +}; + +struct CommandEntry +{ + ConcreteCommandPath path; + CommandInfo info; + + bool IsValid() const { return path.HasValidIds(); } + + static const CommandEntry kInvalid; +}; + +/// Provides metadata information for a data model +/// +/// The data model can be viewed as a tree of endpoint/cluster/(attribute+commands+events) +/// where each element can be iterated through independently. +/// +/// Iteration rules: +/// - Invalid paths will be returned when iteration ends (IDs will be kInvalid* and in particular +/// mEndpointId will be kInvalidEndpointId). See `::kInvalid` constants for entries and +/// can use ::IsValid() to determine if the entry is valid or not. +/// - Global Attributes are NOT returned since they are implied +/// - Any internal iteration errors are just logged (callers do not handle iteration CHIP_ERROR) +/// - Iteration order is NOT guaranteed globally. Only the following is guaranteed: +/// - Complete tree iteration (e.g. when iterating an endpoint, ALL clusters of that endpoint +/// are returned, when iterating over a cluster, all attributes/commands are iterated over) +/// - uniqueness and completeness (iterate over all possible distinct values as long as no +/// internal structural changes occur) +class DataModelMetadataTree +{ +public: + virtual ~DataModelMetadataTree() = default; + + virtual EndpointId FirstEndpoint() = 0; + virtual EndpointId NextEndpoint(EndpointId before) = 0; + + virtual ClusterEntry FirstCluster(EndpointId endpoint) = 0; + virtual ClusterEntry NextCluster(const ConcreteClusterPath & before) = 0; + virtual std::optional GetClusterInfo(const ConcreteClusterPath & path) = 0; + + // Attribute iteration and accessors provide cluster-level access over + // attributes + virtual AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) = 0; + virtual AttributeEntry NextAttribute(const ConcreteAttributePath & before) = 0; + virtual std::optional GetAttributeInfo(const ConcreteAttributePath & path) = 0; + + // Command iteration and accessors provide cluster-level access over commands + virtual CommandEntry FirstAcceptedCommand(const ConcreteClusterPath & cluster) = 0; + virtual CommandEntry NextAcceptedCommand(const ConcreteCommandPath & before) = 0; + virtual std::optional GetAcceptedCommandInfo(const ConcreteCommandPath & path) = 0; + + // "generated" commands are purely for reporting what types of command ids can be + // returned as responses. + virtual ConcreteCommandPath FirstGeneratedCommand(const ConcreteClusterPath & cluster) = 0; + virtual ConcreteCommandPath NextGeneratedCommand(const ConcreteCommandPath & before) = 0; +}; + +} // namespace InteractionModel +} // namespace app +} // namespace chip diff --git a/src/app/interaction-model/Model.h b/src/app/interaction-model/Model.h index 151065f4c540d2..5ab973901a433b 100644 --- a/src/app/interaction-model/Model.h +++ b/src/app/interaction-model/Model.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include namespace chip { @@ -38,7 +38,7 @@ namespace InteractionModel { /// thread or equivalent /// - class is allowed to attempt to cache indexes/locations for faster /// lookups of things (e.g during iterations) -class Model : public AttributeTreeIterator +class Model : public DataModelMetadataTree { public: virtual ~Model() = default; @@ -77,11 +77,6 @@ class Model : public AttributeTreeIterator /// When this is invoked, caller is expected to have already done some validations: /// - cluster `data version` has been checked for the incoming request if applicable /// - /// List operation support: - /// - the first list write will have `request.writeFlags.Has(WriteFlags::kListBegin)` - /// - the last list write will have `request.writeFlags.Has(WriteFlags::kListEnd)` - /// - the last list write MAY have empty data (no list items) - /// /// When `request.writeFlags.Has(WriteFlags::kForceInternal)` the request is from an internal app update /// and SHOULD bypass some internal checks (like timed enforcement, potentially read-only restrictions) /// diff --git a/src/app/interaction-model/OperationTypes.h b/src/app/interaction-model/OperationTypes.h index 57499a8dbafb49..feb2e173d91600 100644 --- a/src/app/interaction-model/OperationTypes.h +++ b/src/app/interaction-model/OperationTypes.h @@ -85,7 +85,6 @@ enum class InvokeFlags : uint32_t struct InvokeRequest : OperationRequest { ConcreteCommandPath path; - std::optional groupRequestId; // set if and only if this was a group request BitFlags invokeFlags; }; diff --git a/src/app/interaction-model/tests/BUILD.gn b/src/app/interaction-model/tests/BUILD.gn index c7d36b4f1dcdca..4767d61dd12ed1 100644 --- a/src/app/interaction-model/tests/BUILD.gn +++ b/src/app/interaction-model/tests/BUILD.gn @@ -15,6 +15,8 @@ import("//build_overrides/chip.gni") import("${chip_root}/build/chip/chip_test_suite.gni") chip_test_suite("tests") { + output_name = "libIMInterfaceTests" + test_sources = [ "TestEventEmitting.cpp" ] cflags = [ "-Wconversion" ] diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index c608854c346fba..929ad055d0fc1e 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -23,6 +23,7 @@ * @{ */ +#include "att-storage.h" #include // For bool #include // For various uint*_t types @@ -63,7 +64,7 @@ typedef void (*EmberAfGenericClusterFunction)(void); /** * @brief Struct describing cluster */ -typedef struct +struct EmberAfCluster { /** * ID of cluster according to ZCL spec @@ -116,7 +117,9 @@ typedef struct * Total number of events supported by the cluster instance (in eventList array). */ uint16_t eventCount; -} EmberAfCluster; + + bool IsServer() const { return (mask & CLUSTER_MASK_SERVER) != 0; } +}; /** * @brief Struct that represents a logical device type consisting diff --git a/src/app/util/mock/MockNodeConfig.cpp b/src/app/util/mock/MockNodeConfig.cpp index 79c886f532a8a2..5670966e2ebb29 100644 --- a/src/app/util/mock/MockNodeConfig.cpp +++ b/src/app/util/mock/MockNodeConfig.cpp @@ -54,9 +54,12 @@ const T * findById(const std::vector & vector, decltype(std::declval().id) } // namespace MockClusterConfig::MockClusterConfig(ClusterId aId, std::initializer_list aAttributes, - std::initializer_list aEvents) : + std::initializer_list aEvents, + std::initializer_list aAcceptedCommands, + std::initializer_list aGeneratedCommands) : id(aId), - attributes(aAttributes), events(aEvents), mEmberCluster{} + attributes(aAttributes), events(aEvents), mEmberCluster{}, mAcceptedCommands(aAcceptedCommands), + mGeneratedCommands(aGeneratedCommands) { VerifyOrDie(aAttributes.size() < UINT16_MAX); @@ -71,6 +74,18 @@ MockClusterConfig::MockClusterConfig(ClusterId aId, std::initializer_list(mEmberEventList.size()); mEmberCluster.eventList = mEmberEventList.data(); + if (!mAcceptedCommands.empty()) + { + mAcceptedCommands.push_back(kInvalidCommandId); + mEmberCluster.acceptedCommandList = mAcceptedCommands.data(); + } + + if (!mGeneratedCommands.empty()) + { + mGeneratedCommands.push_back(kInvalidCommandId); + mEmberCluster.generatedCommandList = mGeneratedCommands.data(); + } + for (auto & attr : attributes) { mAttributeMetaData.push_back(attr.attributeMetaData); @@ -82,10 +97,19 @@ MockClusterConfig::MockClusterConfig(ClusterId aId, std::initializer_list aAttributes = {}, - std::initializer_list aEvents = {}); + std::initializer_list aEvents = {}, std::initializer_list aAcceptedCommands = {}, + std::initializer_list aGeneratedCommands = {}); // Cluster-config is self-referential: mEmberCluster.attributes references mAttributeMetaData.data() MockClusterConfig(const MockClusterConfig & other); @@ -86,6 +87,8 @@ struct MockClusterConfig EmberAfCluster mEmberCluster; std::vector mEmberEventList; std::vector mAttributeMetaData; + std::vector mAcceptedCommands; + std::vector mGeneratedCommands; }; struct MockEndpointConfig From 23e0f3b979d82337baf0333d6eec8026c6c7944c Mon Sep 17 00:00:00 2001 From: cdj <45139296+DejinChen@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:57:32 +0800 Subject: [PATCH 097/162] Modified wifi network diagnostics cluster name, WiFi to Wi-Fi to match the SPEC (#33746) --- .../air-quality-sensor-common/air-quality-sensor-app.zap | 2 +- .../all-clusters-common/all-clusters-app.zap | 2 +- .../all-clusters-common/all-clusters-minimal-app.zap | 2 +- examples/bridge-app/bridge-common/bridge-app.zap | 2 +- .../devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap | 2 +- examples/chef/devices/rootnode_dishwasher_cc105034fe.zap | 2 +- .../chef/devices/rootnode_laundrywasher_fb10d238c8.zap | 2 +- ...ledcabinet_temperaturecontrolledcabinet_ffdb696680.zap | 2 +- .../chef/sample_app_util/test_files/sample_zap_file.zap | 2 +- .../contact-sensor-common/contact-sensor-app.zap | 2 +- .../dishwasher-app/dishwasher-common/dishwasher-app.zap | 2 +- .../fabric-bridge-common/fabric-bridge-app.zap | 2 +- .../laundry-washer-app/nxp/zap/laundry-washer-app.zap | 2 +- .../light-switch-common/light-switch-app.zap | 2 +- .../bouffalolab/data_model/lighting-app-wifi.zap | 2 +- examples/lighting-app/lighting-common/lighting-app.zap | 2 +- .../lighting-app/silabs/data_model/lighting-wifi-app.zap | 2 +- .../lit-icd-app/lit-icd-common/lit-icd-server-app.zap | 2 +- examples/lock-app/lock-common/lock-app.zap | 2 +- .../microwave-oven-common/microwave-oven-app.zap | 2 +- .../network-manager-common/network-manager-app.zap | 2 +- examples/placeholder/linux/apps/app1/config.zap | 2 +- examples/placeholder/linux/apps/app2/config.zap | 2 +- .../refrigerator-common/refrigerator-app.zap | 2 +- .../temperature-measurement.zap | 2 +- examples/thermostat/nxp/zap/thermostat_matter_wifi.zap | 2 +- examples/thermostat/thermostat-common/thermostat.zap | 2 +- examples/tv-app/tv-common/tv-app.zap | 2 +- .../tv-casting-app/tv-casting-common/tv-casting-app.zap | 2 +- .../virtual-device-common/virtual-device-app.zap | 2 +- examples/window-app/common/window-app.zap | 2 +- scripts/tools/zap/tests/inputs/all-clusters-app.zap | 2 +- scripts/tools/zap/tests/inputs/lighting-app.zap | 2 +- .../all-clusters-app/app-templates/endpoint_config.h | 8 ++++---- .../outputs/all-clusters-app/app-templates/gen_config.h | 2 +- .../outputs/lighting-app/app-templates/endpoint_config.h | 8 ++++---- .../tests/outputs/lighting-app/app-templates/gen_config.h | 2 +- .../wifi-network-diagnostics-server.cpp | 6 +++--- src/app/tests/suites/TestDescriptorCluster.yaml | 2 +- .../zap-templates/zcl/data-model/chip/matter-devices.xml | 4 ++-- .../data-model/chip/wifi-network-diagnostics-cluster.xml | 2 +- src/app/zap-templates/zcl/zcl-with-test-extensions.json | 2 +- src/app/zap-templates/zcl/zcl.json | 2 +- src/controller/data_model/controller-clusters.zap | 2 +- src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h | 2 +- src/darwin/Framework/CHIP/zap-generated/MTRClusters.h | 2 +- src/include/platform/DiagnosticDataProvider.h | 2 +- .../app-common/app-common/zap-generated/callback.h | 4 ++-- 48 files changed, 58 insertions(+), 58 deletions(-) diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap index 1ba46389e28a9e..a4d9ae077df2ee 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap @@ -2742,7 +2742,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", 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 14c5f68d26e89c..8660f24af8b504 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 @@ -4340,7 +4340,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index a4d3b3858ef160..f6d3c8da0bf480 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -3002,7 +3002,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/bridge-app/bridge-common/bridge-app.zap b/examples/bridge-app/bridge-common/bridge-app.zap index 555299e68cb5c0..ee172e2f021daf 100644 --- a/examples/bridge-app/bridge-common/bridge-app.zap +++ b/examples/bridge-app/bridge-common/bridge-app.zap @@ -3249,7 +3249,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap index f335efdea007c7..84f87b51c18147 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap @@ -2714,7 +2714,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap b/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap index a7d96a16932d52..7b211cba5c115f 100644 --- a/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap +++ b/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap @@ -2094,7 +2094,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap index 6b7f934335240c..6a142824041899 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap @@ -2094,7 +2094,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap index d3395e323b9495..ca71e2306c494f 100644 --- a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap +++ b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap @@ -2094,7 +2094,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/sample_app_util/test_files/sample_zap_file.zap b/examples/chef/sample_app_util/test_files/sample_zap_file.zap index d45fe300bf20b4..5dfd0fb28a9427 100644 --- a/examples/chef/sample_app_util/test_files/sample_zap_file.zap +++ b/examples/chef/sample_app_util/test_files/sample_zap_file.zap @@ -3024,7 +3024,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap index 87e55719e6a026..6e810d2e9641ed 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap @@ -3098,7 +3098,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap b/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap index 62667da2b3a2a0..e639aba9e7ccee 100644 --- a/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap +++ b/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap @@ -2234,7 +2234,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap index 76344153de457a..38bfd514882edd 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap +++ b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap @@ -2884,7 +2884,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.zap b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.zap index d5c7ee215e1976..3a30427a3ee25d 100644 --- a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.zap +++ b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.zap @@ -2240,7 +2240,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.zap b/examples/light-switch-app/light-switch-common/light-switch-app.zap index dcfa64d7c5e88f..3c55161e479404 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.zap +++ b/examples/light-switch-app/light-switch-common/light-switch-app.zap @@ -3024,7 +3024,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap index 4986e87b004d02..11f0f8146c0faf 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap @@ -1903,7 +1903,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 0e706b8b162482..f4ca3d4705b405 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -2979,7 +2979,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap index 4893d153e6b246..acd877496b7497 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap @@ -1877,7 +1877,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap index 6bbfc9050a8365..93d47fc3870900 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap @@ -2217,7 +2217,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap index 04689b5ca64a00..376e925d6545bb 100644 --- a/examples/lock-app/lock-common/lock-app.zap +++ b/examples/lock-app/lock-common/lock-app.zap @@ -3654,7 +3654,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap index 81d051d068a88f..a6f1ff62c1d03b 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap @@ -1790,7 +1790,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/network-manager-app/network-manager-common/network-manager-app.zap b/examples/network-manager-app/network-manager-common/network-manager-app.zap index 46cb4b19598ca8..cb4e48c3c0480b 100644 --- a/examples/network-manager-app/network-manager-common/network-manager-app.zap +++ b/examples/network-manager-app/network-manager-common/network-manager-app.zap @@ -2033,7 +2033,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/placeholder/linux/apps/app1/config.zap b/examples/placeholder/linux/apps/app1/config.zap index 06ce98d5dac58d..8e493ace9674be 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -4056,7 +4056,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/placeholder/linux/apps/app2/config.zap b/examples/placeholder/linux/apps/app2/config.zap index d53fd356cce9ac..055309e6c07340 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -4072,7 +4072,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap b/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap index 7b28387152fa19..ebb8f70ea5aa9e 100644 --- a/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap +++ b/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap @@ -2002,7 +2002,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap index ff63220f006ce9..72a68b64e569f1 100644 --- a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap +++ b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap @@ -1962,7 +1962,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap index 9e18152bebf2bd..14c9dc4ecf3f75 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap @@ -2248,7 +2248,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap index 64c87bce7e15c6..3a39fb6b0e2909 100644 --- a/examples/thermostat/thermostat-common/thermostat.zap +++ b/examples/thermostat/thermostat-common/thermostat.zap @@ -3156,7 +3156,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/tv-app/tv-common/tv-app.zap b/examples/tv-app/tv-common/tv-app.zap index 981d295d0afb02..3fce693642d18d 100644 --- a/examples/tv-app/tv-common/tv-app.zap +++ b/examples/tv-app/tv-common/tv-app.zap @@ -3174,7 +3174,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap index 37b4953c1c72ce..526143427a3cb7 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap @@ -1745,7 +1745,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap index af20ff3733f846..4046660e64a9a1 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap @@ -2972,7 +2972,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/window-app/common/window-app.zap b/examples/window-app/common/window-app.zap index fdfeb3db5eab93..5aaefb796e33ab 100644 --- a/examples/window-app/common/window-app.zap +++ b/examples/window-app/common/window-app.zap @@ -3782,7 +3782,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index 784c8dfddb7664..26c2f9161e1b5a 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -4082,7 +4082,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/scripts/tools/zap/tests/inputs/lighting-app.zap b/scripts/tools/zap/tests/inputs/lighting-app.zap index 5bbb7f86708ff7..6dcaaa4b3408d1 100644 --- a/scripts/tools/zap/tests/inputs/lighting-app.zap +++ b/scripts/tools/zap/tests/inputs/lighting-app.zap @@ -3087,7 +3087,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index 55da8ec3f3f136..8542d7428860b3 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -637,7 +637,7 @@ { ZAP_SIMPLE_DEFAULT(0x000F), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(2), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ { ZAP_EMPTY_DEFAULT(), 0x00000000, 7, ZAP_TYPE(OCTET_STRING), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* BSSID */ \ { ZAP_EMPTY_DEFAULT(), 0x00000001, 1, ZAP_TYPE(ENUM8), \ @@ -1502,7 +1502,7 @@ /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ /* EventList (index=12) */ \ 0x00000000, /* SoftwareFault */ \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ /* EventList (index=13) */ \ 0x00000000, /* Disconnection */ \ 0x00000001, /* AssociationFailure */ \ @@ -1662,7 +1662,7 @@ /* AcceptedCommandList (index=44) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */\ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */\ /* AcceptedCommandList (index=46) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ @@ -2197,7 +2197,7 @@ .eventCount = 0, \ },\ { \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ .clusterId = 0x00000036, \ .attributes = ZAP_ATTRIBUTE_INDEX(173), \ .attributeCount = 15, \ diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h index e4347a93f273b1..f31bd86846fef7 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h @@ -205,7 +205,7 @@ #define MATTER_DM_PLUGIN_THREAD_NETWORK_DIAGNOSTICS_SERVER #define MATTER_DM_PLUGIN_THREAD_NETWORK_DIAGNOSTICS -// Use this macro to check if the server side of the WiFi Network Diagnostics cluster is included +// Use this macro to check if the server side of the Wi-Fi Network Diagnostics cluster is included #define ZCL_USING_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER #define MATTER_DM_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS_SERVER #define MATTER_DM_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h index f04deadd1610b7..e4d7ea430d603d 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h @@ -336,7 +336,7 @@ { ZAP_SIMPLE_DEFAULT(0x000F), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(2), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ { ZAP_EMPTY_DEFAULT(), 0x00000000, 7, ZAP_TYPE(OCTET_STRING), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* BSSID */ \ { ZAP_EMPTY_DEFAULT(), 0x00000001, 1, ZAP_TYPE(ENUM8), \ @@ -545,7 +545,7 @@ 0x00000001, /* RadioFaultChange */ \ 0x00000002, /* NetworkFaultChange */ \ 0x00000003, /* BootReason */ \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ /* EventList (index=12) */ \ 0x00000000, /* Disconnection */ \ 0x00000001, /* AssociationFailure */ \ @@ -652,7 +652,7 @@ /* AcceptedCommandList (index=41) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */\ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */\ /* AcceptedCommandList (index=43) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ @@ -947,7 +947,7 @@ .eventCount = 0, \ },\ { \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ .clusterId = 0x00000036, \ .attributes = ZAP_ATTRIBUTE_INDEX(154), \ .attributeCount = 15, \ diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h index 7002f3ef3bd806..48b2305ba372b7 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h @@ -139,7 +139,7 @@ #define MATTER_DM_PLUGIN_THREAD_NETWORK_DIAGNOSTICS_SERVER #define MATTER_DM_PLUGIN_THREAD_NETWORK_DIAGNOSTICS -// Use this macro to check if the server side of the WiFi Network Diagnostics cluster is included +// Use this macro to check if the server side of the Wi-Fi Network Diagnostics cluster is included #define ZCL_USING_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER #define MATTER_DM_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS_SERVER #define MATTER_DM_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS diff --git a/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp b/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp index d24bc02227b272..e119cfd7c2972f 100644 --- a/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp +++ b/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp @@ -250,7 +250,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate for (auto endpoint : EnabledEndpointsWithServerCluster(WiFiNetworkDiagnostics::Id)) { - // If WiFi Network Diagnostics cluster is implemented on this endpoint + // If Wi-Fi Network Diagnostics cluster is implemented on this endpoint Events::Disconnection::Type event{ reasonCode }; EventNumber eventNumber; @@ -271,7 +271,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate for (auto endpoint : EnabledEndpointsWithServerCluster(WiFiNetworkDiagnostics::Id)) { - // If WiFi Network Diagnostics cluster is implemented on this endpoint + // If Wi-Fi Network Diagnostics cluster is implemented on this endpoint EventNumber eventNumber; if (CHIP_NO_ERROR != LogEvent(event, endpoint, eventNumber)) @@ -290,7 +290,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate Events::ConnectionStatus::Type event{ static_cast(connectionStatus) }; for (auto endpoint : EnabledEndpointsWithServerCluster(WiFiNetworkDiagnostics::Id)) { - // If WiFi Network Diagnostics cluster is implemented on this endpoint + // If Wi-Fi Network Diagnostics cluster is implemented on this endpoint EventNumber eventNumber; if (CHIP_NO_ERROR != LogEvent(event, endpoint, eventNumber)) diff --git a/src/app/tests/suites/TestDescriptorCluster.yaml b/src/app/tests/suites/TestDescriptorCluster.yaml index 332e72ede9b084..b6b2cbc73e9f42 100644 --- a/src/app/tests/suites/TestDescriptorCluster.yaml +++ b/src/app/tests/suites/TestDescriptorCluster.yaml @@ -58,7 +58,7 @@ tests: 0x0033, # General Diagnostics 0x0034, # Software Diagnostics 0x0035, # Thread Network Diagnostiscs - 0x0036, # WiFi Network Diagnostics + 0x0036, # Wi-Fi Network Diagnostics 0x0037, # Ethernet Network Diagnostics 0x0038, # Time Synchronization 0x003C, # Administrator Commissioning diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 2aad342ea71311..0016bb8ec27717 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -84,7 +84,7 @@ limitations under the License. - + @@ -2606,7 +2606,7 @@ limitations under the License. PARTS_LIST - + diff --git a/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml index 33d3f661fd3834..7fb35aab255ed7 100644 --- a/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml @@ -50,7 +50,7 @@ limitations under the License. General - WiFi Network Diagnostics + Wi-Fi Network Diagnostics 0x0036 WIFI_NETWORK_DIAGNOSTICS_CLUSTER The Wi-Fi Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 30c14436667202..e0fcb32e0dc89e 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -353,7 +353,7 @@ "ChannelPage0Mask", "OperationalDatasetComponents" ], - "WiFi Network Diagnostics": [ + "Wi-Fi Network Diagnostics": [ "BSSID", "SecurityType", "WiFiVersion", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 33955572d795ec..c95ce76c77c4b5 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -351,7 +351,7 @@ "ChannelPage0Mask", "OperationalDatasetComponents" ], - "WiFi Network Diagnostics": [ + "Wi-Fi Network Diagnostics": [ "BSSID", "SecurityType", "WiFiVersion", diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 66863228023a7b..475eaec9c76d7c 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -1233,7 +1233,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index c5e73b22368081..db7cab28e7b4d2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -3218,7 +3218,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end /** - * Cluster WiFi Network Diagnostics + * Cluster Wi-Fi Network Diagnostics * * The Wi-Fi Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 29249e35e5a360..24759f5e2c461b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -1498,7 +1498,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end /** - * Cluster WiFi Network Diagnostics + * Cluster Wi-Fi Network Diagnostics * The Wi-Fi Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) diff --git a/src/include/platform/DiagnosticDataProvider.h b/src/include/platform/DiagnosticDataProvider.h index 2430673bc55724..4ea81bc7bcc6ac 100644 --- a/src/include/platform/DiagnosticDataProvider.h +++ b/src/include/platform/DiagnosticDataProvider.h @@ -234,7 +234,7 @@ class DiagnosticDataProvider virtual CHIP_ERROR ResetEthNetworkDiagnosticsCounts(); /** - * WiFi network diagnostics methods + * Wi-Fi network diagnostics methods */ /** diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index e260c824886cd6..73ae93e310a1a2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -1599,7 +1599,7 @@ chip::Protocols::InteractionModel::Status MatterThreadNetworkDiagnosticsClusterS void emberAfThreadNetworkDiagnosticsClusterServerTickCallback(chip::EndpointId endpoint); // -// WiFi Network Diagnostics Cluster +// Wi-Fi Network Diagnostics Cluster // /** @@ -5567,7 +5567,7 @@ bool emberAfThreadNetworkDiagnosticsClusterResetCountsCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::DecodableType & commandData); /** - * @brief WiFi Network Diagnostics Cluster ResetCounts Command callback (from client) + * @brief Wi-Fi Network Diagnostics Cluster ResetCounts Command callback (from client) */ bool emberAfWiFiNetworkDiagnosticsClusterResetCountsCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, From b29c1deb0e8e72be1f6d6d5988b21c8060dbfd91 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Tue, 11 Jun 2024 09:12:37 -0400 Subject: [PATCH 098/162] Allow CommandSender request to be built using DataModel::EncodableToTLV (#33782) Allow CommandSender request to be built using DataModel::EncodableToTLV --- src/app/CommandSender.cpp | 12 ++++++++++++ src/app/CommandSender.h | 40 +++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index af317f76003900..fe263eb8923cc7 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -537,6 +537,18 @@ CHIP_ERROR CommandSender::FinishCommand(FinishCommandParameters & aFinishCommand return FinishCommandInternal(aFinishCommandParams); } +CHIP_ERROR CommandSender::AddRequestData(const CommandPathParams & aCommandPath, const DataModel::EncodableToTLV & aEncodable, + AddRequestDataParameters & aAddRequestDataParams) +{ + PrepareCommandParameters prepareCommandParams(aAddRequestDataParams); + ReturnErrorOnFailure(PrepareCommand(aCommandPath, prepareCommandParams)); + TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); + VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(aEncodable.EncodeTo(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields))); + FinishCommandParameters finishCommandParams(aAddRequestDataParams); + return FinishCommand(finishCommandParams); +} + CHIP_ERROR CommandSender::FinishCommandInternal(FinishCommandParameters & aFinishCommandParams) { CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/src/app/CommandSender.h b/src/app/CommandSender.h index 25603b3a1f3787..5542d2469bb743 100644 --- a/src/app/CommandSender.h +++ b/src/app/CommandSender.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -375,6 +376,22 @@ class CommandSender final : public Messaging::ExchangeDelegate TLV::TLVWriter * GetCommandDataIBTLVWriter(); + /** + * API for adding request data using DataModel::EncodableToTLV. + * + * @param [in] aCommandPath The path of the command being requested. + * @param [in] aEncodable The request data to encode into the + * `CommandFields` member of `CommandDataIB`. + * @param [in] aAddRequestDataParams parameters associated with building the + * InvokeRequestMessage that are associated with this request. + * + * This API will not fail if this is an untimed invoke but the command provided requires a timed + * invoke interaction. If the caller wants that to fail before sending the command, they should call + * the templated version of AddRequestData. + */ + CHIP_ERROR AddRequestData(const CommandPathParams & aCommandPath, const DataModel::EncodableToTLV & aEncodable, + AddRequestDataParameters & aAddRequestDataParams); + /** * API for adding a data request. The template parameter T is generally * expected to be a ClusterName::Commands::CommandName::Type struct, but any @@ -391,15 +408,18 @@ class CommandSender final : public Messaging::ExchangeDelegate return AddRequestData(aCommandPath, aData, addRequestDataParams); } - template + template , int> = 0> CHIP_ERROR AddRequestData(const CommandPathParams & aCommandPath, const CommandDataT & aData, AddRequestDataParameters & aAddRequestDataParams) { VerifyOrReturnError(!CommandDataT::MustUseTimedInvoke() || aAddRequestDataParams.timedInvokeTimeoutMs.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); - return AddRequestDataInternal(aCommandPath, aData, aAddRequestDataParams); + DataModel::EncodableType encodable(aData); + return AddRequestData(aCommandPath, encodable, aAddRequestDataParams); } + template CHIP_ERROR AddRequestData(const CommandPathParams & aCommandPath, const CommandDataT & aData, const Optional & aTimedInvokeTimeoutMs) @@ -426,7 +446,8 @@ class CommandSender final : public Messaging::ExchangeDelegate CHIP_ERROR TestOnlyAddRequestDataNoTimedCheck(const CommandPathParams & aCommandPath, const CommandDataT & aData, AddRequestDataParameters & aAddRequestDataParams) { - return AddRequestDataInternal(aCommandPath, aData, aAddRequestDataParams); + DataModel::EncodableType encodable(aData); + return AddRequestData(aCommandPath, encodable, aAddRequestDataParams); } CHIP_ERROR TestOnlyFinishCommand(FinishCommandParameters & aFinishCommandParams) @@ -448,19 +469,6 @@ class CommandSender final : public Messaging::ExchangeDelegate #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST private: - template - CHIP_ERROR AddRequestDataInternal(const CommandPathParams & aCommandPath, const CommandDataT & aData, - AddRequestDataParameters & aAddRequestDataParams) - { - PrepareCommandParameters prepareCommandParams(aAddRequestDataParams); - ReturnErrorOnFailure(PrepareCommand(aCommandPath, prepareCommandParams)); - TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); - VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(DataModel::Encode(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields), aData)); - FinishCommandParameters finishCommandParams(aAddRequestDataParams); - return FinishCommand(finishCommandParams); - } - CHIP_ERROR FinishCommandInternal(FinishCommandParameters & aFinishCommandParams); public: From bd0422b25ac329323b0ba93808fe7084ec8f2c0a Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 11 Jun 2024 10:25:29 -0400 Subject: [PATCH 099/162] Clear Aliro credentials when ClearCredential for all credentials happens. (#33796) We were not clearing credentials of the Aliro types in this situation. --- .../door-lock-server/door-lock-server.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 742afee28480f3..b48327bc6c5ce0 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -3038,6 +3038,24 @@ Status DoorLockServer::clearCredentials(chip::EndpointId endpointId, chip::Fabri ChipLogProgress(Zcl, "[clearCredentials] All face credentials were cleared [endpointId=%d]", endpointId); } + if (SupportsAliroProvisioning(endpointId)) + { + for (auto & credentialType : + { CredentialTypeEnum::kAliroEvictableEndpointKey, CredentialTypeEnum::kAliroCredentialIssuerKey, + CredentialTypeEnum::kAliroNonEvictableEndpointKey }) + { + auto status = clearCredentials(endpointId, modifier, sourceNodeId, credentialType); + if (Status::Success != status) + { + ChipLogError(Zcl, + "[clearCredentials] Unable to clear all Aliro credentials [endpointId=%d,credentialType=%d,status=%d]", + endpointId, to_underlying(credentialType), to_underlying(status)); + return status; + } + } + ChipLogProgress(Zcl, "[clearCredentials] All Aliro credentials were cleared [endpointId=%d]", endpointId); + } + return Status::Success; } From 2ee90eba27676950fa2f4ef96597d9696f510d5d Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 12 Jun 2024 03:38:24 +0900 Subject: [PATCH 100/162] Implement Android ICD queue Btn (#33743) --- .../clusterclient/WildcardFragment.kt | 83 ++++++++++++------- .../src/main/res/layout/wildcard_fragment.xml | 47 +++++++---- .../app/src/main/res/values/strings.xml | 2 + 3 files changed, 87 insertions(+), 45 deletions(-) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt index 4324ba535d886a..f27aede35d19e8 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt @@ -174,7 +174,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall setVisibilityEachView(radioBtnId) } - binding.sendBtn.setOnClickListener { showDialog() } + binding.sendBtn.setOnClickListener { showDialog(isICDQueueBtn = false) } binding.shutdownSubscriptionBtn.setOnClickListener { showShutdownSubscriptionDialog() } @@ -183,6 +183,16 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall binding.addListBtn.setOnClickListener { addRequest() } binding.resetBtn.setOnClickListener { resetPath() } binding.writeInvokeresetBtn.setOnClickListener { resetPath() } + binding.icdQueueBtn.setOnCheckedChangeListener { _, isChecked -> + if (isChecked) { + val isSetting = showDialog(isICDQueueBtn = true) + if (!isSetting) { + binding.icdQueueBtn.isChecked = false + } + } else { + resetICDConfig() + } + } addressUpdateFragment = childFragmentManager.findFragmentById(R.id.addressUpdateFragment) as AddressUpdateFragment @@ -202,11 +212,11 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall override fun notifyCheckInMessage() { Log.d(TAG, "notifyCheckInMessage") - if (attributePath.isNotEmpty() || eventPath.isNotEmpty()) { - if (binding.readRadioBtn.isChecked && readICDConfig != null) { - scope.launch { read(readICDConfig!!.isFabricFiltered, readICDConfig!!.eventMin) } - } else if (binding.subscribeRadioBtn.isChecked && subscribeICDConfig != null) { - scope.launch { + scope.launch { + if (attributePath.isNotEmpty() || eventPath.isNotEmpty()) { + if (binding.readRadioBtn.isChecked && readICDConfig != null) { + read(readICDConfig!!.isFabricFiltered, readICDConfig!!.eventMin) + } else if (binding.subscribeRadioBtn.isChecked && subscribeICDConfig != null) { subscribe( subscribeICDConfig!!.minInterval, subscribeICDConfig!!.maxInterval, @@ -215,20 +225,27 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall subscribeICDConfig!!.eventMin ) } - } - } else if ( - binding.writeRadioBtn.isChecked && writePath.isNotEmpty() && writeICDConfig != null - ) { - scope.launch { write(writeICDConfig!!.timedRequestTimeoutMs, writeICDConfig!!.imTimeoutMs) } - } else if ( - binding.invokeRadioBtn.isChecked && invokePath.isNotEmpty() && invokeICDConfig != null - ) { - scope.launch { + } else if ( + binding.writeRadioBtn.isChecked && writePath.isNotEmpty() && writeICDConfig != null + ) { + write(writeICDConfig!!.timedRequestTimeoutMs, writeICDConfig!!.imTimeoutMs) + } else if ( + binding.invokeRadioBtn.isChecked && invokePath.isNotEmpty() && invokeICDConfig != null + ) { invoke(invokeICDConfig!!.timedRequestTimeoutMs, invokeICDConfig!!.imTimeoutMs) } + requireActivity().runOnUiThread { binding.icdQueueBtn.isChecked = false } + resetICDConfig() } } + private fun resetICDConfig() { + readICDConfig = null + subscribeICDConfig = null + writeICDConfig = null + invokeICDConfig = null + } + private fun setVisibilityEachView(radioBtnId: Int) { val readBtnOn = (radioBtnId == R.id.readRadioBtn) val subscribeBtnOn = (radioBtnId == R.id.subscribeRadioBtn) @@ -261,16 +278,20 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall resetPath() } - private fun showDialog() { + private fun showDialog(isICDQueueBtn: Boolean): Boolean { + var ret = false if (binding.readRadioBtn.isChecked) { - showReadDialog() + ret = showReadDialog(isICDQueueBtn) } else if (binding.subscribeRadioBtn.isChecked) { - showSubscribeDialog() + ret = showSubscribeDialog(isICDQueueBtn) } else if (binding.writeRadioBtn.isChecked) { - showWriteDialog() + showWriteDialog(isICDQueueBtn) + ret = true } else if (binding.invokeRadioBtn.isChecked) { - showInvokeDialog() + showInvokeDialog(isICDQueueBtn) + ret = true } + return ret } private fun addRequest() { @@ -547,7 +568,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall ) } - private fun showReadDialog() { + private fun showReadDialog(isICDQueueBtn: Boolean): Boolean { if (attributePath.isEmpty() && eventPath.isEmpty()) { requireActivity().runOnUiThread { Toast.makeText( @@ -557,7 +578,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall ) .show() } - return + return false } val dialogView = requireActivity().layoutInflater.inflate(R.layout.read_dialog, null) val eventMinEd = dialogView.findViewById(R.id.eventMinEd) @@ -576,7 +597,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall if (eventPath.isNotEmpty() && eventMinEd.text.isNotBlank()) { eventMin = eventMinEd.text.toString().toULong().toLong() } - if (addressUpdateFragment.isICDDevice()) { + if (isICDQueueBtn) { readICDConfig = ReadICDConfig(isFabricFilteredEd.selectedItem.toString().toBoolean(), eventMin) } else { @@ -586,9 +607,10 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall } } dialog.show() + return true } - private fun showWriteDialog() { + private fun showWriteDialog(isICDQueueBtn: Boolean) { binding.outputTv.text = "" val dialogView = requireActivity().layoutInflater.inflate(R.layout.write_dialog, null) val dialog = AlertDialog.Builder(requireContext()).apply { setView(dialogView) }.create() @@ -610,7 +632,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall } else { imTimeout.toInt() } - if (addressUpdateFragment.isICDDevice()) { + if (isICDQueueBtn) { writeICDConfig = WriteInvokeICDConfig(timedRequestTimeoutInt, imTimeoutInt) } else { write(timedRequestTimeoutInt, imTimeoutInt) @@ -621,7 +643,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall dialog.show() } - private fun showSubscribeDialog() { + private fun showSubscribeDialog(isICDQueueBtn: Boolean): Boolean { if (attributePath.isEmpty() && eventPath.isEmpty()) { requireActivity().runOnUiThread { Toast.makeText( @@ -631,7 +653,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall ) .show() } - return + return false } val dialogView = requireActivity().layoutInflater.inflate(R.layout.subscribe_dialog, null) val eventMinEd = dialogView.findViewById(R.id.eventMinEd) @@ -654,7 +676,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall if (eventPath.isNotEmpty() && eventMinEd.text.isNotBlank()) { eventMin = eventMinEd.text.toString().toULong().toLong() } - if (addressUpdateFragment.isICDDevice()) { + if (isICDQueueBtn) { subscribeICDConfig = SubscribeICDConfig( minIntervalEd.text.toString().toInt(), @@ -679,9 +701,10 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall } } dialog.show() + return true } - private fun showInvokeDialog() { + private fun showInvokeDialog(isICDQueueBtn: Boolean) { binding.outputTv.text = "" val dialogView = requireActivity().layoutInflater.inflate(R.layout.invoke_dialog, null) val dialog = AlertDialog.Builder(requireContext()).apply { setView(dialogView) }.create() @@ -703,7 +726,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall } else { imTimeout.toInt() } - if (addressUpdateFragment.isICDDevice()) { + if (isICDQueueBtn) { invokeICDConfig = WriteInvokeICDConfig(timedRequestTimeoutInt, imTimeoutInt) } else { invoke(timedRequestTimeoutInt, imTimeoutInt) diff --git a/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml b/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml index 4387724ef847ef..a4837875fcd7e5 100644 --- a/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml +++ b/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml @@ -299,9 +299,23 @@ android:textSize="16sp" android:visibility="gone" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/sendBtn" + app:layout_constraintEnd_toStartOf="@id/writeInvokeresetBtn" app:layout_constraintTop_toBottomOf="@id/addLayout"/> +