From 08af5fae8cae9df68c3e6de6fade65176c1b841b Mon Sep 17 00:00:00 2001 From: tianfeng-yang <130436698+tianfeng-yang@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:19:10 +0800 Subject: [PATCH 01/34] [Linux] Implement BLE cancel connection (#27649) --- src/platform/Linux/BLEManagerImpl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index a25d0eea768d18..07ea5d6170d8c4 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -729,7 +729,12 @@ void BLEManagerImpl::NewConnection(BleLayer * bleLayer, void * appState, const S CHIP_ERROR BLEManagerImpl::CancelConnection() { - return CHIP_ERROR_NOT_IMPLEMENTED; + if (mBLEScanConfig.mBleScanState == BleScanState::kConnecting) + CancelConnect(mpEndpoint); + // If in discovery mode, stop scan. + else if (mBLEScanConfig.mBleScanState != BleScanState::kNotScanning) + mDeviceScanner->StopScan(); + return CHIP_NO_ERROR; } void BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(bool aIsSuccess, void * apAppstate) From c7d9a11dc9369bceb08beb99b0b8c0ac3d1901e7 Mon Sep 17 00:00:00 2001 From: Erwin Pan Date: Mon, 10 Jul 2023 21:04:13 +0800 Subject: [PATCH 02/34] Fix Chef Color Temperature FeatureMap (#27656) * Fix Chef Color Temperature FeatureMap The current Chef color temperature featuremap (0) is incorrect. According to Spec, it should enable CT(or 4th bit) in featuremap * Enable ColorTemperatureMireds's reportable * Fix color temperature matter / zap file reportable * Fix Chef ColorTemperature ColorMode to 2 Chef ColorTemperature's ColorMode / EnhancedColorMode should be 2 (ColorTemperatureMireds) --- ...de_colortemperaturelight_hbUnzYVeyn.matter | 16 +- ...tnode_colortemperaturelight_hbUnzYVeyn.zap | 163 +++++++++++++++++- 2 files changed, 165 insertions(+), 14 deletions(-) diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index 6010d1b74efd4d..1c66700a58d779 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -1677,9 +1677,10 @@ endpoint 1 { server cluster Identify { ram attribute identifyTime default = 0x0; - ram attribute identifyType default = 0x0; + ram attribute identifyType default = 0x00; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -1689,9 +1690,10 @@ endpoint 1 { ram attribute nameSupport; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 3; + ram attribute clusterRevision default = 4; } server cluster OnOff { @@ -1702,6 +1704,7 @@ endpoint 1 { ram attribute startUpOnOff; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -1715,6 +1718,7 @@ endpoint 1 { ram attribute startUpCurrentLevel; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 5; @@ -1727,6 +1731,7 @@ endpoint 1 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1735,7 +1740,7 @@ endpoint 1 { server cluster ColorControl { ram attribute remainingTime default = 0x0000; ram attribute colorTemperatureMireds default = 0x00FA; - ram attribute colorMode default = 0x01; + ram attribute colorMode default = 0x02; ram attribute options default = 0x00; ram attribute numberOfPrimaries; ram attribute primary1X; @@ -1757,7 +1762,7 @@ endpoint 1 { ram attribute primary6Y; ram attribute primary6Intensity; ram attribute enhancedCurrentHue default = 0x0000; - ram attribute enhancedColorMode default = 0x01; + ram attribute enhancedColorMode default = 0x02; ram attribute colorCapabilities default = 0x0000; ram attribute colorTempPhysicalMinMireds default = 0x0000; ram attribute colorTempPhysicalMaxMireds default = 0xFEFF; @@ -1765,8 +1770,9 @@ endpoint 1 { ram attribute startUpColorTemperatureMireds; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 0; + ram attribute featureMap default = 0x0010; ram attribute clusterRevision default = 5; } } diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap index 641763ffe3787b..87ea9747f7b6ce 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap @@ -5493,7 +5493,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0", + "defaultValue": "0x00", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5531,6 +5531,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -5665,7 +5681,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5763,6 +5779,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -5805,7 +5837,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "4", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5905,7 +5937,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "4", + "defaultValue": "5", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6067,6 +6099,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SceneTableSize", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RemainingCapacity", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -6099,6 +6163,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -6141,7 +6221,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "4", + "defaultValue": "5", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6361,6 +6441,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -6783,6 +6879,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -6979,6 +7091,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -7371,7 +7499,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", + "defaultValue": "0x02", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7899,7 +8027,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", + "defaultValue": "0x02", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8097,6 +8225,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -8123,7 +8267,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "0x0010", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8169,5 +8313,6 @@ "endpointVersion": 1, "deviceIdentifier": 268 } - ] + ], + "log": [] } \ No newline at end of file From 9e44efb2bb3b6fabcc01695bb718dc157420a444 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Mon, 10 Jul 2023 12:50:47 -0700 Subject: [PATCH 03/34] [Java] Convert FutureResult and RealResult to kotlin (#27830) * Convert FutureResult and RealResult to kotlin * Restyled by gn --------- Co-authored-by: Restyled.io --- examples/java-matter-controller/BUILD.gn | 20 +---- .../commands/common/FutureResult.java | 68 ----------------- .../commands/common/FutureResult.kt | 75 +++++++++++++++++++ .../commands/common/MatterCommand.kt | 4 +- .../common/{RealResult.java => RealResult.kt} | 36 ++++----- 5 files changed, 96 insertions(+), 107 deletions(-) delete mode 100644 examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.java create mode 100644 examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.kt rename examples/java-matter-controller/java/src/com/matter/controller/commands/common/{RealResult.java => RealResult.kt} (67%) diff --git a/examples/java-matter-controller/BUILD.gn b/examples/java-matter-controller/BUILD.gn index 1c757260213e7c..55e595612f02e4 100644 --- a/examples/java-matter-controller/BUILD.gn +++ b/examples/java-matter-controller/BUILD.gn @@ -18,26 +18,12 @@ import("//build_overrides/chip.gni") import("${chip_root}/build/chip/java/rules.gni") import("${chip_root}/build/chip/tools.gni") -java_library("java") { - output_name = "JavaMatterController.jar" - deps = [ - "${chip_root}/src/controller/java", - "${chip_root}/third_party/java_deps:annotation", - ] - - sources = [ - "java/src/com/matter/controller/commands/common/FutureResult.java", - "java/src/com/matter/controller/commands/common/RealResult.java", - ] - - javac_flags = [ "-Xlint:deprecation" ] -} - kotlin_binary("java-matter-controller") { output_name = "java-matter-controller" deps = [ - ":java", + "${chip_root}/src/controller/java", "${chip_root}/src/controller/java:onboarding_payload", + "${chip_root}/third_party/java_deps:annotation", "${chip_root}/third_party/java_deps:kotlin-stdlib", ] @@ -48,8 +34,10 @@ kotlin_binary("java-matter-controller") { "java/src/com/matter/controller/commands/common/Command.kt", "java/src/com/matter/controller/commands/common/CommandManager.kt", "java/src/com/matter/controller/commands/common/CredentialsIssuer.kt", + "java/src/com/matter/controller/commands/common/FutureResult.kt", "java/src/com/matter/controller/commands/common/IPAddress.kt", "java/src/com/matter/controller/commands/common/MatterCommand.kt", + "java/src/com/matter/controller/commands/common/RealResult.kt", "java/src/com/matter/controller/commands/discover/DiscoverCommand.kt", "java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.kt", "java/src/com/matter/controller/commands/discover/DiscoverCommissionersCommand.kt", diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.java deleted file mode 100644 index 188a0000db9141..00000000000000 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2023 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.controller.commands.common; - -import java.util.Optional; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Implements the future result that encapculates the optional realResult, application would wait - * for realResult set by other thread wben receiving data from the other end. If the expected - * duration elapsed without receiving the expected realResult, the runtime exception would be - * raised. - */ -public class FutureResult { - private Optional realResult = Optional.empty(); - private long timeoutMs = 0; - private static Logger logger = Logger.getLogger(FutureResult.class.getName()); - - public void setTimeoutMs(long timeoutMs) { - this.timeoutMs = timeoutMs; - } - - public synchronized void setRealResult(RealResult realResult) { - if (this.realResult.isPresent()) { - throw new RuntimeException("error, real result has been set!"); - } - this.realResult = Optional.of(realResult); - notifyAll(); - } - - public synchronized void waitResult() { - long start = System.currentTimeMillis(); - while (!realResult.isPresent()) { - try { - if (System.currentTimeMillis() > (start + timeoutMs)) { - throw new RuntimeException("timeout!"); - } - wait(); - } catch (InterruptedException e) { - } - } - if (!realResult.get().getResult()) { - logger.log(Level.INFO, "error: " + realResult.get().getError()); - throw new RuntimeException("received failure test result"); - } - } - - public synchronized void clear() { - realResult = Optional.empty(); - } -} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.kt b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.kt new file mode 100644 index 00000000000000..c7b16bdae2991c --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/FutureResult.kt @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2023 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.controller.commands.common + +import java.util.logging.Level +import java.util.logging.Logger + +/** + * Implements the future result that encapculates the optional realResult, application would wait + * for realResult set by other thread wben receiving data from the other end. If the expected + * duration elapsed without receiving the expected realResult, the runtime exception would be + * raised. + */ +class RealResultException(message: String) : RuntimeException(message) + +class FutureResult { + private var realResult: RealResult? = null + private var timeoutMs: Long = 0 + private val logger = Logger.getLogger(FutureResult::class.java.name) + private val lock = Object() + + fun setTimeoutMs(timeoutMs: Long) { + this.timeoutMs = timeoutMs + } + + fun setRealResult(realResult: RealResult) { + synchronized(lock) { + if (this.realResult != null) { + throw RealResultException("Error, real result has been set!") + } + this.realResult = realResult + lock.notifyAll() + } + } + + fun waitResult() { + val start = System.currentTimeMillis() + synchronized(lock) { + while (realResult == null) { + try { + if (System.currentTimeMillis() > start + timeoutMs) { + throw RealResultException("Timeout!") + } + lock.wait() + } catch (e: InterruptedException) { + logger.log(Level.INFO, "Wait Result failed with exception: " + e.message) + } + } + if (realResult?.getResult() == false) { + logger.log(Level.INFO, "Error: ${realResult?.getError()}") + throw RealResultException("Received failure test result") + } + } + } + + fun clear() { + synchronized(lock) { realResult = null } + } +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.kt b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.kt index 1467c905aed36c..e2b3acf7efa314 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.kt +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.kt @@ -96,11 +96,11 @@ abstract class MatterCommand( protected abstract fun runCommand() fun setSuccess() { - futureResult.setRealResult(RealResult.Success()) + futureResult.setRealResult(RealResult.success()) } fun setFailure(error: String?) { - futureResult.setRealResult(RealResult.Error(error)) + futureResult.setRealResult(RealResult.error(error)) } fun waitCompleteMs(timeoutMs: Long) { diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.kt similarity index 67% rename from examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.java rename to examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.kt index 1b8e5e2e2c6a1f..5cd5d80051efba 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/RealResult.kt @@ -16,7 +16,7 @@ * */ -package com.matter.controller.commands.common; +package com.matter.controller.commands.common /** * Implements a Result where an error string is associated with its failure state. @@ -25,32 +25,26 @@ * contain either a `true` value for `Success` or a `false` value in which case the failure will * also have an error string explaining the reason of the failure associated with it. */ -public class RealResult { - private boolean result; - private String error; +class RealResult(private val result: Boolean, private val error: String?) { + constructor() : this(true, null) - public RealResult() { - this.result = true; - } - - public RealResult(String error) { - this.result = false; - this.error = error; - } + constructor(error: String?) : this(false, error) - public static RealResult Success() { - return new RealResult(); - } + companion object { + fun success(): RealResult { + return RealResult() + } - public static RealResult Error(String error) { - return new RealResult(error); + fun error(error: String?): RealResult { + return RealResult(error) + } } - public boolean getResult() { - return result; + fun getResult(): Boolean { + return result } - public String getError() { - return error; + fun getError(): String? { + return error } } From b1f635657d7d45a78d58bda1b47139a629645fe0 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 10 Jul 2023 16:50:12 -0400 Subject: [PATCH 04/34] Print framework log when framework build fails for darwin-frawework-tool. (#27862) --- scripts/build/build_darwin_framework.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/build/build_darwin_framework.py b/scripts/build/build_darwin_framework.py index edb854d7d173ab..6bd44ec5502128 100644 --- a/scripts/build/build_darwin_framework.py +++ b/scripts/build/build_darwin_framework.py @@ -45,6 +45,15 @@ def run_command(command): with open(args.log_path, "wb") as f: f.write(command_log) + + if returncode != 0: + # command_log is binary, so decoding as utf-8 might technically fail. We don't want + # to throw on that. + try: + print("Failure log: {}".format(command_log.decode())) + except Exception: + pass + return returncode From ac060dc34fc78b726e29eb8e21317fecf1bd218f Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:31:05 -0400 Subject: [PATCH 05/34] ICD manager Implemenation (#27283) * Add Events for ICD (WIP) * Rename SED defines, Add some timer funcionality to Extend a existing timer. Implemented ICDModes and initial operationalState logic WIP * Change SetFastPolling and SetSlowPolling to setPollingInterval with a param. Call is handled by ICD Manager. Replace the sed ifdef by icd for silabs platform WIP * Fix a bunch of dependencies, includes and build issues WIP * Use a init function instead of the constructor, as the attributes value aren't ready * Add a Keep active mechanism for commisisoning window and failsafe * cleanup, add app user wakeup change #ifdef to #if fix missing rename. add // nogncheck on some conditional include Fix some error caught by the ci * Addresses comments + conditional define for tests * SetPollingInterval causes issue for apps that has both thread and wifi. Priority to the thread imp for now. Needs to be reworked * Rebase, It brings updated system Apis, And addresse most of the comments * Stay active when an exchange context expect a response. * Update The message rx handling event naming. Move related ICD events to PublicEventTypes for the time being * #if ICD_SERVER the icd related event posts * Address comments and nits --- .../k32w/k32w0/include/CHIPProjectConfig.h | 4 +- .../light-switch-app/silabs/src/AppTask.cpp | 2 +- examples/lighting-app/silabs/src/AppTask.cpp | 2 +- .../k32w/k32w0/include/CHIPProjectConfig.h | 4 +- examples/lock-app/silabs/src/AppTask.cpp | 2 +- .../silabs/ICDSubscriptionCallback.cpp | 2 +- .../silabs/SiWx917/BaseApplication.cpp | 26 +-- examples/platform/silabs/efr32/BUILD.gn | 3 +- .../platform/silabs/efr32/BaseApplication.cpp | 42 +++-- .../platform/silabs/efr32/matter_config.cpp | 6 +- .../efr32/project_include/OpenThreadConfig.h | 4 +- .../platform/silabs/efr32/rs911x/rsi_if.c | 4 +- .../platform/silabs/efr32/rs911x/wfx_rsi.h | 4 +- .../silabs/efr32/rs911x/wfx_rsi_host.c | 4 +- .../platform/silabs/efr32/wf200/host_if.cpp | 4 +- .../smoke-co-alarm-app/silabs/src/AppTask.cpp | 2 +- examples/thermostat/silabs/src/AppTask.cpp | 2 +- scripts/build/builders/efr32.py | 2 +- scripts/examples/gn_silabs_example.sh | 6 +- src/app/BUILD.gn | 1 + src/app/FailSafeContext.cpp | 13 ++ src/app/icd/BUILD.gn | 18 +- src/app/icd/ICDEventManager.cpp | 69 +++++++- src/app/icd/ICDEventManager.h | 2 +- src/app/icd/ICDManager.cpp | 158 +++++++++++++++++- src/app/icd/ICDManager.h | 55 +++++- src/app/server/CommissioningWindowManager.cpp | 16 +- src/app/server/Dnssd.cpp | 4 +- src/app/server/Server.cpp | 6 +- src/app/server/Server.h | 4 +- src/app/util/IcdMonitoringTable.cpp | 6 + src/app/util/IcdMonitoringTable.h | 6 + src/include/platform/CHIPDeviceConfig.h | 21 +-- src/include/platform/CHIPDeviceEvent.h | 66 +++++++- src/include/platform/ConnectivityManager.h | 11 ++ src/include/platform/ThreadStackManager.h | 12 +- .../GenericConnectivityManagerImpl_Thread.h | 12 ++ .../GenericConnectivityManagerImpl_WiFi.h | 12 ++ src/messaging/BUILD.gn | 5 + src/messaging/ExchangeContext.cpp | 65 ++++++- src/messaging/ReliableMessageMgr.cpp | 10 +- .../ReliableMessageProtocolConfig.cpp | 13 +- src/platform/Linux/ThreadStackManagerImpl.cpp | 8 + src/platform/Linux/ThreadStackManagerImpl.h | 3 + ...GenericThreadStackManagerImpl_OpenThread.h | 3 + ...nericThreadStackManagerImpl_OpenThread.hpp | 59 ++++++- .../nrfconnect/CHIPDevicePlatformConfig.h | 12 +- .../silabs/CHIPDevicePlatformConfig.h | 20 +-- src/platform/silabs/ConnectivityManagerImpl.h | 9 +- .../silabs/ConnectivityManagerImpl_WIFI.cpp | 31 +--- .../silabs/efr32/wifi/wfx_host_events.h | 4 +- .../telink/CHIPDevicePlatformConfig.h | 12 +- third_party/silabs/SiWx917_sdk.gni | 14 +- third_party/silabs/efr32_sdk.gni | 7 +- 54 files changed, 707 insertions(+), 185 deletions(-) diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/contact-sensor-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index 62262725f397f2..71960deda7e3a5 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -191,8 +191,8 @@ #define CHIP_CONFIG_MAX_FABRICS 5 // 5 is the minimum number of supported fabrics #define CHIP_DEVICE_CONFIG_ENABLE_SED 1 -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 1000_ms32 -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL 100_ms32 +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL 1000_ms32 +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL 100_ms32 /** * @def CHIP_IM_MAX_NUM_COMMAND_HANDLER * diff --git a/examples/light-switch-app/silabs/src/AppTask.cpp b/examples/light-switch-app/silabs/src/AppTask.cpp index e64c7da0c220a9..2f8d01275863be 100644 --- a/examples/light-switch-app/silabs/src/AppTask.cpp +++ b/examples/light-switch-app/silabs/src/AppTask.cpp @@ -119,7 +119,7 @@ void AppTask::AppTaskMain(void * pvParameter) appError(err); } -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) sAppTask.StartStatusLEDTimer(); #endif diff --git a/examples/lighting-app/silabs/src/AppTask.cpp b/examples/lighting-app/silabs/src/AppTask.cpp index af6bbdf8af38ea..c3797797644b5b 100644 --- a/examples/lighting-app/silabs/src/AppTask.cpp +++ b/examples/lighting-app/silabs/src/AppTask.cpp @@ -126,7 +126,7 @@ void AppTask::AppTaskMain(void * pvParameter) appError(err); } -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) sAppTask.StartStatusLEDTimer(); #endif diff --git a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index 0ce39a8e498993..a25fa7e12f1498 100644 --- a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -182,8 +182,8 @@ #define CHIP_CONFIG_MAX_FABRICS 5 // 5 is the minimum number of supported fabrics #define CHIP_DEVICE_CONFIG_ENABLE_SED 1 -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 1000_ms32 -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL 100_ms32 +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL 1000_ms32 +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL 100_ms32 /** * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE diff --git a/examples/lock-app/silabs/src/AppTask.cpp b/examples/lock-app/silabs/src/AppTask.cpp index b3c3423079a08d..8afe7d6cc8d9e5 100644 --- a/examples/lock-app/silabs/src/AppTask.cpp +++ b/examples/lock-app/silabs/src/AppTask.cpp @@ -219,7 +219,7 @@ void AppTask::AppTaskMain(void * pvParameter) appError(err); } -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) sAppTask.StartStatusLEDTimer(); #endif diff --git a/examples/platform/silabs/ICDSubscriptionCallback.cpp b/examples/platform/silabs/ICDSubscriptionCallback.cpp index 30fbf683e6e8dc..735246f042af87 100644 --- a/examples/platform/silabs/ICDSubscriptionCallback.cpp +++ b/examples/platform/silabs/ICDSubscriptionCallback.cpp @@ -24,7 +24,7 @@ CHIP_ERROR ICDSubscriptionCallback::OnSubscriptionRequested(chip::app::ReadHandl { using namespace chip::System::Clock; - Seconds32 interval_s32 = std::chrono::duration_cast(CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL); + Seconds32 interval_s32 = std::chrono::duration_cast(CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL); if (interval_s32 > Seconds16::max()) { diff --git a/examples/platform/silabs/SiWx917/BaseApplication.cpp b/examples/platform/silabs/SiWx917/BaseApplication.cpp index 418729236d8340..feab970b95fe5b 100644 --- a/examples/platform/silabs/SiWx917/BaseApplication.cpp +++ b/examples/platform/silabs/SiWx917/BaseApplication.cpp @@ -94,14 +94,14 @@ app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance())); #endif /* SL_WIFI */ -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) bool sIsProvisioned = false; bool sIsEnabled = false; bool sIsAttached = false; bool sHaveBLEConnections = false; -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER uint8_t sAppEventQueueBuffer[APP_EVENT_QUEUE_SIZE * sizeof(AppEvent)]; StaticQueue_t sAppEventQueueStruct; @@ -257,9 +257,9 @@ void BaseApplication::FunctionFactoryReset(void) // Actually trigger Factory Reset mFunction = kFunction_NoneSelected; -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StopStatusLEDTimer(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER chip::Server::GetInstance().ScheduleFactoryReset(); } @@ -314,7 +314,7 @@ bool BaseApplication::ActivateStatusLedPatterns() } #endif // EMBER_AF_PLUGIN_IDENTIFY_SERVER -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) // Identify Patterns have priority over Status patterns if (!isPatternSet) { @@ -340,7 +340,7 @@ bool BaseApplication::ActivateStatusLedPatterns() } isPatternSet = true; } -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER #endif // ENABLE_WSTK_LEDS) && SL_CATALOG_SIMPLE_LED_LED1_PRESENT return isPatternSet; } @@ -352,7 +352,7 @@ void BaseApplication::LightEventHandler() // locked while these values are queried. However we use a non-blocking // lock request (TryLockCHIPStack()) to avoid blocking other UI activities // when the CHIP task is busy (e.g. with a long crypto operation). -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) if (PlatformMgr().TryLockChipStack()) { #ifdef SL_WIFI @@ -368,7 +368,7 @@ void BaseApplication::LightEventHandler() sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); PlatformMgr().UnlockChipStack(); } -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER // Update the status LED if factory reset has not been initiated. // @@ -441,7 +441,7 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) { mFunction = kFunction_NoneSelected; -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StopStatusLEDTimer(); #endif @@ -514,7 +514,7 @@ void BaseApplication::OnIdentifyStart(Identify * identify) { ChipLogProgress(Zcl, "onIdentifyStart"); -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StartStatusLEDTimer(); #endif } @@ -523,7 +523,7 @@ void BaseApplication::OnIdentifyStop(Identify * identify) { ChipLogProgress(Zcl, "onIdentifyStop"); -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StopStatusLEDTimer(); #endif } @@ -533,7 +533,7 @@ void BaseApplication::OnTriggerIdentifyEffectCompleted(chip::System::Layer * sys ChipLogProgress(Zcl, "Trigger Identify Complete"); sIdentifyEffect = Clusters::Identify::EffectIdentifierEnum::kStopEffect; -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StopStatusLEDTimer(); #endif } @@ -547,7 +547,7 @@ void BaseApplication::OnTriggerIdentifyEffect(Identify * identify) ChipLogDetail(AppServer, "Identify Effect Variant unsupported. Using default"); } -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StartStatusLEDTimer(); #endif diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 43c46639bd4522..38d77a45e19498 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -15,6 +15,7 @@ import("//build_overrides/chip.gni") import("//build_overrides/efr32_sdk.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") +import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/lib/lib.gni") import("${chip_root}/src/platform/device.gni") import("${efr32_sdk_build_root}/efr32_sdk.gni") @@ -40,7 +41,7 @@ declare_args() { chip_default_wifi_psk = "" # Use default handler to negotiate subscription max interval - chip_config_use_icd_subscription_callbacks = enable_sleepy_device + chip_config_use_icd_subscription_callbacks = chip_enable_icd_server # Enable TestEventTrigger in GeneralDiagnostics cluster silabs_test_event_trigger_enabled = false diff --git a/examples/platform/silabs/efr32/BaseApplication.cpp b/examples/platform/silabs/efr32/BaseApplication.cpp index 4dc1fc95c81d1b..77a91236554ae5 100644 --- a/examples/platform/silabs/efr32/BaseApplication.cpp +++ b/examples/platform/silabs/efr32/BaseApplication.cpp @@ -107,11 +107,11 @@ app::Clusters::NetworkCommissioning::Instance bool sIsProvisioned = false; -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) bool sIsEnabled = false; bool sIsAttached = false; bool sHaveBLEConnections = false; -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER uint8_t sAppEventQueueBuffer[APP_EVENT_QUEUE_SIZE * sizeof(AppEvent)]; StaticQueue_t sAppEventQueueStruct; @@ -273,9 +273,9 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) // cancel, if required. StartFunctionTimer(FACTORY_RESET_CANCEL_WINDOW_TIMEOUT); -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StartStatusLEDTimer(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER mFunction = kFunction_FactoryReset; @@ -291,9 +291,9 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) // Actually trigger Factory Reset mFunction = kFunction_NoneSelected; -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StopStatusLEDTimer(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER ScheduleFactoryReset(); } @@ -349,7 +349,7 @@ bool BaseApplication::ActivateStatusLedPatterns() } #endif // EMBER_AF_PLUGIN_IDENTIFY_SERVER -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) // Identify Patterns have priority over Status patterns if (!isPatternSet) { @@ -375,7 +375,7 @@ bool BaseApplication::ActivateStatusLedPatterns() } isPatternSet = true; } -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER #endif // ENABLE_WSTK_LEDS) && SL_CATALOG_SIMPLE_LED_LED1_PRESENT return isPatternSet; } @@ -387,7 +387,7 @@ void BaseApplication::LightEventHandler() // locked while these values are queried. However we use a non-blocking // lock request (TryLockCHIPStack()) to avoid blocking other UI activities // when the CHIP task is busy (e.g. with a long crypto operation). -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) if (PlatformMgr().TryLockChipStack()) { #ifdef SL_WIFI @@ -402,7 +402,7 @@ void BaseApplication::LightEventHandler() sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); PlatformMgr().UnlockChipStack(); } -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER #if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) // Update the status LED if factory reset has not been initiated. @@ -472,13 +472,23 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) SILABS_LOG("Failed to open the Basic Commissioning Window"); } } - else { SILABS_LOG("Network is already provisioned, Ble advertissement not enabled"); } + else + { + SILABS_LOG("Network is already provisioned, Ble advertissement not enabled"); + DeviceLayer::ChipDeviceEvent event; + event.Type = DeviceLayer::DeviceEventType::kAppWakeUpEvent; + CHIP_ERROR err = DeviceLayer::PlatformMgr().PostEvent(&event); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to post App wake up Event event %" CHIP_ERROR_FORMAT, err.Format()); + } + } } else if (mFunctionTimerActive && mFunction == kFunction_FactoryReset) { CancelFunctionTimer(); -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StopStatusLEDTimer(); #endif @@ -548,7 +558,7 @@ void BaseApplication::OnIdentifyStart(Identify * identify) { ChipLogProgress(Zcl, "onIdentifyStart"); -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StartStatusLEDTimer(); #endif } @@ -557,7 +567,7 @@ void BaseApplication::OnIdentifyStop(Identify * identify) { ChipLogProgress(Zcl, "onIdentifyStop"); -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StopStatusLEDTimer(); #endif } @@ -567,7 +577,7 @@ void BaseApplication::OnTriggerIdentifyEffectCompleted(chip::System::Layer * sys ChipLogProgress(Zcl, "Trigger Identify Complete"); sIdentifyEffect = Clusters::Identify::EffectIdentifierEnum::kStopEffect; -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StopStatusLEDTimer(); #endif } @@ -581,7 +591,7 @@ void BaseApplication::OnTriggerIdentifyEffect(Identify * identify) ChipLogDetail(AppServer, "Identify Effect Variant unsupported. Using default"); } -#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 +#if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 StartStatusLEDTimer(); #endif diff --git a/examples/platform/silabs/efr32/matter_config.cpp b/examples/platform/silabs/efr32/matter_config.cpp index 88da81bf787f1c..c876abd6eaea1b 100644 --- a/examples/platform/silabs/efr32/matter_config.cpp +++ b/examples/platform/silabs/efr32/matter_config.cpp @@ -100,11 +100,11 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void) #if CHIP_DEVICE_CONFIG_THREAD_FTD ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router)); #else // CHIP_DEVICE_CONFIG_THREAD_FTD -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice)); -#else // CHIP_DEVICE_CONFIG_ENABLE_SED +#else // CHIP_CONFIG_ENABLE_ICD_SERVER ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice)); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER #endif // CHIP_DEVICE_CONFIG_THREAD_FTD SILABS_LOG("Starting OpenThread task"); diff --git a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h index ea67df3ba27829..90ecfcbf712718 100644 --- a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h +++ b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h @@ -36,7 +36,7 @@ // Enable use of external heap allocator (calloc/free) for OpenThread. #define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1 -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER #define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 0 @@ -46,7 +46,7 @@ // Timeout after 2 missed checkin or 4 mins if sleep interval is too short. #define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT ((SL_MLE_TIMEOUT_s < 120) ? 240 : ((SL_MLE_TIMEOUT_s * 2) + 1)) -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER /****Uncomment below section for OpenThread Debug logs*/ // #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index d0d5844448d618..900e07a42ce235 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -184,7 +184,7 @@ int32_t wfx_rsi_disconnect() return status; } -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER /****************************************************************** * @fn wfx_rsi_power_save() * @brief @@ -215,7 +215,7 @@ int32_t wfx_rsi_power_save() SILABS_LOG("Powersave Config Success"); return status; } -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ /****************************************************************** * @fn wfx_rsi_join_cb(uint16_t status, const uint8_t *buf, const uint16_t len) diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi.h b/examples/platform/silabs/efr32/rs911x/wfx_rsi.h index cd18672faf42ba..d793244aa23cca 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi.h +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi.h @@ -90,9 +90,9 @@ int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap); int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); int32_t wfx_rsi_reset_count(); int32_t wfx_rsi_disconnect(); -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER int32_t wfx_rsi_power_save(); -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ #ifdef __cplusplus } diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c index 80368c1b66734b..a448f3a0a45667 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c @@ -193,7 +193,7 @@ sl_status_t wfx_connect_to_ap(void) return SL_STATUS_OK; } -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER /********************************************************************* * @fn sl_status_t wfx_power_save() * @brief @@ -210,7 +210,7 @@ sl_status_t wfx_power_save() } return SL_STATUS_OK; } -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ /********************************************************************* * @fn void wfx_setup_ip6_link_local(sl_wfx_interface_t whichif) diff --git a/examples/platform/silabs/efr32/wf200/host_if.cpp b/examples/platform/silabs/efr32/wf200/host_if.cpp index c48c5754640de4..a8fd053e0c77c7 100644 --- a/examples/platform/silabs/efr32/wf200/host_if.cpp +++ b/examples/platform/silabs/efr32/wf200/host_if.cpp @@ -602,7 +602,7 @@ static void wfx_events_task(void * p_arg) retryJoin = 0; retryInterval = WLAN_MIN_RETRY_TIMER_MS; wfx_lwip_set_sta_link_up(); -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER if (!(wfx_get_wifi_state() & SL_WFX_AP_INTERFACE_UP)) { // Enable the power save @@ -610,7 +610,7 @@ static void wfx_events_task(void * p_arg) sl_wfx_set_power_mode(WFM_PM_MODE_DTIM, WFM_PM_POLL_FAST_PS, BEACON_1); sl_wfx_enable_device_power_save(); } -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ } if (flags & SL_WFX_DISCONNECT) diff --git a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp index 4c5ee14f584d1b..21873ea7488c2c 100644 --- a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp +++ b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp @@ -122,7 +122,7 @@ void AppTask::AppTaskMain(void * pvParameter) appError(err); } -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) sAppTask.StartStatusLEDTimer(); #endif diff --git a/examples/thermostat/silabs/src/AppTask.cpp b/examples/thermostat/silabs/src/AppTask.cpp index 77cd60f279dcf4..22d0bb3010b9ab 100644 --- a/examples/thermostat/silabs/src/AppTask.cpp +++ b/examples/thermostat/silabs/src/AppTask.cpp @@ -123,7 +123,7 @@ void AppTask::AppTaskMain(void * pvParameter) appError(err); } -#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) +#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) sAppTask.StartStatusLEDTimer(); #endif diff --git a/scripts/build/builders/efr32.py b/scripts/build/builders/efr32.py index e0058edc262e2b..0dc85cdf6d5623 100644 --- a/scripts/build/builders/efr32.py +++ b/scripts/build/builders/efr32.py @@ -158,7 +158,7 @@ def __init__(self, self.extra_gn_options.append('chip_enable_ota_requestor=true') if enable_sed: - self.extra_gn_options.append('enable_sleepy_device=true chip_openthread_ftd=false') + self.extra_gn_options.append('chip_enable_icd_server=true chip_openthread_ftd=false') if enable_low_power: self.extra_gn_options.append( diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index 06f6ee57599c23..1f181fc75564af 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -83,8 +83,8 @@ if [ "$#" == "0" ]; then Thresholds: 30 <= kvs_max_entries <= 255 show_qr_code Enables QR code on LCD for devices with an LCD - enable_sleepy_device - Enable Sleepy end device. (Default false) + chip_enable_icd_server + Configure has a Intermitently connected device. (Default false) Must also set chip_openthread_ftd=false use_rs9116 Build wifi example with extension board rs9116. (Default false) @@ -176,7 +176,7 @@ else shift ;; --sed) - optArgs+="enable_sleepy_device=true chip_openthread_ftd=false " + optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false " shift ;; --low-power) diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 30042e6ddfef47..8211d22bf707b7 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -56,6 +56,7 @@ buildconfig_header("app_buildconfig") { "CHIP_CONFIG_ACCESS_CONTROL_POLICY_LOGGING_VERBOSITY=${chip_access_control_policy_logging_verbosity}", "CHIP_CONFIG_PERSIST_SUBSCRIPTIONS=${chip_persist_subscriptions}", "CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE=${enable_eventlist_attribute}", + "CHIP_CONFIG_ENABLE_ICD_SERVER=${chip_enable_icd_server}", ] } diff --git a/src/app/FailSafeContext.cpp b/src/app/FailSafeContext.cpp index 4e802e064c5d9d..d79a36f14f045b 100644 --- a/src/app/FailSafeContext.cpp +++ b/src/app/FailSafeContext.cpp @@ -60,6 +60,19 @@ void FailSafeContext::SetFailSafeArmed(bool armed) DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(armed); } #endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER + if (IsFailSafeArmed() != armed) + { + DeviceLayer::ChipDeviceEvent event; + event.Type = DeviceLayer::DeviceEventType::kFailSafeStateChanged; + event.FailSafeState.armed = armed; + CHIP_ERROR err = DeviceLayer::PlatformMgr().PostEvent(&event); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to post kFailSafeStateChanged event %" CHIP_ERROR_FORMAT, err.Format()); + } + } +#endif mFailSafeArmed = armed; } diff --git a/src/app/icd/BUILD.gn b/src/app/icd/BUILD.gn index 63157175f12e7b..d70f5077b75dea 100644 --- a/src/app/icd/BUILD.gn +++ b/src/app/icd/BUILD.gn @@ -25,13 +25,10 @@ source_set("manager-srcs") { "ICDManager.h", ] - public_deps = [ "${chip_root}/src/lib/core" ] -} - -# ICD Server Configuration -# All configurations necessary to the ICD Server featureset need to in this configuration -config("server-config") { - defines = [ "CHIP_CONFIG_ENABLE_ICD_SERVER" ] + public_deps = [ + "${chip_root}/src/lib/core", + "${chip_root}/src/platform:platform", + ] } # servers-srcs source-set contains all the sources and configurations necessary to build the ICD Server functionality @@ -44,10 +41,5 @@ source_set("server-srcs") { "ICDEventManager.h", ] - public_deps = [ - ":manager-srcs", - "${chip_root}/src/platform:platform", - ] - - public_configs = [ ":server-config" ] + public_deps = [ ":manager-srcs" ] } diff --git a/src/app/icd/ICDEventManager.cpp b/src/app/icd/ICDEventManager.cpp index 827276b81ebcfb..a8e4e11de5fb1b 100644 --- a/src/app/icd/ICDEventManager.cpp +++ b/src/app/icd/ICDEventManager.cpp @@ -22,12 +22,15 @@ using namespace chip::DeviceLayer; namespace chip { namespace app { +uint8_t ICDEventManager::expectedMsgCount = 0; +static_assert(UINT8_MAX >= CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS, + "ICDEventManager::expectedMsgCount cannot hold count for the max exchange count"); + CHIP_ERROR ICDEventManager::Init(ICDManager * icdManager) { VerifyOrReturnError(icdManager != nullptr, CHIP_ERROR_INVALID_ARGUMENT); mICDManager = icdManager; - - PlatformMgr().AddEventHandler(ICDEventHandler, reinterpret_cast(nullptr)); + PlatformMgr().AddEventHandler(ICDEventHandler, reinterpret_cast(mICDManager)); return CHIP_NO_ERROR; } @@ -42,8 +45,66 @@ CHIP_ERROR ICDEventManager::Shutdown() void ICDEventManager::ICDEventHandler(const ChipDeviceEvent * event, intptr_t arg) { - // TODO -} + ICDManager * icdManager = reinterpret_cast(arg); + + if (icdManager == nullptr) + { + return; + } + switch (event->Type) + { + case DeviceEventType::kCommissioningWindowStatusChanged: + icdManager->SetKeepActiveModeRequirements(ICDManager::KeepActiveFlags::kCommissioningWindowOpen, + event->CommissioningWindowStatus.open); + break; + case DeviceEventType::kFailSafeStateChanged: + icdManager->SetKeepActiveModeRequirements(ICDManager::KeepActiveFlags::kFailSafeArmed, event->FailSafeState.armed); + break; + case DeviceEventType::kChipMsgSentEvent: + + // When we expect a response to a message sent, We keep the ICD in active mode until it is received + // Otherwise, just a kick off an active mode interval/active mode threshold + if (event->MessageSent.ExpectResponse) + { + expectedMsgCount++; + icdManager->SetKeepActiveModeRequirements(ICDManager::KeepActiveFlags::kExpectingMsgResponse, true); + } + else + { + icdManager->UpdateOperationState(ICDManager::OperationalState::ActiveMode); + } + break; + case DeviceEventType::kChipMsgRxEventHandled: + if (event->RxEventContext.clearsExpectedResponse) + { + if (expectedMsgCount > 0) + { + expectedMsgCount--; + } + else + { + // Should we assert? + ChipLogError(DeviceLayer, "No response was expected by the ICD Manager"); + } + + if (expectedMsgCount == 0) + { + icdManager->SetKeepActiveModeRequirements(ICDManager::KeepActiveFlags::kExpectingMsgResponse, false); + } + } + else if (event->RxEventContext.wasReceived) + { + icdManager->UpdateOperationState(ICDManager::OperationalState::ActiveMode); + } + + break; + case DeviceEventType::kAppWakeUpEvent: + icdManager->UpdateOperationState(ICDManager::OperationalState::ActiveMode); + break; + default: + break; + } +} } // namespace app } // namespace chip diff --git a/src/app/icd/ICDEventManager.h b/src/app/icd/ICDEventManager.h index c6a305d24d57a9..fffbbb8dc334fb 100644 --- a/src/app/icd/ICDEventManager.h +++ b/src/app/icd/ICDEventManager.h @@ -47,7 +47,7 @@ class ICDEventManager * Function dispatchs the event to the ICDManager member */ static void ICDEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); - + static uint8_t expectedMsgCount; ICDManager * mICDManager; }; diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index a71ca14457c546..297daa59d2fbf3 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -15,12 +15,168 @@ * limitations under the License. */ +#include +#include +#include #include +#include +#include +#include +#include +#include namespace chip { namespace app { -ICDManager::ICDManager() {} +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::IcdManagement; +void ICDManager::ICDManager::Init() +{ + uint32_t activeModeInterval; + if (Attributes::ActiveModeInterval::Get(kRootEndpointId, &activeModeInterval) != EMBER_ZCL_STATUS_SUCCESS) + { + activeModeInterval = kMinActiveModeInterval; + } + VerifyOrDie(kFastPollingInterval.count() < activeModeInterval); + UpdateIcdMode(); + UpdateOperationState(OperationalState::ActiveMode); +} + +void ICDManager::ICDManager::Shutdown() +{ + // cancel any running timer of the icd + DeviceLayer::SystemLayer().CancelTimer(OnIdleModeDone, this); + DeviceLayer::SystemLayer().CancelTimer(OnActiveModeDone, this); + mIcdMode = ICDMode::SIT; + mOperationalState = OperationalState::IdleMode; +} + +bool ICDManager::SupportsCheckInProtocol() +{ + bool success; + uint32_t featureMap; + success = (Attributes::FeatureMap::Get(kRootEndpointId, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + + return success ? ((featureMap & to_underlying(Feature::kCheckInProtocolSupport)) != 0) : false; +} + +void ICDManager::UpdateIcdMode() +{ + assertChipStackLockedByCurrentThread(); + + ICDMode tempMode = ICDMode::SIT; + + // TODO ICD LIT FIX DEPENDENCY ISSUE with app/util/IcdMonitoringTable.h and app/server:server + // The Check In Protocol Feature is required and the slow polling interval shall also be greater than 15 seconds + // to run an ICD in LIT mode. + // if (kSlowPollingInterval > kICDSitModePollingThreashold && SupportsCheckInProtocol()) + // { + // // We can only get to LIT Mode, if at least one client is registered to the ICD device + // const auto & fabricTable = Server::GetInstance().GetFabricTable(); + // for (const auto & fabricInfo : fabricTable) + // { + // PersistentStorageDelegate & storage = Server::GetInstance().GetPersistentStorage(); + // IcdMonitoringTable table(storage, fabricInfo.GetFabricIndex(), 1); + // if (!table.IsEmpty()) + // { + // tempMode = ICDMode::LIT; + // break; + // } + // } + // } + mIcdMode = tempMode; +} + +void ICDManager::UpdateOperationState(OperationalState state) +{ + assertChipStackLockedByCurrentThread(); + // Active mode can be re-triggered. + VerifyOrReturn(mOperationalState != state || state == OperationalState::ActiveMode); + + if (state == OperationalState::IdleMode) + { + mOperationalState = OperationalState::IdleMode; + uint32_t idleModeInterval = 0; + if (Attributes::IdleModeInterval::Get(kRootEndpointId, &idleModeInterval) != EMBER_ZCL_STATUS_SUCCESS) + { + idleModeInterval = kMinIdleModeInterval; + } + DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(idleModeInterval), OnIdleModeDone, this); + + CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(GetSlowPollingInterval()); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to set Polling Interval: err %" CHIP_ERROR_FORMAT, err.Format()); + } + } + else if (state == OperationalState::ActiveMode) + { + if (mOperationalState == OperationalState::IdleMode) + { + // An event could have brought us to the active mode. + // Make sure the idle mode timer is stopped + DeviceLayer::SystemLayer().CancelTimer(OnIdleModeDone, this); + + mOperationalState = OperationalState::ActiveMode; + uint32_t activeModeInterval = 0; + if (Attributes::ActiveModeInterval::Get(kRootEndpointId, &activeModeInterval) != EMBER_ZCL_STATUS_SUCCESS) + { + activeModeInterval = kMinActiveModeInterval; + } + DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(activeModeInterval), OnActiveModeDone, this); + + CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(GetFastPollingInterval()); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to set Polling Interval: err %" CHIP_ERROR_FORMAT, err.Format()); + } + } + else + { + uint16_t activeModeThreshold = 0; + if (Attributes::ActiveModeThreshold::Get(kRootEndpointId, &activeModeThreshold) != EMBER_ZCL_STATUS_SUCCESS) + { + activeModeThreshold = kMinActiveModeThreshold; + } + DeviceLayer::SystemLayer().ExtendTimerTo(System::Clock::Timeout(activeModeThreshold), OnActiveModeDone, this); + } + } +} + +void ICDManager::SetKeepActiveModeRequirements(KeepActiveFlags flag, bool state) +{ + assertChipStackLockedByCurrentThread(); + + mKeepActiveFlags.Set(flag, state); + if (mOperationalState == OperationalState::IdleMode && mKeepActiveFlags.HasAny()) + { + UpdateOperationState(OperationalState::ActiveMode); + } + else if (mOperationalState == OperationalState::ActiveMode && !mKeepActiveFlags.HasAny() && + !DeviceLayer::SystemLayer().IsTimerActive(OnActiveModeDone, this)) + { + // The normal active period had ended and nothing else requires the system to be active. + UpdateOperationState(OperationalState::IdleMode); + } +} + +void ICDManager::OnIdleModeDone(System::Layer * aLayer, void * appState) +{ + ICDManager * pIcdManager = reinterpret_cast(appState); + pIcdManager->UpdateOperationState(OperationalState::ActiveMode); +} + +void ICDManager::OnActiveModeDone(System::Layer * aLayer, void * appState) +{ + ICDManager * pIcdManager = reinterpret_cast(appState); + + // Don't go to idle mode when we have a keep active requirement + if (!pIcdManager->mKeepActiveFlags.HasAny()) + { + pIcdManager->UpdateOperationState(OperationalState::IdleMode); + } +} } // namespace app } // namespace chip diff --git a/src/app/icd/ICDManager.h b/src/app/icd/ICDManager.h index 8c8e55916c3fa8..b7edf325f767b8 100644 --- a/src/app/icd/ICDManager.h +++ b/src/app/icd/ICDManager.h @@ -16,6 +16,11 @@ */ #pragma once +#include +#include +#include +#include + namespace chip { namespace app { @@ -25,9 +30,57 @@ namespace app { class ICDManager { public: - ICDManager(); + enum class OperationalState : uint8_t + { + IdleMode, + ActiveMode, + }; + + enum class ICDMode : uint8_t + { + SIT, // Short Interval Time ICD + LIT, // Long Interval Time ICD + }; + + enum class KeepActiveFlags : uint8_t + { + kCommissioningWindowOpen = 0x01, + kFailSafeArmed = 0x02, + kExpectingMsgResponse = 0x03, + }; + + ICDManager() {} + void Init(); + void Shutdown(); + void UpdateIcdMode(); + void UpdateOperationState(OperationalState state); + void SetKeepActiveModeRequirements(KeepActiveFlags flag, bool state); + bool IsKeepActive() { return mKeepActiveFlags.HasAny(); } + ICDMode GetIcdMode() { return mIcdMode; } + OperationalState GetOperationalState() { return mOperationalState; } + + static System::Clock::Milliseconds32 GetSlowPollingInterval() { return kSlowPollingInterval; } + static System::Clock::Milliseconds32 GetFastPollingInterval() { return kFastPollingInterval; } + +protected: + static void OnIdleModeDone(System::Layer * aLayer, void * appState); + static void OnActiveModeDone(System::Layer * aLayer, void * appState); private: + static constexpr System::Clock::Milliseconds32 kICDSitModePollingThreashold = System::Clock::Milliseconds32(15000); + static constexpr System::Clock::Milliseconds32 kSlowPollingInterval = CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL; + static constexpr System::Clock::Milliseconds32 kFastPollingInterval = CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL; + + // Minimal constraint value of the the ICD attributes. + static constexpr uint32_t kMinIdleModeInterval = 500; + static constexpr uint32_t kMinActiveModeInterval = 300; + static constexpr uint16_t kMinActiveModeThreshold = 300; + + bool SupportsCheckInProtocol(); + + BitFlags mKeepActiveFlags{ 0 }; + OperationalState mOperationalState = OperationalState::IdleMode; + ICDMode mIcdMode = ICDMode::SIT; }; } // namespace app diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 0b06dc6c070101..ea5ab150556bf1 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -564,7 +564,21 @@ void CommissioningWindowManager::ExpireFailSafeIfArmed() void CommissioningWindowManager::UpdateWindowStatus(CommissioningWindowStatusEnum aNewStatus) { CommissioningWindowStatusEnum oldClusterStatus = CommissioningWindowStatusForCluster(); - mWindowStatus = aNewStatus; + if (mWindowStatus != aNewStatus) + { + mWindowStatus = aNewStatus; +#if CHIP_CONFIG_ENABLE_ICD_SERVER + DeviceLayer::ChipDeviceEvent event; + event.Type = DeviceLayer::DeviceEventType::kCommissioningWindowStatusChanged; + event.CommissioningWindowStatus.open = (mWindowStatus != CommissioningWindowStatusEnum::kWindowNotOpen); + CHIP_ERROR err = DeviceLayer::PlatformMgr().PostEvent(&event); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to post kCommissioningWindowStatusChanged event %" CHIP_ERROR_FORMAT, err.Format()); + } +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER + } + if (CommissioningWindowStatusForCluster() != oldClusterStatus) { // The Administrator Commissioning cluster is always on the root endpoint. diff --git a/src/app/server/Dnssd.cpp b/src/app/server/Dnssd.cpp index b2bb1eca1075d9..17c9b4a459af9e 100644 --- a/src/app/server/Dnssd.cpp +++ b/src/app/server/Dnssd.cpp @@ -50,8 +50,8 @@ void OnPlatformEvent(const DeviceLayer::ChipDeviceEvent * event) { case DeviceLayer::DeviceEventType::kDnssdInitialized: case DeviceLayer::DeviceEventType::kDnssdRestartNeeded: -#if CHIP_DEVICE_CONFIG_ENABLE_SED - case DeviceLayer::DeviceEventType::kSEDIntervalChange: +#if CHIP_CONFIG_ENABLE_ICD_SERVER + case DeviceLayer::DeviceEventType::kICDPollingIntervalChange: #endif app::DnssdServer::Instance().StartServer(); break; diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 5eff5ea0be7344..948be1e4fe6cb3 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -248,7 +248,8 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) } #endif // CHIP_CONFIG_ENABLE_SERVER_IM_EVENT -#ifdef CHIP_CONFIG_ENABLE_ICD_SERVER +#if CHIP_CONFIG_ENABLE_ICD_SERVER + mICDManager.Init(); mICDEventManager.Init(&mICDManager); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER @@ -489,8 +490,9 @@ void Server::Shutdown() mAccessControl.Finish(); Access::ResetAccessControlToDefault(); Credentials::SetGroupDataProvider(nullptr); -#ifdef CHIP_CONFIG_ENABLE_ICD_SERVER +#if CHIP_CONFIG_ENABLE_ICD_SERVER mICDEventManager.Shutdown(); + mICDManager.Shutdown(); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER mAttributePersister.Shutdown(); // TODO(16969): Remove chip::Platform::MemoryInit() call from Server class, it belongs to outer code diff --git a/src/app/server/Server.h b/src/app/server/Server.h index d2cdaacb7f48ea..9c4a3ee499dca3 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -65,7 +65,7 @@ #endif #include -#ifdef CHIP_CONFIG_ENABLE_ICD_SERVER +#if CHIP_CONFIG_ENABLE_ICD_SERVER #include // nogncheck #include // nogncheck #endif @@ -600,7 +600,7 @@ class Server Inet::InterfaceId mInterfaceId; System::Clock::Microseconds64 mInitTimestamp; -#ifdef CHIP_CONFIG_ENABLE_ICD_SERVER +#if CHIP_CONFIG_ENABLE_ICD_SERVER app::ICDEventManager mICDEventManager; app::ICDManager mICDManager; #endif // CHIP_CONFIG_ENABLE_ICD_SERVER diff --git a/src/app/util/IcdMonitoringTable.cpp b/src/app/util/IcdMonitoringTable.cpp index 2f208812db74f2..e861e78c2cbf2d 100644 --- a/src/app/util/IcdMonitoringTable.cpp +++ b/src/app/util/IcdMonitoringTable.cpp @@ -103,6 +103,12 @@ CHIP_ERROR IcdMonitoringTable::RemoveAll() return CHIP_NO_ERROR; } +bool IcdMonitoringTable::IsEmpty() +{ + IcdMonitoringEntry entry(this->mFabric); + return (this->Get(0, entry) == CHIP_ERROR_NOT_FOUND); +} + uint16_t IcdMonitoringTable::Limit() const { return mLimit; diff --git a/src/app/util/IcdMonitoringTable.h b/src/app/util/IcdMonitoringTable.h index b488d515759df8..a3a144937b4b04 100644 --- a/src/app/util/IcdMonitoringTable.h +++ b/src/app/util/IcdMonitoringTable.h @@ -110,6 +110,12 @@ struct IcdMonitoringTable */ CHIP_ERROR RemoveAll(); + /** + * @brief Check if the table is empty + * @return True when there is no entry in the table. False if there is at least one + */ + bool IsEmpty(); + /** * @return Maximum number of entries allowed in the RegisteredClients table. */ diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index a3512e8f944925..f9c963da7eddda 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -137,32 +137,23 @@ #endif /** - * CHIP_DEVICE_CONFIG_ENABLE_SED - * - * Enable support for sleepy end device behavior. - */ -#ifndef CHIP_DEVICE_CONFIG_ENABLE_SED -#define CHIP_DEVICE_CONFIG_ENABLE_SED 0 -#endif - -/** - * CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL + * CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL * * The default amount of time in milliseconds that the sleepy end device will use as an idle interval. * This interval is used by the device to periodically wake up and poll the data in the idle mode. */ -#ifndef CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 5000_ms32 +#ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL System::Clock::Milliseconds32(5000) #endif /** - * CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL + * CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL * * The default amount of time in milliseconds that the sleepy end device will use as an active interval. * This interval is used by the device to periodically wake up and poll the data in the active mode. */ -#ifndef CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL 200_ms32 +#ifndef CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL System::Clock::Milliseconds32(200) #endif /** diff --git a/src/include/platform/CHIPDeviceEvent.h b/src/include/platform/CHIPDeviceEvent.h index 2ca528f2cd0924..47f32fc1346d39 100644 --- a/src/include/platform/CHIPDeviceEvent.h +++ b/src/include/platform/CHIPDeviceEvent.h @@ -152,7 +152,7 @@ enum PublicEventTypes * * Signals a change to the sleepy end device interval. */ - kSEDIntervalChange, + kICDPollingIntervalChange, /** * CHIPoBLE Connection Established @@ -195,6 +195,11 @@ enum PublicEventTypes */ kInterfaceIpAddressChanged, + /** + * Signals that the commissioning window has opened or closed. + */ + kCommissioningWindowStatusChanged, + /** * Commissioning has completed by a call to the general commissioning cluster command. */ @@ -206,6 +211,11 @@ enum PublicEventTypes */ kFailSafeTimerExpired, + /** + * Signals that the fail-safe state changed (Armed/Disarmed) + */ + kFailSafeStateChanged, + /** * */ @@ -239,6 +249,35 @@ enum PublicEventTypes * sending messages to other nodes. */ kServerReady, + + /** + * TODO ICD: kChipMsgSentEvent and kChipMsgRxEventHandled should be InternalEventTypes. + * However the ICD manager leverages those events and its event handler is registered as an application + * event handler. + * ICDEventManager will have to expose 'ICDEventHandler' publicly to 'DispatchEventToDeviceLayer'. + */ + + /** + * An Exchange Context sent a message. + * This event contains a with MessageSent structure. + */ + kChipMsgSentEvent, + + /** + * An Exchange Context that was waiting for a response is no longer waiting for it. + * This event can occur due to any of the following: + * - A response message was received. + * - An exchange context timed out waiting for a response. + * - The exchange context was closed while a response was expected. + * + * This event contains an RxEventContext structure. + */ + kChipMsgRxEventHandled, + + /** + * An application event occured that should wake up the system/device + */ + kAppWakeUpEvent, }; /** @@ -506,6 +545,16 @@ struct ChipDeviceEvent final bool updateNocCommandHasBeenInvoked; } FailSafeTimerExpired; + struct + { + bool armed; + } FailSafeState; + + struct + { + bool open; + } CommissioningWindowStatus; + struct { // TODO(cecille): This should just specify wifi or thread since we assume at most 1. @@ -516,6 +565,21 @@ struct ChipDeviceEvent final { OtaState newState; } OtaStateChanged; + + struct + { + bool ExpectResponse; + } MessageSent; + + struct + { + /* + * wasReceived is only true when the event was triggered by a response message reception. + * See the brief of kChipMsgRxEventHandled, above in this file, for additional details. + */ + bool wasReceived; + bool clearsExpectedResponse; + } RxEventContext; }; void Clear() { memset(this, 0, sizeof(*this)); } diff --git a/src/include/platform/ConnectivityManager.h b/src/include/platform/ConnectivityManager.h index fa104a68e0f6b3..79eaa37423542a 100755 --- a/src/include/platform/ConnectivityManager.h +++ b/src/include/platform/ConnectivityManager.h @@ -226,6 +226,8 @@ class ConnectivityManager CHIP_ERROR RequestSEDActiveMode(bool onOff, bool delayIdle = false); #endif + CHIP_ERROR SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); + // CHIPoBLE service methods Ble::BleLayer * GetBleLayer(); bool IsBLEAdvertisingEnabled(); @@ -485,6 +487,15 @@ inline CHIP_ERROR ConnectivityManager::RequestSEDActiveMode(bool onOff, bool del } #endif +inline CHIP_ERROR ConnectivityManager::SetPollingInterval(System::Clock::Milliseconds32 pollingInterval) +{ +#if CHIP_CONFIG_ENABLE_ICD_SERVER + return static_cast(this)->_SetPollingInterval(pollingInterval); +#else + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +#endif +} + inline bool ConnectivityManager::IsThreadAttached() { return static_cast(this)->_IsThreadAttached(); diff --git a/src/include/platform/ThreadStackManager.h b/src/include/platform/ThreadStackManager.h index b3fc19dc5454e3..3f72378e285653 100755 --- a/src/include/platform/ThreadStackManager.h +++ b/src/include/platform/ThreadStackManager.h @@ -168,7 +168,7 @@ class ThreadStackManager CHIP_ERROR GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig); /** - * Sets Sleepy End Device intervals configuration and posts kSEDIntervalChange event to inform other software + * Sets Sleepy End Device intervals configuration and posts kICDPollingIntervalChange event to inform other software * modules about the change. * * @param[in] intervalsConfig intervals configuration to be set @@ -184,6 +184,9 @@ class ThreadStackManager */ CHIP_ERROR RequestSEDActiveMode(bool onOff, bool delayIdle = false); #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER + CHIP_ERROR SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); +#endif bool HaveMeshConnectivity(); @@ -408,6 +411,13 @@ inline CHIP_ERROR ThreadStackManager::RequestSEDActiveMode(bool onOff, bool dela } #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER +inline CHIP_ERROR ThreadStackManager::SetPollingInterval(System::Clock::Milliseconds32 pollingInterval) +{ + return static_cast(this)->_SetPollingInterval(pollingInterval); +} +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER + inline bool ThreadStackManager::HaveMeshConnectivity() { return static_cast(this)->_HaveMeshConnectivity(); diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h index 4e0d8ddd349874..0f8b568d0393dd 100755 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h @@ -68,6 +68,9 @@ class GenericConnectivityManagerImpl_Thread CHIP_ERROR _SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig); CHIP_ERROR _RequestSEDActiveMode(bool onOff, bool delayIdle = false); #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER + CHIP_ERROR _SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ bool _IsThreadAttached(); bool _IsThreadProvisioned(); void _ErasePersistentInfo(); @@ -163,6 +166,15 @@ inline CHIP_ERROR GenericConnectivityManagerImpl_Thread::_RequestSEDA } #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER +template +inline CHIP_ERROR +GenericConnectivityManagerImpl_Thread::_SetPollingInterval(System::Clock::Milliseconds32 pollingInterval) +{ + return ThreadStackMgrImpl().SetPollingInterval(pollingInterval); +} +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER + template inline void GenericConnectivityManagerImpl_Thread::_ResetThreadNetworkDiagnosticsCounts() { diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h b/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h index 1de4a57ea3b168..61c2db51954c8e 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h @@ -76,6 +76,10 @@ class GenericConnectivityManagerImpl_WiFi bool _CanStartWiFiScan(); void _OnWiFiScanDone(); void _OnWiFiStationProvisionChange(); +// TODO ICD rework: ambiguous declaration of _SetPollingInterval when thread and wifi are both build together +#if CHIP_CONFIG_ENABLE_ICD_SERVER && !CHIP_DEVICE_CONFIG_ENABLE_THREAD + CHIP_ERROR _SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); +#endif static const char * _WiFiStationModeToStr(ConnectivityManager::WiFiStationMode mode); static const char * _WiFiAPModeToStr(ConnectivityManager::WiFiAPMode mode); static const char * _WiFiStationStateToStr(ConnectivityManager::WiFiStationState state); @@ -181,6 +185,14 @@ template inline void GenericConnectivityManagerImpl_WiFi::_OnWiFiStationProvisionChange() {} +#if CHIP_CONFIG_ENABLE_ICD_SERVER && !CHIP_DEVICE_CONFIG_ENABLE_THREAD +template +inline CHIP_ERROR GenericConnectivityManagerImpl_WiFi::_SetPollingInterval(System::Clock::Milliseconds32 pollingInterval) +{ + return CHIP_ERROR_NOT_IMPLEMENTED; +} +#endif + } // namespace Internal } // namespace DeviceLayer } // namespace chip diff --git a/src/messaging/BUILD.gn b/src/messaging/BUILD.gn index bf363c7239db71..d5e51fc0f61056 100644 --- a/src/messaging/BUILD.gn +++ b/src/messaging/BUILD.gn @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("${chip_root}/src/app/icd/icd.gni") declare_args() { # Allows to change time between retries during the case session @@ -74,4 +75,8 @@ static_library("messaging") { "${chip_root}/src/transport", "${chip_root}/src/transport/raw", ] + + if (chip_enable_icd_server) { + public_deps += [ "${chip_root}/src/app/icd:server-srcs" ] + } } diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index 05d2b5fc026bec..cac98cd95017f0 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -238,15 +238,28 @@ CHIP_ERROR ExchangeContext::SendMessage(Protocols::Id protocolId, uint8_t msgTyp session->AsSecureSession()->MarkAsDefunct(); } } - - // Standalone acks are not application-level message sends. - if (!isStandaloneAck && err == CHIP_NO_ERROR) + else { - // - // Once we've sent the message successfully, we can clear out the WillSendMessage flag. - // - mFlags.Clear(Flags::kFlagWillSendMessage); - MessageHandled(); +#if CONFIG_DEVICE_LAYER && CHIP_CONFIG_ENABLE_ICD_SERVER + DeviceLayer::ChipDeviceEvent event; + event.Type = DeviceLayer::DeviceEventType::kChipMsgSentEvent; + event.MessageSent.ExpectResponse = IsResponseExpected(); + CHIP_ERROR status = DeviceLayer::PlatformMgr().PostEvent(&event); + if (status != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to post Message sent event %" CHIP_ERROR_FORMAT, status.Format()); + } +#endif // CONFIG_DEVICE_LAYER + + // Standalone acks are not application-level message sends. + if (!isStandaloneAck) + { + // + // Once we've sent the message successfully, we can clear out the WillSendMessage flag. + // + mFlags.Clear(Flags::kFlagWillSendMessage); + MessageHandled(); + } } return err; @@ -286,6 +299,18 @@ void ExchangeContext::DoClose(bool clearRetransTable) { // Cancel the response timer. CancelResponseTimer(); +#if CONFIG_DEVICE_LAYER && CHIP_CONFIG_ENABLE_ICD_SERVER + DeviceLayer::ChipDeviceEvent event; + event.Type = DeviceLayer::DeviceEventType::kChipMsgRxEventHandled; + event.RxEventContext.wasReceived = false; + event.RxEventContext.clearsExpectedResponse = true; + CHIP_ERROR status = DeviceLayer::PlatformMgr().PostEvent(&event); + if (status != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to post Msg Handled event at ExchangeContext closure %" CHIP_ERROR_FORMAT, + status.Format()); + } +#endif // CONFIG_DEVICE_LAYER && CHIP_CONFIG_ENABLE_ICD_SERVER } } @@ -496,6 +521,18 @@ void ExchangeContext::HandleResponseTimeout(System::Layer * aSystemLayer, void * void ExchangeContext::NotifyResponseTimeout(bool aCloseIfNeeded) { +#if CONFIG_DEVICE_LAYER && CHIP_CONFIG_ENABLE_ICD_SERVER + DeviceLayer::ChipDeviceEvent event; + event.Type = DeviceLayer::DeviceEventType::kChipMsgRxEventHandled; + event.RxEventContext.wasReceived = false; + event.RxEventContext.clearsExpectedResponse = true; + CHIP_ERROR status = DeviceLayer::PlatformMgr().PostEvent(&event); + if (status != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to post Message Response Timeout event %" CHIP_ERROR_FORMAT, status.Format()); + } +#endif // CONFIG_DEVICE_LAYER && CHIP_CONFIG_ENABLE_ICD_SERVER + SetResponseExpected(false); // Hold a ref to ourselves so we can make calls into our delegate that might @@ -608,6 +645,18 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload return CHIP_ERROR_INCORRECT_STATE; } +#if CONFIG_DEVICE_LAYER && CHIP_CONFIG_ENABLE_ICD_SERVER + DeviceLayer::ChipDeviceEvent event; + event.Type = DeviceLayer::DeviceEventType::kChipMsgRxEventHandled; + event.RxEventContext.wasReceived = true; + event.RxEventContext.clearsExpectedResponse = IsResponseExpected(); + CHIP_ERROR status = DeviceLayer::PlatformMgr().PostEvent(&event); + if (status != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to post Message received event %" CHIP_ERROR_FORMAT, status.Format()); + } +#endif // CONFIG_DEVICE_LAYER && CHIP_CONFIG_ENABLE_ICD_SERVER + if (IsResponseExpected()) { // Since we got the response, cancel the response timer. diff --git a/src/messaging/ReliableMessageMgr.cpp b/src/messaging/ReliableMessageMgr.cpp index 8a9e88d426b41f..a556aaa18be778 100644 --- a/src/messaging/ReliableMessageMgr.cpp +++ b/src/messaging/ReliableMessageMgr.cpp @@ -37,6 +37,10 @@ #include #include +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#include // nogncheck +#endif + using namespace chip::System::Clock::Literals; namespace chip { @@ -249,10 +253,12 @@ System::Clock::Timestamp ReliableMessageMgr::GetBackoff(System::Clock::Timestamp uint32_t jitter = MRP_BACKOFF_JITTER_BASE + (computeMaxPossible ? UINT8_MAX : Crypto::GetRandU8()); mrpBackoffTime = mrpBackoffTime * jitter / MRP_BACKOFF_JITTER_BASE; -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER // Implement: - // "A sleepy sender SHOULD increase t to also account for its own sleepy interval + // "An ICD sender SHOULD increase t to also account for its own sleepy interval // required to receive the acknowledgment" + mrpBackoffTime += app::ICDManager::GetFastPollingInterval(); +#elif CHIP_DEVICE_CONFIG_ENABLE_SED DeviceLayer::ConnectivityManager::SEDIntervalsConfig sedIntervals; if (DeviceLayer::ConnectivityMgr().GetSEDIntervalsConfig(sedIntervals) == CHIP_NO_ERROR) diff --git a/src/messaging/ReliableMessageProtocolConfig.cpp b/src/messaging/ReliableMessageProtocolConfig.cpp index a0ff8ab64ceec1..442d1ee81d4596 100644 --- a/src/messaging/ReliableMessageProtocolConfig.cpp +++ b/src/messaging/ReliableMessageProtocolConfig.cpp @@ -27,6 +27,10 @@ #include #include +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#include // nogncheck +#endif + namespace chip { using namespace System::Clock::Literals; @@ -59,8 +63,13 @@ ReliableMessageProtocolConfig GetDefaultMRPConfig() Optional GetLocalMRPConfig() { ReliableMessageProtocolConfig config(CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL, CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL); - -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER + // TODO ICD LIT shall not advertise the SII key + // Increase local MRP retry intervals by ICD polling intervals. That is, intervals for + // which the device can be at sleep and not be able to receive any messages). + config.mIdleRetransTimeout += app::ICDManager::GetSlowPollingInterval(); + config.mActiveRetransTimeout += app::ICDManager::GetFastPollingInterval(); +#elif CHIP_DEVICE_CONFIG_ENABLE_SED DeviceLayer::ConnectivityManager::SEDIntervalsConfig sedIntervalsConfig; if (DeviceLayer::ConnectivityMgr().GetSEDIntervalsConfig(sedIntervalsConfig) == CHIP_NO_ERROR) diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index b59e0602edb63b..8e27a9fece2b0f 100755 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -546,6 +546,14 @@ CHIP_ERROR ThreadStackManagerImpl::_RequestSEDActiveMode(bool onOff, bool delayI return CHIP_ERROR_NOT_IMPLEMENTED; } #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER +CHIP_ERROR ThreadStackManagerImpl::_SetPollingInterval(System::Clock::Milliseconds32 pollingInterval) +{ + (void) pollingInterval; + ChipLogError(DeviceLayer, "Set ICD Polling on linux"); + return CHIP_ERROR_NOT_IMPLEMENTED; +} +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ bool ThreadStackManagerImpl::_HaveMeshConnectivity() { diff --git a/src/platform/Linux/ThreadStackManagerImpl.h b/src/platform/Linux/ThreadStackManagerImpl.h index 2c4a47a43a0c62..3914c04524b14c 100755 --- a/src/platform/Linux/ThreadStackManagerImpl.h +++ b/src/platform/Linux/ThreadStackManagerImpl.h @@ -91,6 +91,9 @@ class ThreadStackManagerImpl : public ThreadStackManager CHIP_ERROR _SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig); CHIP_ERROR _RequestSEDActiveMode(bool onOff, bool delayIdle = false); #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER + CHIP_ERROR _SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ bool _HaveMeshConnectivity(); diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h index 2397b5e143828d..603161900b788f 100755 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h @@ -107,6 +107,9 @@ class GenericThreadStackManagerImpl_OpenThread CHIP_ERROR SEDUpdateMode(); static void RequestSEDModeUpdate(chip::System::Layer * apSystemLayer, void * apAppState); #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER + CHIP_ERROR _SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER bool _HaveMeshConnectivity(void); CHIP_ERROR _GetAndLogThreadStatsCounters(void); diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index 001fd0a883c74e..05ad6d1a3b7550 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -385,10 +385,9 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_StartThreadScan(NetworkCommissioning::ThreadDriver::ScanCallback * callback) { CHIP_ERROR error = CHIP_NO_ERROR; -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_DEVICE_CONFIG_ENABLE_SED || CHIP_CONFIG_ENABLE_ICD_SERVER otLinkModeConfig linkMode; #endif - // If there is another ongoing scan request, reject the new one. VerifyOrReturnError(mpScanCallback == nullptr, CHIP_ERROR_INCORRECT_STATE); @@ -402,7 +401,7 @@ GenericThreadStackManagerImpl_OpenThread::_StartThreadScan(NetworkCom SuccessOrExit(error = MapOpenThreadError(otIp6SetEnabled(mOTInst, true))); } -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_DEVICE_CONFIG_ENABLE_SED || CHIP_CONFIG_ENABLE_ICD_SERVER // Thread network discovery makes Sleepy End Devices detach from a network, so temporarily disable the SED mode. linkMode = otThreadGetLinkMode(mOTInst); @@ -440,7 +439,7 @@ void GenericThreadStackManagerImpl_OpenThread::_OnNetworkScanFinished { if (aResult == nullptr) // scan completed { -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_DEVICE_CONFIG_ENABLE_SED || CHIP_CONFIG_ENABLE_ICD_SERVER if (mTemporaryRxOnWhenIdle) { otLinkModeConfig linkMode = otThreadGetLinkMode(mOTInst); @@ -1736,8 +1735,8 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstanc #if CHIP_DEVICE_CONFIG_ENABLE_SED ConnectivityManager::SEDIntervalsConfig sedIntervalsConfig; using namespace System::Clock::Literals; - sedIntervalsConfig.ActiveIntervalMS = CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL; - sedIntervalsConfig.IdleIntervalMS = CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL; + sedIntervalsConfig.ActiveIntervalMS = CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL; + sedIntervalsConfig.IdleIntervalMS = CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL; err = _SetSEDIntervalsConfig(sedIntervalsConfig); if (err != CHIP_NO_ERROR) { @@ -1824,7 +1823,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetSEDIntervals if (err == CHIP_NO_ERROR) { ChipDeviceEvent event; - event.Type = DeviceEventType::kSEDIntervalChange; + event.Type = DeviceEventType::kICDPollingIntervalChange; err = chip::DeviceLayer::PlatformMgr().PostEvent(&event); } @@ -1964,6 +1963,52 @@ void GenericThreadStackManagerImpl_OpenThread::RequestSEDModeUpdate(c } #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER +template +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetPollingInterval(System::Clock::Milliseconds32 pollingInterval) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + Impl()->LockThreadStack(); + +// For Thread devices, the intervals are defined as: +// * poll period for SED devices that poll the parent for data +// * CSL period for SSED devices that listen for messages in scheduled time slots. +#if CHIP_DEVICE_CONFIG_THREAD_SSED + // Get CSL period in units of 10 symbols, convert it to microseconds and divide by 1000 to get milliseconds. + uint32_t curIntervalMS = otLinkCslGetPeriod(mOTInst) * OT_US_PER_TEN_SYMBOLS / 1000; +#else + uint32_t curIntervalMS = otLinkGetPollPeriod(mOTInst); +#endif + otError otErr = OT_ERROR_NONE; + if (pollingInterval.count() != curIntervalMS) + { +#if CHIP_DEVICE_CONFIG_THREAD_SSED + // Set CSL period in units of 10 symbols, convert it to microseconds and divide by 1000 to get milliseconds. + otErr = otLinkCslSetPeriod(mOTInst, pollingInterval.count() * 1000 / OT_US_PER_TEN_SYMBOLS); + curIntervalMS = otLinkCslGetPeriod(mOTInst) * OT_US_PER_TEN_SYMBOLS / 1000; +#else + otErr = otLinkSetPollPeriod(mOTInst, pollingInterval.count()); + curIntervalMS = otLinkGetPollPeriod(mOTInst); +#endif + err = MapOpenThreadError(otErr); + } + + Impl()->UnlockThreadStack(); + + if (otErr != OT_ERROR_NONE) + { + ChipLogError(DeviceLayer, "Failed to set SED interval to %" PRId32 "ms. Defaulting to %" PRId32 "ms", + pollingInterval.count(), curIntervalMS); + } + else + { + ChipLogProgress(DeviceLayer, "OpenThread SED interval is %" PRId32 "ms", curIntervalMS); + } + + return err; +} +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER + template void GenericThreadStackManagerImpl_OpenThread::_ErasePersistentInfo(void) { diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index 5e08040f7b2381..837b963b7a31fc 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -226,17 +226,17 @@ #define CHIP_DEVICE_CONFIG_ENABLE_SED 1 #endif // CONFIG_NRF_WIFI_LOW_POWER -#ifndef CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL +#ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL #ifdef CONFIG_CHIP_SED_IDLE_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_IDLE_INTERVAL) +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_IDLE_INTERVAL) #endif // CONFIG_CHIP_SED_IDLE_INTERVAL -#endif // CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL +#endif // CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL -#ifndef CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL +#ifndef CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL #ifdef CONFIG_CHIP_SED_ACTIVE_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_ACTIVE_INTERVAL) +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_ACTIVE_INTERVAL) #endif // CONFIG_CHIP_SED_ACTIVE_INTERVAL -#endif // CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL +#endif // CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL #ifdef CONFIG_CHIP_COMMISSIONABLE_DEVICE_TYPE #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1 diff --git a/src/platform/silabs/CHIPDevicePlatformConfig.h b/src/platform/silabs/CHIPDevicePlatformConfig.h index 3462402a228a58..7ea977bf54aa88 100644 --- a/src/platform/silabs/CHIPDevicePlatformConfig.h +++ b/src/platform/silabs/CHIPDevicePlatformConfig.h @@ -104,10 +104,10 @@ #define CHIP_DEVICE_CONFIG_ENABLE_IPV4 0 #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ -#ifdef CHIP_DEVICE_CONFIG_ENABLE_SED -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL chip::System::Clock::Milliseconds32(300) -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL chip::System::Clock::Milliseconds32(10) -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(300) +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(10) +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ #endif /* SL_WIFI */ @@ -138,13 +138,13 @@ #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE (6 * 1024) #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE -#ifndef CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_IDLE_INTERVAL) -#endif // CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL +#ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_IDLE_INTERVAL) +#endif // CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL -#ifndef CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_ACTIVE_INTERVAL) -#endif // CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL +#ifndef CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_ACTIVE_INTERVAL) +#endif // CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL #ifndef CHIP_DEVICE_CONFIG_SED_ACTIVE_THRESHOLD #define CHIP_DEVICE_CONFIG_SED_ACTIVE_THRESHOLD chip::System::Clock::Milliseconds32(SL_ACTIVE_MODE_THRESHOLD) diff --git a/src/platform/silabs/ConnectivityManagerImpl.h b/src/platform/silabs/ConnectivityManagerImpl.h index fd464a65c84720..54a6b97c5e5fa1 100644 --- a/src/platform/silabs/ConnectivityManagerImpl.h +++ b/src/platform/silabs/ConnectivityManagerImpl.h @@ -105,12 +105,9 @@ class ConnectivityManagerImpl final : public ConnectivityManager, bool _CanStartWiFiScan(); void _OnWiFiScanDone(); void _OnWiFiStationProvisionChange(); -#if CHIP_DEVICE_CONFIG_ENABLE_SED - ConnectivityManager::SEDIntervalsConfig mIntervalsConfig; - CHIP_ERROR _GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig); - CHIP_ERROR _SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig); - CHIP_ERROR _RequestSEDActiveMode(bool onOff, bool delayIdle = false); -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ +#if CHIP_CONFIG_ENABLE_ICD_SERVER + CHIP_ERROR _SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ #endif /* CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION */ // ===== Members for internal use by the following friends. diff --git a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp index ae3bb69ea4d2b7..c1a1a7de4c0ed1 100644 --- a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp @@ -220,28 +220,15 @@ void ConnectivityManagerImpl::_OnWiFiStationProvisionChange() DeviceLayer::SystemLayer().ScheduleWork(DriveStationState, NULL); } -#if CHIP_DEVICE_CONFIG_ENABLE_SED -CHIP_ERROR ConnectivityManagerImpl::_GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & SEDIntervalsConfig) +#if CHIP_CONFIG_ENABLE_ICD_SERVER +CHIP_ERROR ConnectivityManagerImpl::_SetPollingInterval(System::Clock::Milliseconds32 pollingInterval) { - // For now Wi-Fi uses DTIM power save mode so it varies from AP to AP - // TODO: Change this to DTIM read from DUT once it is done. For now hardcoding it - SEDIntervalsConfig.ActiveIntervalMS = CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL; - SEDIntervalsConfig.IdleIntervalMS = CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL; - return CHIP_NO_ERROR; -} - -CHIP_ERROR ConnectivityManagerImpl::_SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig) -{ - // not required - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; -} - -CHIP_ERROR ConnectivityManagerImpl::_RequestSEDActiveMode(bool onOff, bool delayIdle) -{ - // not required - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; + // TODO ICD + (void) pollingInterval; + ChipLogError(DeviceLayer, "Set ICD Fast Polling on Silabs Wifi platform"); + return CHIP_ERROR_NOT_IMPLEMENTED; } -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ // == == == == == == == == == == ConnectivityManager Private Methods == == == == == == == == == == @@ -380,13 +367,13 @@ void ConnectivityManagerImpl::OnStationConnected() event.WiFiConnectivityChange.Result = kConnectivity_Established; (void) PlatformMgr().PostEvent(&event); // Setting the rs911x in the power save mode -#if (CHIP_DEVICE_CONFIG_ENABLE_SED && RS911X_WIFI) +#if (CHIP_CONFIG_ENABLE_ICD_SERVER && RS911X_WIFI) sl_status_t err = wfx_power_save(); if (err != SL_STATUS_OK) { ChipLogError(DeviceLayer, "Power save config for Wifi failed"); } -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED && RS911X_WIFI */ +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER && RS911X_WIFI */ UpdateInternetConnectivityState(); } diff --git a/src/platform/silabs/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index 3c9d12be5dff6e..5fae93e82053f0 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -353,9 +353,9 @@ void wfx_ipv6_notify(int got_ip); #ifdef RS911X_WIFI /* RSI Power Save */ -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#if CHIP_CONFIG_ENABLE_ICD_SERVER sl_status_t wfx_power_save(); -#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ /* RSI for LWIP */ void * wfx_rsi_alloc_pkt(void); void wfx_rsi_pkt_add_data(void * p, uint8_t * buf, uint16_t len, uint16_t off); diff --git a/src/platform/telink/CHIPDevicePlatformConfig.h b/src/platform/telink/CHIPDevicePlatformConfig.h index 1b218875aae8e4..2527a3e8fc785a 100644 --- a/src/platform/telink/CHIPDevicePlatformConfig.h +++ b/src/platform/telink/CHIPDevicePlatformConfig.h @@ -227,14 +227,14 @@ #define CHIP_DEVICE_CONFIG_THREAD_SSED CONFIG_CHIP_THREAD_SSED #endif // CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT -#ifndef CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL +#ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL #ifdef CONFIG_CHIP_SED_IDLE_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_IDLE_INTERVAL) +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_IDLE_INTERVAL) #endif // CONFIG_CHIP_SED_IDLE_INTERVAL -#endif // CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL +#endif // CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL -#ifndef CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL +#ifndef CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL #ifdef CONFIG_CHIP_SED_ACTIVE_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_ACTIVE_INTERVAL) +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_ACTIVE_INTERVAL) #endif // CONFIG_CHIP_SED_ACTIVE_INTERVAL -#endif // CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL +#endif // CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 09dedcb4885074..28c1b73e6faa47 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -18,6 +18,7 @@ import("//build_overrides/jlink.gni") import("//build_overrides/mbedtls.gni") import("${efr32_sdk_build_root}/efr32_sdk.gni") +import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/lib/lib.gni") import("silabs_board.gni") @@ -153,14 +154,11 @@ template("siwx917_sdk") { defines += [ "ENABLE_WSTK_LEDS" ] } - if (defined(invoker.enable_sleepy_device)) { - if (invoker.enable_sleepy_device) { - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED=1", - "SL_CATALOG_POWER_MANAGER_PRESENT", - "SL_CATALOG_SLEEPTIMER_PRESENT", - ] - } + if (chip_enable_icd_server) { + defines += [ + "SL_CATALOG_POWER_MANAGER_PRESENT", + "SL_CATALOG_SLEEPTIMER_PRESENT", + ] } if (chip_build_libshell) { # matter shell diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index fbbdc8bc5db0fb..de1f70f42c5ce2 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -17,6 +17,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/jlink.gni") import("//build_overrides/mbedtls.gni") +import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/lib/lib.gni") import("silabs_board.gni") @@ -52,9 +53,6 @@ declare_args() { silabs_log_enabled = true - # Enable Sleepy end device - enable_sleepy_device = false - # Argument to enable IPv4 for wifi # aligning to match chip_inet_config_enable_ipv4 default configuration chip_enable_wifi_ipv4 = false @@ -326,9 +324,8 @@ template("efr32_sdk") { _include_dirs += [ "${efr32_sdk_root}/platform/driver/button/inc" ] } - if (enable_sleepy_device) { + if (chip_enable_icd_server) { defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED=1", "SL_OT_IDLE_INTERVAL=${sl_ot_idle_interval_ms}", "SL_OT_ACTIVE_INTERVAL=${sl_ot_active_interval_ms}", "SL_ACTIVE_MODE_THRESHOLD=${sl_active_mode_threshold}", From f952ed50bd604d7beaba5c123950be23493b5c88 Mon Sep 17 00:00:00 2001 From: Marcin Kajor <98948394+markaj-nordic@users.noreply.github.com> Date: Tue, 11 Jul 2023 00:22:46 +0200 Subject: [PATCH 06/34] nrfconnect: bypass support for IPv4 (#27851) This change allows to build nrfconnect SDK samples with Matter over IPv6 but IPv4 still available for third party development within the same application. Signed-off-by: Marcin Kajor --- config/nrfconnect/chip-module/CMakeLists.txt | 2 +- config/nrfconnect/chip-module/Kconfig | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 43149d2306e3c1..d897f8335add17 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -122,7 +122,7 @@ matter_add_gn_arg_bool ("chip_logging" CONFIG_LOG) matter_add_gn_arg_bool ("chip_enable_openthread" CONFIG_NET_L2_OPENTHREAD) matter_add_gn_arg_bool ("chip_openthread_ftd" CONFIG_OPENTHREAD_FTD) matter_add_gn_arg_bool ("chip_config_network_layer_ble" CONFIG_BT) -matter_add_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_NET_IPV4) +matter_add_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_CHIP_IPV4) matter_add_gn_arg_bool ("chip_enable_nfc" CONFIG_CHIP_NFC_COMMISSIONING) 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) diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index 059d5112652b3f..95e49ac59e0262 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -251,3 +251,12 @@ config CHIP_LOG_SIZE_OPTIMIZATION information that is too detailed to be used in most cases. You can find full configuration enabled by this option in the platform/nrfconnect/CHIPPlatformConfig.h file. + +config CHIP_IPV4 + bool "IPv4 support for Matter" + default n + depends on NET_IPV4 + help + If disabled, it allows to build nRF Connect SDK application + with IPv4 support independently of the Matter stack still + running over IPv6. From 8b8fdf94836f5b756fa48130fae9fff49125f117 Mon Sep 17 00:00:00 2001 From: srningap <107042150+srningap@users.noreply.github.com> Date: Tue, 11 Jul 2023 04:05:52 +0530 Subject: [PATCH 07/34] Adds fix 917SoC Apps build failure (#27859) --- examples/platform/silabs/SiWx917/BUILD.gn | 1 + examples/platform/silabs/SoftwareFaultReports.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 9c1e3a60bd4e42..392663f7b16624 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -248,6 +248,7 @@ source_set("siwx917-common") { sources = [ "${silabs_common_plat_dir}/LEDWidget.cpp", + "${silabs_common_plat_dir}/SoftwareFaultReports.cpp", "${silabs_common_plat_dir}/heap_4_silabs.c", "${silabs_common_plat_dir}/silabs_utils.cpp", "${silabs_common_plat_dir}/syscalls_stubs.cpp", diff --git a/examples/platform/silabs/SoftwareFaultReports.cpp b/examples/platform/silabs/SoftwareFaultReports.cpp index d7557fdc7e41f1..89015dc2e47b7f 100644 --- a/examples/platform/silabs/SoftwareFaultReports.cpp +++ b/examples/platform/silabs/SoftwareFaultReports.cpp @@ -34,6 +34,10 @@ #endif #endif // BRD4325A +#ifdef BRD4325A // For SiWx917 Platform only +#include "core_cm4.h" +#endif + // Technically FaultRecording is an octstr up to 1024 bytes. // We currently only report short strings. 100 char will more than enough for now. constexpr uint8_t kMaxFaultStringLen = 100; From 4e9c8e2468c7aaab0748bb19786cf574dfc5d780 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 00:14:01 +0000 Subject: [PATCH 08/34] Bump third_party/pigweed/repo from `ee4e09c` to `b5cec17` (#27852) Bumps [third_party/pigweed/repo](https://github.com/google/pigweed) from `ee4e09c` to `b5cec17`. - [Commits](https://github.com/google/pigweed/compare/ee4e09ccde34497280b27f41b309a6d59ec44245...b5cec17a34cb4115537141d06c7726392857f678) --- updated-dependencies: - dependency-name: third_party/pigweed/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/pigweed/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index ee4e09ccde3449..b5cec17a34cb41 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit ee4e09ccde34497280b27f41b309a6d59ec44245 +Subproject commit b5cec17a34cb4115537141d06c7726392857f678 From 655a85ab2b02e6170f08951539708a93fb9103b8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 00:14:54 +0000 Subject: [PATCH 09/34] Bump third_party/mbedtls/repo from `fbcb5d4` to `b18d45f` (#27853) Bumps [third_party/mbedtls/repo](https://github.com/ARMmbed/mbedtls) from `fbcb5d4` to `b18d45f`. - [Release notes](https://github.com/ARMmbed/mbedtls/releases) - [Commits](https://github.com/ARMmbed/mbedtls/compare/fbcb5d469b0f314605747c5ba21b41ece0d4b2bd...b18d45f042555dc79e5c0e2e0f8f73eb3a61677e) --- updated-dependencies: - dependency-name: third_party/mbedtls/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/mbedtls/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/mbedtls/repo b/third_party/mbedtls/repo index fbcb5d469b0f31..b18d45f042555d 160000 --- a/third_party/mbedtls/repo +++ b/third_party/mbedtls/repo @@ -1 +1 @@ -Subproject commit fbcb5d469b0f314605747c5ba21b41ece0d4b2bd +Subproject commit b18d45f042555dc79e5c0e2e0f8f73eb3a61677e From 375a2a6f825096c93776e87a3632cec4e090c04a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 00:15:11 +0000 Subject: [PATCH 10/34] Bump third_party/openthread/repo from `809cdc4` to `8bc2504` (#27854) Bumps [third_party/openthread/repo](https://github.com/openthread/openthread) from `809cdc4` to `8bc2504`. - [Release notes](https://github.com/openthread/openthread/releases) - [Commits](https://github.com/openthread/openthread/compare/809cdc40bea9633c0fccbd4362e9a490d51a1a8f...8bc25042ba5cde20605eec2a329c0dff575303f4) --- updated-dependencies: - dependency-name: third_party/openthread/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/openthread/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/openthread/repo b/third_party/openthread/repo index 809cdc40bea963..8bc25042ba5cde 160000 --- a/third_party/openthread/repo +++ b/third_party/openthread/repo @@ -1 +1 @@ -Subproject commit 809cdc40bea9633c0fccbd4362e9a490d51a1a8f +Subproject commit 8bc25042ba5cde20605eec2a329c0dff575303f4 From bdee5125f1ae1371e585435cd191030865edb680 Mon Sep 17 00:00:00 2001 From: Satyajit Anand Date: Tue, 11 Jul 2023 09:37:17 +0530 Subject: [PATCH 11/34] Fix Doc Issue (#27841) --- docs/guides/repl/Matter_Multi_Fabric_Commissioning.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/repl/Matter_Multi_Fabric_Commissioning.ipynb b/docs/guides/repl/Matter_Multi_Fabric_Commissioning.ipynb index fe60b08a1c709c..5738ee612c9967 100644 --- a/docs/guides/repl/Matter_Multi_Fabric_Commissioning.ipynb +++ b/docs/guides/repl/Matter_Multi_Fabric_Commissioning.ipynb @@ -958,7 +958,7 @@ "source": [ "### Establish CASE and Read OpCreds\n", "\n", - "To prove that we do indeed have two distinct fabrics and controllers on each fabric, let's go ahead and update the label of each fabric. To do so, you'd need to succcessfully establish a CASE session through a controller on the respective fabric, and call the 'UpdateLabel' command.\n", + "To prove that we do indeed have two distinct fabrics and controllers on each fabric, let's go ahead and update the label of each fabric. To do so, you'd need to successfully establish a CASE session through a controller on the respective fabric, and call the 'UpdateLabel' command.\n", "\n", "Underneath the covers, each device controller will do operational discovery of the NodeId being read and establish a CASE session before issuing the IM interaction." ] From aaa25420f02d353c74677bef6e79abbd46eea463 Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Tue, 11 Jul 2023 11:50:29 +0300 Subject: [PATCH 12/34] [Telink] Update Telink image to 0.7.24 (#27648) --- .github/workflows/examples-telink.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 05c0adcccff319..6e82cfa288639b 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-telink:0.7.14 + image: connectedhomeip/chip-build-telink:0.7.24 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" From 39560924507676505ebd0814beff55ae5336052f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 11 Jul 2023 09:13:57 -0400 Subject: [PATCH 13/34] Remove format/test from efr32 because efr32-brd4161a-unit-test runs out of flash (#27889) Co-authored-by: Andrei Litvin --- src/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BUILD.gn b/src/BUILD.gn index 531ee984fee2c0..58a7d5b1707bf8 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -59,7 +59,6 @@ if (chip_build_tests) { "${chip_root}/src/lib/address_resolve/tests", "${chip_root}/src/lib/asn1/tests", "${chip_root}/src/lib/core/tests", - "${chip_root}/src/lib/format/tests", "${chip_root}/src/messaging/tests", "${chip_root}/src/protocols/bdx/tests", "${chip_root}/src/protocols/user_directed_commissioning/tests", @@ -93,6 +92,7 @@ if (chip_build_tests) { # TODO(#10447): App test has HF on EFR32. "${chip_root}/src/app/tests", "${chip_root}/src/credentials/tests", + "${chip_root}/src/lib/format/tests", "${chip_root}/src/lib/support/tests", "${chip_root}/src/protocols/secure_channel/tests", "${chip_root}/src/system/tests", From 543324662cd6e6ef473913aa483b8d115576b552 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 11 Jul 2023 09:24:45 -0400 Subject: [PATCH 14/34] Remove raw value access from TLV::Tag (#27869) * Provide a AppendTo for formatting TLV tags * Restyle * Fix uni tests to new formatting * Restyle * Fix tag formatting when enter container fails --- src/lib/core/BUILD.gn | 1 + src/lib/core/TLVTags.cpp | 48 +++++++++++++ src/lib/core/TLVTags.h | 4 +- src/lib/format/protocol_decoder.cpp | 61 ++-------------- src/lib/format/tests/TestDecoding.cpp | 100 +++++++++++++------------- 5 files changed, 109 insertions(+), 105 deletions(-) create mode 100644 src/lib/core/TLVTags.cpp diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index edff299efd8ea6..5a08f7d1935a23 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -109,6 +109,7 @@ static_library("core") { "TLVCircularBuffer.h", "TLVDebug.cpp", "TLVReader.cpp", + "TLVTags.cpp", "TLVTags.h", "TLVTypes.h", "TLVUpdater.cpp", diff --git a/src/lib/core/TLVTags.cpp b/src/lib/core/TLVTags.cpp new file mode 100644 index 00000000000000..8d3e744b4667a3 --- /dev/null +++ b/src/lib/core/TLVTags.cpp @@ -0,0 +1,48 @@ +/* + * + * Copyright (c) 2020-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 "TLVTags.h" + +namespace chip { +namespace TLV { + +/// Appends the text representation for a tag to the given string builder base. +StringBuilderBase & Tag::AppendTo(StringBuilderBase & out) +{ + if (TLV::IsProfileTag(*this)) + { + out.AddFormat("ProfileTag(0x%X::0x%X::0x%" PRIX32 ")", TLV::VendorIdFromTag(*this), TLV::ProfileNumFromTag(*this), + TLV::TagNumFromTag(*this)); + } + else if (TLV::IsContextTag(*this)) + { + out.AddFormat("ContextTag(0x%" PRIX32 ")", TLV::TagNumFromTag(*this)); + } + else if (*this == TLV::AnonymousTag()) + { + out.Add("AnonymousTag()"); + } + else + { + out.AddFormat("UnknownTag(0x%" PRIX64 ")", mVal); + } + + return out; +} + +} // namespace TLV +} // namespace chip diff --git a/src/lib/core/TLVTags.h b/src/lib/core/TLVTags.h index fd2a8152b411f2..b82be9179466af 100644 --- a/src/lib/core/TLVTags.h +++ b/src/lib/core/TLVTags.h @@ -25,6 +25,7 @@ #pragma once #include +#include #include #include @@ -46,7 +47,8 @@ class Tag constexpr bool operator==(const Tag & other) const { return mVal == other.mVal; } constexpr bool operator!=(const Tag & other) const { return mVal != other.mVal; } - uint64_t RawValue() const { return mVal; } + /// Appends the text representation of the tag to the given string builder base. + StringBuilderBase & AppendTo(StringBuilderBase & out); private: explicit constexpr Tag(uint64_t val) : mVal(val) {} diff --git a/src/lib/format/protocol_decoder.cpp b/src/lib/format/protocol_decoder.cpp index 8c3b352133902a..97d6dd857d9198 100644 --- a/src/lib/format/protocol_decoder.cpp +++ b/src/lib/format/protocol_decoder.cpp @@ -45,51 +45,6 @@ class ByTag const Tag mTag; }; -const char * DecodeTagControl(const TLVTagControl aTagControl) -{ - switch (aTagControl) - { - case TLVTagControl::Anonymous: - return "Anonymous"; - case TLVTagControl::ContextSpecific: - return "ContextSpecific"; - case TLVTagControl::CommonProfile_2Bytes: - return "Common2B"; - case TLVTagControl::CommonProfile_4Bytes: - return "Common4B"; - case TLVTagControl::ImplicitProfile_2Bytes: - return "Implicit2B"; - case TLVTagControl::ImplicitProfile_4Bytes: - return "Implicit4B"; - case TLVTagControl::FullyQualified_6Bytes: - return "FullyQualified6B"; - case TLVTagControl::FullyQualified_8Bytes: - return "FullyQualified8"; - default: - return "???"; - } -} - -void FormatCurrentTag(const TLVReader & reader, chip::StringBuilderBase & out) -{ - chip::TLV::TLVTagControl tagControl = static_cast(reader.GetControlByte() & kTLVTagControlMask); - chip::TLV::Tag tag = reader.GetTag(); - - if (IsProfileTag(tag)) - { - out.AddFormat("%s(0x%X::0x%X::0x%" PRIX32 ")", DecodeTagControl(tagControl), VendorIdFromTag(tag), ProfileNumFromTag(tag), - TagNumFromTag(tag)); - } - else if (IsContextTag(tag)) - { - out.AddFormat("%s(0x%" PRIX32 ")", DecodeTagControl(tagControl), TagNumFromTag(tag)); - } - else - { - out.AddFormat("UnknownTag(0x%" PRIX64 ")", tag.RawValue()); - } -} - CHIP_ERROR FormatCurrentValue(TLVReader & reader, chip::StringBuilderBase & out) { switch (reader.GetType()) @@ -351,6 +306,7 @@ bool PayloadDecoderBase::ReaderEnterContainer(PayloadEntry & entry) if (mCurrentNesting >= kMaxDecodeDepth) { mValueBuilder.AddFormat("NESTING DEPTH REACHED"); + mReader.GetTag().AppendTo(mNameBuilder.Reset()); entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str()); return false; } @@ -360,6 +316,7 @@ bool PayloadDecoderBase::ReaderEnterContainer(PayloadEntry & entry) if (err != CHIP_NO_ERROR) { mValueBuilder.AddFormat("ERROR entering container: %" CHIP_ERROR_FORMAT, err.Format()); + mReader.GetTag().AppendTo(mNameBuilder.Reset()); // assume enter is not done, so tag is correct entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str()); mState = State::kDone; return false; @@ -372,13 +329,8 @@ bool PayloadDecoderBase::ReaderEnterContainer(PayloadEntry & entry) void PayloadDecoderBase::EnterContainer(PayloadEntry & entry) { - // must be done BEFORE entering container - // to preserve the value and not get a 'container tag' - // below when data is not valid - // - // TODO: this formatting is wasteful, should really be done only - // if data is NULLPTR. - FormatCurrentTag(mReader, mNameBuilder.Reset()); + // Tag fetch must be done BEFORE entering container + chip::TLV::Tag tag = mReader.GetTag(); VerifyOrReturn(ReaderEnterContainer(entry)); @@ -396,6 +348,7 @@ void PayloadDecoderBase::EnterContainer(PayloadEntry & entry) if (data == nullptr) { + tag.AppendTo(mNameBuilder.Reset()); entry = PayloadEntry::NestingEnter(mNameBuilder.c_str()); } else @@ -454,7 +407,7 @@ void PayloadDecoderBase::NextFromContentRead(PayloadEntry & entry) if (data == nullptr) { - FormatCurrentTag(mReader, mNameBuilder.Reset()); + mReader.GetTag().AppendTo(mNameBuilder.Reset()); entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str()); return; } @@ -600,7 +553,7 @@ void PayloadDecoderBase::NextFromValueRead(PayloadEntry & entry) if (data == nullptr) { - FormatCurrentTag(mReader, mNameBuilder.Reset()); + mReader.GetTag().AppendTo(mNameBuilder.Reset()); PrettyPrintCurrentValue(mReader, mValueBuilder.Reset(), mPayloadPosition); entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str()); mPayloadPosition.Exit(); diff --git a/src/lib/format/tests/TestDecoding.cpp b/src/lib/format/tests/TestDecoding.cpp index 6fcb154de7430d..f9ef31719f5b6b 100644 --- a/src/lib/format/tests/TestDecoding.cpp +++ b/src/lib/format/tests/TestDecoding.cpp @@ -505,14 +505,14 @@ void TestEmptyClusterMetaDataDecode(nlTestSuite * inSuite, void * inContext) " endpoint_id: 0\n" " cluster_id: 31\n" " attribute_id: 0\n" - " 0x1f::ATTR(0x0)\n" // Cluster 31, attribute 0 - " UnknownTag(0x100)\n" // List entry (acl is a list) - " ContextSpecific(0x1): 5\n" // privilege - " ContextSpecific(0x2): 2\n" // authMode - " ContextSpecific(0x3)\n" // subjects - " UnknownTag(0x100): 112233\n" // List entry (subjects is a list) - " ContextSpecific(0x4): NULL\n" // targets - " ContextSpecific(0xFE): 1\n" // fabricIndex + " 0x1f::ATTR(0x0)\n" // Cluster 31, attribute 0 + " AnonymousTag()\n" // List entry (acl is a list) + " ContextTag(0x1): 5\n" // privilege + " ContextTag(0x2): 2\n" // authMode + " ContextTag(0x3)\n" // subjects + " AnonymousTag(): 112233\n" // List entry (subjects is a list) + " ContextTag(0x4): NULL\n" // targets + " ContextTag(0xFE): 1\n" // fabricIndex " suppress_response: true\n" " interaction_model_revison: 1\n"); } @@ -536,24 +536,24 @@ void TestWrongDecodeData(nlTestSuite * inSuite, void * inContext) TestSampleData(inSuite, params, secure_channel_mrp_ack, "proto16: EMPTY\n"); TestSampleData(inSuite, params, im_protocol_report_data_acl, "proto5\n" - " ContextSpecific(0x1)\n" - " UnknownTag(0x100)\n" - " ContextSpecific(0x1)\n" - " ContextSpecific(0x0): 3420147058\n" - " ContextSpecific(0x1)\n" - " ContextSpecific(0x2): 0\n" - " ContextSpecific(0x3): 31\n" - " ContextSpecific(0x4): 0\n" - " ContextSpecific(0x2)\n" - " UnknownTag(0x100)\n" - " ContextSpecific(0x1): 5\n" - " ContextSpecific(0x2): 2\n" - " ContextSpecific(0x3)\n" - " UnknownTag(0x100): 112233\n" - " ContextSpecific(0x4): NULL\n" - " ContextSpecific(0xFE): 1\n" - " ContextSpecific(0x4): true\n" - " ContextSpecific(0xFF): 1\n"); + " ContextTag(0x1)\n" + " AnonymousTag()\n" + " ContextTag(0x1)\n" + " ContextTag(0x0): 3420147058\n" + " ContextTag(0x1)\n" + " ContextTag(0x2): 0\n" + " ContextTag(0x3): 31\n" + " ContextTag(0x4): 0\n" + " ContextTag(0x2)\n" + " AnonymousTag()\n" + " ContextTag(0x1): 5\n" + " ContextTag(0x2): 2\n" + " ContextTag(0x3)\n" + " AnonymousTag(): 112233\n" + " ContextTag(0x4): NULL\n" + " ContextTag(0xFE): 1\n" + " ContextTag(0x4): true\n" + " ContextTag(0xFF): 1\n"); } void TestNestingOverflow(nlTestSuite * inSuite, void * inContext) @@ -629,30 +629,30 @@ void TestNestingOverflow(nlTestSuite * inSuite, void * inContext) TestSampleData(inSuite, params, fake_payload, "proto5\n" - " ContextSpecific(0x0)\n" - " ContextSpecific(0x1)\n" - " ContextSpecific(0x2)\n" - " ContextSpecific(0x3)\n" - " ContextSpecific(0x4)\n" - " ContextSpecific(0x5)\n" - " ContextSpecific(0x6)\n" - " ContextSpecific(0x7)\n" - " ContextSpecific(0x8)\n" - " ContextSpecific(0x9)\n" - " ContextSpecific(0xA)\n" - " ContextSpecific(0xB)\n" - " ContextSpecific(0xC)\n" - " ContextSpecific(0xD)\n" - " ContextSpecific(0xE)\n" - " ContextSpecific(0xF): NESTING DEPTH REACHED\n" - " ContextSpecific(0x20)\n" - " ContextSpecific(0x21)\n" - " ContextSpecific(0x22)\n" - " ContextSpecific(0x23)\n" - " ContextSpecific(0x30)\n" - " ContextSpecific(0x31)\n" - " ContextSpecific(0x32)\n" - " ContextSpecific(0x33)\n"); + " ContextTag(0x0)\n" + " ContextTag(0x1)\n" + " ContextTag(0x2)\n" + " ContextTag(0x3)\n" + " ContextTag(0x4)\n" + " ContextTag(0x5)\n" + " ContextTag(0x6)\n" + " ContextTag(0x7)\n" + " ContextTag(0x8)\n" + " ContextTag(0x9)\n" + " ContextTag(0xA)\n" + " ContextTag(0xB)\n" + " ContextTag(0xC)\n" + " ContextTag(0xD)\n" + " ContextTag(0xE)\n" + " ContextTag(0xF): NESTING DEPTH REACHED\n" + " ContextTag(0x20)\n" + " ContextTag(0x21)\n" + " ContextTag(0x22)\n" + " ContextTag(0x23)\n" + " ContextTag(0x30)\n" + " ContextTag(0x31)\n" + " ContextTag(0x32)\n" + " ContextTag(0x33)\n"); } const nlTest sTests[] = { From 12b638314be5e5174efb80a8ba8fe40f71083721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Michalak-Szmaci=C5=84ski?= Date: Tue, 11 Jul 2023 16:41:04 +0200 Subject: [PATCH 15/34] Flake8 fixes Python error files in the scripts directory --- .flake8 | 21 ---------------- scripts/build/build/targets.py | 2 +- scripts/build/builders/android.py | 2 -- scripts/build/builders/bouffalolab.py | 1 - scripts/build/builders/cc13x2x7_26x2x7.py | 2 +- scripts/build/builders/genio.py | 2 +- scripts/build/builders/gn.py | 1 - scripts/build/builders/infineon.py | 2 +- scripts/codegen.py | 8 +++---- scripts/codepregen.py | 6 ++--- scripts/error_table.py | 1 - scripts/examples/gn_to_cmakelists.py | 6 ++--- .../flashing/bouffalolab_firmware_utils.py | 2 +- scripts/flashing/cyw30739_firmware_utils.py | 1 - scripts/gen_chip_version.py | 24 +++++++++---------- scripts/helpers/bloat_check.py | 2 +- scripts/pregenerate/using_codegen.py | 3 --- scripts/pregenerate/using_zap.py | 2 -- scripts/run-clang-tidy-on-compile-commands.py | 14 +++++------ 19 files changed, 34 insertions(+), 68 deletions(-) diff --git a/.flake8 b/.flake8 index c53238a9262656..2481f916e89300 100644 --- a/.flake8 +++ b/.flake8 @@ -3,7 +3,6 @@ max-line-length = 132 exclude = third_party .* out/* - scripts/idl/* ./examples/common/QRCode/* # temporarily scan only directories with fixed files # TODO: Remove the paths below when all bugs are fixed @@ -15,26 +14,6 @@ exclude = third_party docs/_extensions/external_content.py examples/common/pigweed/rpc_console/py/chip_rpc/console.py examples/lighting-app/python/lighting.py - scripts/build/build/target.py - scripts/build/build/targets.py - scripts/build/builders/android.py - scripts/build/builders/bouffalolab.py - scripts/build/builders/cc13x2x7_26x2x7.py - scripts/build/builders/genio.py - scripts/build/builders/gn.py - scripts/build/builders/imx.py - scripts/build/builders/infineon.py - scripts/codegen.py - scripts/codepregen.py - scripts/error_table.py - scripts/examples/gn_to_cmakelists.py - scripts/flashing/bouffalolab_firmware_utils.py - scripts/flashing/cyw30739_firmware_utils.py - scripts/gen_chip_version.py - scripts/helpers/bloat_check.py - scripts/pregenerate/using_codegen.py - scripts/pregenerate/using_zap.py - scripts/run-clang-tidy-on-compile-commands.py scripts/tools/check_zcl_file_sync.py scripts/tools/convert_ini.py scripts/tools/memory/memdf/__init__.py diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 7447eec8e5561c..b444a8652e1599 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -543,7 +543,7 @@ def BuildQorvoTarget(): TargetPart('qpg6105', board=QpgBoard.QPG6105), ]) - # apps + # apps target.AppendFixedTargets([ TargetPart('lock', app=QpgApp.LOCK), TargetPart('light', app=QpgApp.LIGHT), diff --git a/scripts/build/builders/android.py b/scripts/build/builders/android.py index 7e0ec61bc7290c..3ae81c9f8e8b09 100644 --- a/scripts/build/builders/android.py +++ b/scripts/build/builders/android.py @@ -396,8 +396,6 @@ def generate(self): title="Accepting NDK licenses @ tools", ) - app_dir = os.path.join(self.root, "examples/", self.app.AppName()) - def stripSymbols(self): output_libs_dir = os.path.join( self.output_dir, diff --git a/scripts/build/builders/bouffalolab.py b/scripts/build/builders/bouffalolab.py index 51529e54bbfc8f..52477be7519ebf 100644 --- a/scripts/build/builders/bouffalolab.py +++ b/scripts/build/builders/bouffalolab.py @@ -14,7 +14,6 @@ import logging import os -import platform from enum import Enum, auto from .gn import GnBuilder diff --git a/scripts/build/builders/cc13x2x7_26x2x7.py b/scripts/build/builders/cc13x2x7_26x2x7.py index 713a5ca7bc913b..907d92fe1575b4 100644 --- a/scripts/build/builders/cc13x2x7_26x2x7.py +++ b/scripts/build/builders/cc13x2x7_26x2x7.py @@ -81,7 +81,7 @@ def GnBuildArgs(self): 'ti_sysconfig_root="%s"' % os.environ['TI_SYSCONFIG_ROOT'], ] - if self.openthread_ftd == None: + if self.openthread_ftd is None: pass elif self.openthread_ftd: args.append('chip_openthread_ftd=true') diff --git a/scripts/build/builders/genio.py b/scripts/build/builders/genio.py index 56ba33f7b705ff..822f198fd798da 100755 --- a/scripts/build/builders/genio.py +++ b/scripts/build/builders/genio.py @@ -27,7 +27,7 @@ def AppNamePrefix(self): def FlashBundleName(self): if self == GenioApp.LIGHT: return 'lighting_app.flashbundle.txt' - elif self == GEnioApp.SHELL: + elif self == GenioApp.SHELL: return 'shell.flashbundle.txt' else: raise Exception('Unknown app type: %r' % self) diff --git a/scripts/build/builders/gn.py b/scripts/build/builders/gn.py index 9e859f6025a5a7..75f6bb02c4231e 100644 --- a/scripts/build/builders/gn.py +++ b/scripts/build/builders/gn.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import shlex from .builder import Builder diff --git a/scripts/build/builders/infineon.py b/scripts/build/builders/infineon.py index 1783faefa0ef75..7237f0625cc92e 100644 --- a/scripts/build/builders/infineon.py +++ b/scripts/build/builders/infineon.py @@ -111,5 +111,5 @@ def build_outputs(self): def flashbundle(self): with open(os.path.join(self.output_dir, self.app.FlashBundleName()), 'r') as fp: return { - l.strip(): os.path.join(self.output_dir, l.strip()) for l in fp.readlines() if l.strip() + line.strip(): os.path.join(self.output_dir, line.strip()) for line in fp.readlines() if line.strip() } diff --git a/scripts/codegen.py b/scripts/codegen.py index e703b8229e854c..1f679ea6148ed3 100755 --- a/scripts/codegen.py +++ b/scripts/codegen.py @@ -152,10 +152,10 @@ def main(log_level, generator, option, output_dir, dry_run, name_only, expected_ if expected_outputs: with open(expected_outputs, 'rt') as fin: expected = set() - for l in fin.readlines(): - l = l.strip() - if l: - expected.add(l) + for line in fin.readlines(): + line = line.strip() + if line: + expected.add(line) if expected != storage.generated_paths: logging.fatal("expected and generated files do not match.") diff --git a/scripts/codepregen.py b/scripts/codepregen.py index 43de8fc21c4dc1..6c0f24c60632eb 100755 --- a/scripts/codepregen.py +++ b/scripts/codepregen.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import enum import itertools import logging import multiprocessing @@ -25,8 +24,7 @@ try: from pregenerate import FindPregenerationTargets, TargetFilter -except: - import os +except ImportError: sys.path.append(os.path.abspath(os.path.dirname(__file__))) from pregenerate import FindPregenerationTargets, TargetFilter @@ -36,7 +34,7 @@ try: import coloredlogs _has_coloredlogs = True -except: +except ImportError: _has_coloredlogs = False # Supported log levels, mapping string values required for argument diff --git a/scripts/error_table.py b/scripts/error_table.py index 4f5dc13a22939d..54e9474fa8f338 100644 --- a/scripts/error_table.py +++ b/scripts/error_table.py @@ -28,7 +28,6 @@ from enum import IntEnum from operator import attrgetter from pathlib import Path -from xml.etree.ElementInclude import include @dataclass diff --git a/scripts/examples/gn_to_cmakelists.py b/scripts/examples/gn_to_cmakelists.py index 3525fce49606b1..aa17aa87ce5b6e 100755 --- a/scripts/examples/gn_to_cmakelists.py +++ b/scripts/examples/gn_to_cmakelists.py @@ -76,8 +76,8 @@ def Escape(c): return ''.join(map(Escape, a)) -def RemoveByPrefix(l, prefixs): - ret = l +def RemoveByPrefix(list, prefixs): + ret = list for pre in prefixs: ret = [x for x in ret if not x.startswith(pre)] @@ -450,7 +450,7 @@ def WriteCopy(out, target, project, sources, synthetic_dependencies): def WriteCompilerFlags(out, target, project, sources): # Hack, set linker language to c if no c or cxx files present. - if not 'c' in sources and not 'cxx' in sources: + if 'c' not in sources and 'cxx' not in sources: SetCurrentTargetProperty(out, 'LINKER_LANGUAGE', ['C']) # Mark uncompiled sources as uncompiled. diff --git a/scripts/flashing/bouffalolab_firmware_utils.py b/scripts/flashing/bouffalolab_firmware_utils.py index 2e7596892da94a..03aabaa9fd2b3b 100644 --- a/scripts/flashing/bouffalolab_firmware_utils.py +++ b/scripts/flashing/bouffalolab_firmware_utils.py @@ -207,7 +207,7 @@ def actions(self): continue if value: - if value == True: + if value is True: arg = ("--{}".format(key)).strip() elif isinstance(value, pathlib.Path): arg = ("--{}={}".format(key, os.path.join(os.getcwd(), str(value)))).strip() diff --git a/scripts/flashing/cyw30739_firmware_utils.py b/scripts/flashing/cyw30739_firmware_utils.py index 58913202ed53df..0b671bffd76c86 100644 --- a/scripts/flashing/cyw30739_firmware_utils.py +++ b/scripts/flashing/cyw30739_firmware_utils.py @@ -19,7 +19,6 @@ For `Flasher`, see the class documentation. """ -import os import sys import firmware_utils diff --git a/scripts/gen_chip_version.py b/scripts/gen_chip_version.py index bae79f01b4afee..baa201485bafb9 100755 --- a/scripts/gen_chip_version.py +++ b/scripts/gen_chip_version.py @@ -17,19 +17,19 @@ import optparse import sys -TEMPLATE = '''/* +TEMPLATE = r'''/* * * Copyright (c) 2020 Project CHIP Authors * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the \"License\"); + * 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, + * 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. @@ -94,9 +94,9 @@ * \@endcode * */ -#define CHIP_VERSION_CODE_ENCODE(major, minor, patch) \\ - ((((major) & _CHIP_VERSION_CODE_MAJOR_MASK) << _CHIP_VERSION_CODE_MAJOR_SHIFT) | \\ - (((minor) & _CHIP_VERSION_CODE_MINOR_MASK) << _CHIP_VERSION_CODE_MINOR_SHIFT) | \\ +#define CHIP_VERSION_CODE_ENCODE(major, minor, patch) \ + ((((major) & _CHIP_VERSION_CODE_MAJOR_MASK) << _CHIP_VERSION_CODE_MAJOR_SHIFT) | \ + (((minor) & _CHIP_VERSION_CODE_MINOR_MASK) << _CHIP_VERSION_CODE_MINOR_SHIFT) | \ (((patch) & _CHIP_VERSION_CODE_PATCH_MASK) << _CHIP_VERSION_CODE_PATCH_SHIFT)) /** @@ -160,7 +160,7 @@ * The CHIP version extra component, as a quoted C string. * */ -#define CHIP_VERSION_EXTRA \"%(chip_extra)s\" +#define CHIP_VERSION_EXTRA "%(chip_extra)s" /** * \@def CHIP_VERSION_STRING @@ -169,7 +169,7 @@ * The CHIP version, as a quoted C string. * */ -#define CHIP_VERSION_STRING \"%(chip_version)s\" +#define CHIP_VERSION_STRING "%(chip_version)s" /** * \@def CHIP_VERSION_CODE @@ -191,10 +191,10 @@ * \@endcode * */ -#define CHIP_VERSION_CODE CHIP_VERSION_CODE_ENCODE( \\ - CHIP_VERSION_MAJOR, \\ - CHIP_VERSION_MINOR, \\ - CHIP_VERSION_PATCH \\ +#define CHIP_VERSION_CODE CHIP_VERSION_CODE_ENCODE( \ + CHIP_VERSION_MAJOR, \ + CHIP_VERSION_MINOR, \ + CHIP_VERSION_PATCH \ ) #endif /* CHIP_VERSION_H_ */ diff --git a/scripts/helpers/bloat_check.py b/scripts/helpers/bloat_check.py index 798df246b78554..72ad3705df2785 100755 --- a/scripts/helpers/bloat_check.py +++ b/scripts/helpers/bloat_check.py @@ -357,7 +357,7 @@ def main(): # Output processed. a.delete() - except Exception as e: + except Exception: tb = traceback.format_exc() logging.warning('Failed to process bloat report: %s', tb) diff --git a/scripts/pregenerate/using_codegen.py b/scripts/pregenerate/using_codegen.py index a48f187f5d9466..15c2e4ceb26ebf 100644 --- a/scripts/pregenerate/using_codegen.py +++ b/scripts/pregenerate/using_codegen.py @@ -14,9 +14,6 @@ import logging import os -import shlex -import subprocess -from enum import Enum, auto from .types import IdlFileType, InputIdlFile diff --git a/scripts/pregenerate/using_zap.py b/scripts/pregenerate/using_zap.py index 57df8ec42f7890..6af561b1a2921d 100644 --- a/scripts/pregenerate/using_zap.py +++ b/scripts/pregenerate/using_zap.py @@ -14,8 +14,6 @@ import logging import os -import shlex -import subprocess from enum import Enum, auto from .types import IdlFileType, InputIdlFile diff --git a/scripts/run-clang-tidy-on-compile-commands.py b/scripts/run-clang-tidy-on-compile-commands.py index 90ca9ed6cf9fac..d9dc6cdcfa374e 100755 --- a/scripts/run-clang-tidy-on-compile-commands.py +++ b/scripts/run-clang-tidy-on-compile-commands.py @@ -147,16 +147,16 @@ def Check(self): "Use -system-headers to display errors from system headers as well.", ] - for l in err.decode('utf-8').split('\n'): - l = l.strip() + for line in err.decode('utf-8').split('\n'): + line = line.strip() - if any(map(lambda s: s in l, skip_strings)): + if any(map(lambda s: s in line, skip_strings)): continue - if not l: + if not line: continue # no empty lines - logging.warning('TIDY %s: %s', self.file, l) + logging.warning('TIDY %s: %s', self.file, line) if proc.returncode != 0: if proc.returncode < 0: @@ -168,7 +168,7 @@ def Check(self): "Tidy %s ended with code %d", self.file, proc.returncode ) return TidyResult(self.full_path, False) - except: + except Exception: traceback.print_exc() return TidyResult(self.full_path, False) @@ -198,7 +198,7 @@ def find_darwin_gcc_sysroot(): if not line.startswith('Path: '): continue path = line[line.find(': ')+2:] - if not '/MacOSX.platform/' in path: + if '/MacOSX.platform/' not in path: continue logging.info("Found %s" % path) return path From e4a3b4be3796a2b460afca51d57e6564620b1ba5 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 11 Jul 2023 12:53:24 -0400 Subject: [PATCH 16/34] Fix exchange manager tests to handle losing timeslice better. (#27872) We could get into a situation where we lost the timeslice after the SendMessage call and before we asserted the response timeout had not happened yet, which would cause the test to fail. The changes here are: 1) Move the assert that we are not timed out to _before_ SendMessage(). This ensures that our state is correct up front, and generally nothing under SendMessage proper or sending the message should trigger a timeout per se. 2) Use more slack when waiting for the timeout, just in case. Fixes https://github.com/project-chip/connectedhomeip/issues/27479 --- src/messaging/tests/TestExchangeMgr.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/messaging/tests/TestExchangeMgr.cpp b/src/messaging/tests/TestExchangeMgr.cpp index cd938adcba41dc..b3fbba2f1b98bc 100644 --- a/src/messaging/tests/TestExchangeMgr.cpp +++ b/src/messaging/tests/TestExchangeMgr.cpp @@ -179,16 +179,19 @@ void CheckSessionExpirationDuringTimeout(nlTestSuite * inSuite, void * inContext ExpireSessionFromTimeoutDelegate sendDelegate; ExchangeContext * ec1 = ctx.NewExchangeToBob(&sendDelegate); - ec1->SetResponseTimeout(System::Clock::Timeout(100)); + auto timeout = System::Clock::Timeout(100); + ec1->SetResponseTimeout(timeout); + + NL_TEST_ASSERT(inSuite, !sendDelegate.IsOnResponseTimeoutCalled); ec1->SendMessage(Protocols::BDX::Id, kMsgType_TEST1, System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize), SendFlags(Messaging::SendMessageFlags::kExpectResponse).Set(Messaging::SendMessageFlags::kNoAutoRequestAck)); - ctx.DrainAndServiceIO(); - NL_TEST_ASSERT(inSuite, !sendDelegate.IsOnResponseTimeoutCalled); - // Wait for our timeout to elapse. Give it an extra 100ms. - ctx.GetIOContext().DriveIOUntil(200_ms32, [&sendDelegate] { return sendDelegate.IsOnResponseTimeoutCalled; }); + // Wait for our timeout to elapse. Give it an extra 1000ms of slack, + // because if we lose the timeslice for longer than the slack we could end + // up breaking out of the loop before the timeout timer has actually fired. + ctx.GetIOContext().DriveIOUntil(timeout + 1000_ms32, [&sendDelegate] { return sendDelegate.IsOnResponseTimeoutCalled; }); NL_TEST_ASSERT(inSuite, sendDelegate.IsOnResponseTimeoutCalled); From b95f14412c594474ff9aa615a0b2ec2f714c4252 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 11 Jul 2023 12:53:59 -0400 Subject: [PATCH 17/34] Fix py matter idl types (#27897) * Fix strict python typing errors in py_matter_idl * Restyle --------- Co-authored-by: Andrei Litvin --- .../matter_idl/generators/cpp/tlvmeta/__init__.py | 8 +++++--- .../py_matter_idl/matter_idl/generators/java/__init__.py | 2 +- .../py_matter_idl/matter_idl/zapxml/handlers/parsing.py | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/py_matter_idl/matter_idl/generators/cpp/tlvmeta/__init__.py b/scripts/py_matter_idl/matter_idl/generators/cpp/tlvmeta/__init__.py index 0bd57e28ac69f2..23e7e39f57ac08 100644 --- a/scripts/py_matter_idl/matter_idl/generators/cpp/tlvmeta/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/cpp/tlvmeta/__init__.py @@ -200,7 +200,8 @@ def GenerateTables(self) -> Generator[Table, None, None]: code="ConstantValueTag(0x%X)" % entry.code, name=entry.name, reference=None, - real_type="%s::%s::%s" % (self.cluster.name, e.name, entry.name) + real_type="%s::%s::%s" % ( + self.cluster.name, e.name, entry.name) ) for entry in e.entries ] @@ -214,7 +215,8 @@ def GenerateTables(self) -> Generator[Table, None, None]: code="ConstantValueTag(0x%X)" % entry.code, name=entry.name, reference=None, - real_type="%s::%s::%s" % (self.cluster.name, e.name, entry.name) + real_type="%s::%s::%s" % ( + self.cluster.name, e.name, entry.name) ) for entry in e.entries ] @@ -245,7 +247,7 @@ def IndexInTable(name: Optional[str], table: List[Table]) -> str: for idx, t in enumerate(table): if t.full_name == name: # Index skipping hard-coded items - return idx + 2 + return "%d" % (idx + 2) raise Exception("Name %r not found in table" % name) diff --git a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py index 0dd602eb136eb3..3f974d3b2d8d18 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py @@ -550,7 +550,7 @@ def GlobalEncodableValueFrom(typeName: str, context: TypeLookupContext) -> Encod """ Filter to convert a global type name to an encodable value """ - return EncodableValue(context, DataType(name=typeName), {}) + return EncodableValue(context, DataType(name=typeName), set()) def EncodableValueFrom(field: Field, context: TypeLookupContext) -> EncodableValue: diff --git a/scripts/py_matter_idl/matter_idl/zapxml/handlers/parsing.py b/scripts/py_matter_idl/matter_idl/zapxml/handlers/parsing.py index c6f057b992f611..e6620e0f01fdc6 100644 --- a/scripts/py_matter_idl/matter_idl/zapxml/handlers/parsing.py +++ b/scripts/py_matter_idl/matter_idl/zapxml/handlers/parsing.py @@ -12,11 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Optional + from matter_idl.generators.types import GetDataTypeSizeInBits, IsSignedDataType from matter_idl.matter_idl_types import AccessPrivilege, Attribute, AttributeQuality, DataType, Field, FieldQuality -def ParseInt(value: str, data_type: DataType = None) -> int: +def ParseInt(value: str, data_type: Optional[DataType] = None) -> int: """ Convert a string that is a known integer into an actual number. From 17efcdd59fec364c16c447abc8df0d0c608dc497 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Tue, 11 Jul 2023 13:21:52 -0400 Subject: [PATCH 18/34] Timesync: Add max size name check (#27619) See https://github.com/CHIP-Specifications/chip-test-plans/pull/2978 also fix offset on > max name check --- src/python_testing/TC_TIMESYNC_2_4.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/python_testing/TC_TIMESYNC_2_4.py b/src/python_testing/TC_TIMESYNC_2_4.py index 7ad3dfe840aaaa..a66ecc33599d91 100644 --- a/src/python_testing/TC_TIMESYNC_2_4.py +++ b/src/python_testing/TC_TIMESYNC_2_4.py @@ -114,11 +114,16 @@ async def test_TC_TIMESYNC_2_4(self): tz = [tz_struct(offset=50401, validAt=0)] await self.send_set_time_zone_cmd_expect_error(tz=tz, error=Status.ConstraintError) - self.print_step(14, "Send SetTimeZone command - too long name") - tz = [tz_struct(offset=50401, validAt=0, name="AVeryLongStringWithSixtyFiveChars/ThisIsSomeExtraPaddingForTheStr")] + self.print_step(14, "Send SetTimeZone command with max sized name") + tz = [tz_struct(offset=0, validAt=0, name="AVeryLongStringWithSixtyFourChars/ThisIsSomeExtraPaddingForTheSt")] + ret = await self.send_set_time_zone_cmd(tz=tz) + asserts.assert_true(ret.DSTOffsetRequired, "DSTOffsetRequired not set to true") + + self.print_step(15, "Send SetTimeZone command - too long name") + tz = [tz_struct(offset=0, validAt=0, name="AVeryLongStringWithSixtyFiveChars/ThisIsSomeExtraPaddingForTheStr")] await self.send_set_time_zone_cmd_expect_error(tz=tz, error=Status.ConstraintError) - self.print_step(15, "Send SetTimeZone command - too many entries") + self.print_step(16, "Send SetTimeZone command - too many entries") if tz_max_size_dut == 2: tz = [tz_struct(offset=3600, validAt=0, name="Europe/Dublin"), tz_struct(offset=7200, validAt=utc_time_in_matter_epoch() + @@ -128,7 +133,7 @@ async def test_TC_TIMESYNC_2_4(self): ] await self.send_set_time_zone_cmd_expect_error(tz=tz, error=Status.ResourceExhausted) - self.print_step(16, "Send SetTimeZone command - too many entries") + self.print_step(17, "Send SetTimeZone command - too many entries") if tz_max_size_dut == 1: tz = [tz_struct(offset=3600, validAt=0, name="Europe/Dublin"), tz_struct(offset=7200, validAt=utc_time_in_matter_epoch() + @@ -136,7 +141,7 @@ async def test_TC_TIMESYNC_2_4(self): ] await self.send_set_time_zone_cmd_expect_error(tz=tz, error=Status.ResourceExhausted) - self.print_step(17, "Reset time zone") + self.print_step(18, "Reset time zone") tz = [tz_struct(offset=0, validAt=0)] await self.send_set_time_zone_cmd(tz=tz) From f0fefda3bfdd4b5dd6b64d1a102f68ed551ce097 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 17:30:04 +0000 Subject: [PATCH 19/34] Bump github/issue-labeler from 3.1 to 3.2 (#27850) Bumps [github/issue-labeler](https://github.com/github/issue-labeler) from 3.1 to 3.2. - [Release notes](https://github.com/github/issue-labeler/releases) - [Commits](https://github.com/github/issue-labeler/compare/v3.1...v3.2) --- updated-dependencies: - dependency-name: github/issue-labeler dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/issue-labeler.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-labeler.yaml b/.github/workflows/issue-labeler.yaml index c04bcee2bb459e..b1c8e2304469bd 100644 --- a/.github/workflows/issue-labeler.yaml +++ b/.github/workflows/issue-labeler.yaml @@ -11,7 +11,7 @@ jobs: triage: runs-on: ubuntu-latest steps: - - uses: github/issue-labeler@v3.1 #May not be the latest version + - uses: github/issue-labeler@v3.2 #May not be the latest version with: configuration-path: .github/issue-labeler.yml not-before: 2020-01-15T02:54:32Z From 4f879713da893c822794aa0f1bbb2858943d57fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 17:30:32 +0000 Subject: [PATCH 20/34] Bump actions/checkout from 2 to 3 (#27848) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/cherry-picks.yaml | 2 +- .github/workflows/docbuild.yaml | 2 +- .github/workflows/doxygen.yaml | 2 +- .github/workflows/full-android.yaml | 2 +- .github/workflows/gradle-wrapper-validation.yml | 2 +- .github/workflows/java-tests.yaml | 2 +- .github/workflows/kotlin-style.yaml | 4 ++-- .github/workflows/tests.yaml | 6 +++--- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cherry-picks.yaml b/.github/workflows/cherry-picks.yaml index 0fd7802dc461f4..d7ef371214f890 100644 --- a/.github/workflows/cherry-picks.yaml +++ b/.github/workflows/cherry-picks.yaml @@ -20,7 +20,7 @@ jobs: ) steps: - name: Checkout - uses: actions/checkout@v3.5.2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Cherry-Pick into sve branch diff --git a/.github/workflows/docbuild.yaml b/.github/workflows/docbuild.yaml index ac2a8072c8045e..f49a9e660b4d12 100644 --- a/.github/workflows/docbuild.yaml +++ b/.github/workflows/docbuild.yaml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout the code - uses: actions/checkout@v3.5.2 + uses: actions/checkout@v3 with: path: matter fetch-depth: 0 diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index b65b2c02b2bc7d..02f78481b89063 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -89,7 +89,7 @@ jobs: - name: "Print Actor" run: echo ${{github.actor}} - name: Checkout - uses: actions/checkout@v3.5.2 + uses: actions/checkout@v3 - name: Generate run: scripts/helpers/doxygen.sh - name: Extract branch name diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 2ec4fdcca3e7ae..bf2c2f391b961a 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -51,7 +51,7 @@ jobs: # Note you likely still need to have non submodules setup for the # local machine, like: # git submodule deinit --all - - uses: actions/checkout@v3.5.2 + - uses: actions/checkout@v3 if: ${{ env.ACT }} name: Checkout (ACT for local build) - name: Checkout submodules & Bootstrap diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 913c5672e3c09e..8bfd0dcf51f572 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -6,5 +6,5 @@ jobs: name: "Validation" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.5.2 + - uses: actions/checkout@v3 - uses: gradle/wrapper-validation-action@v1 diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 8c2e2aa1189a06..a61175403e801c 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -46,7 +46,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3.5.2 + uses: actions/checkout@v3 - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: diff --git a/.github/workflows/kotlin-style.yaml b/.github/workflows/kotlin-style.yaml index 3df657b810849e..535f4cd8c30426 100644 --- a/.github/workflows/kotlin-style.yaml +++ b/.github/workflows/kotlin-style.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: "checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: "detekt" uses: natiginfo/action-detekt-all@1.23.0 @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-java@v2 with: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index dff906bc08feb5..5aa759bed4807c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -60,7 +60,7 @@ jobs: # Note you likely still need to have non submodules setup for the # local machine, like: # git submodule deinit --all - - uses: actions/checkout@v3.5.2 + - uses: actions/checkout@v3 if: ${{ env.ACT }} name: Checkout (ACT for local build) - name: Checkout submodules & Bootstrap @@ -411,7 +411,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3.5.2 + uses: actions/checkout@v3 - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: @@ -480,7 +480,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3.5.2 + uses: actions/checkout@v3 - name: Setup Environment # coreutils for stdbuf run: brew install coreutils From 8254563c7924658f38b1adf7a02ed6b3d6ed7f4e Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 11 Jul 2023 10:32:00 -0700 Subject: [PATCH 21/34] Reformat kotlin code (#27827) * Reformat kotlin code * Check if java is installed * Restyled by shfmt --------- Co-authored-by: Restyled.io --- scripts/helpers/kotlin-format.sh | 35 ++++++++++++++++++++++++++++++++ scripts/helpers/restyle-diff.sh | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 scripts/helpers/kotlin-format.sh diff --git a/scripts/helpers/kotlin-format.sh b/scripts/helpers/kotlin-format.sh new file mode 100755 index 00000000000000..1debecfb8d6899 --- /dev/null +++ b/scripts/helpers/kotlin-format.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# +# 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. +# + +here=${0%/*} + +set -e + +CHIP_ROOT=$(cd "$here/../.." && pwd) +cd "$CHIP_ROOT" + +if ! command -v java &>/dev/null; then + echo "Java is not installed. Please install Java and try again." + exit 1 +fi + +if [ ! -f "/tmp/ktfmt-0.44-jar-with-dependencies.jar" ]; then + wget "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.44/ktfmt-0.44-jar-with-dependencies.jar" -P /tmp +fi + +find src examples -name '*.kt' | xargs java -jar /tmp/ktfmt-0.44-jar-with-dependencies.jar --google-style diff --git a/scripts/helpers/restyle-diff.sh b/scripts/helpers/restyle-diff.sh index 6b5f25cd259400..7c29ac61d34335 100755 --- a/scripts/helpers/restyle-diff.sh +++ b/scripts/helpers/restyle-diff.sh @@ -48,5 +48,5 @@ if [[ -z "$ref" ]]; then git remote | grep -qxF upstream && ref="upstream/master" fi -declare -a paths="($(git diff --ignore-submodules --name-only --merge-base "$ref"))" +declare -a paths=("$(git diff --ignore-submodules --name-only --merge-base "$ref")") restyle-paths "${paths[@]}" From 3e8d8b01bbdec9545f2ec6d0d29a419cf7d06815 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 11 Jul 2023 13:56:44 -0400 Subject: [PATCH 22/34] Increase our "waiting for subscription to time out" timer slack. (#27870) 100ms is not enough: we have tests losing the timeslice for that long, and then we break out of our "waiting for timeout" loop before we process the firing of the timeout timer. Fixes https://github.com/project-chip/connectedhomeip/issues/27829 --- src/controller/tests/data_model/TestRead.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/controller/tests/data_model/TestRead.cpp b/src/controller/tests/data_model/TestRead.cpp index 7be8008b7d7c9a..4bf94757e835e0 100644 --- a/src/controller/tests/data_model/TestRead.cpp +++ b/src/controller/tests/data_model/TestRead.cpp @@ -4645,14 +4645,15 @@ void TestReadInteraction::TestReadHandler_KeepSubscriptionTest(nlTestSuite * apS System::Clock::Timeout TestReadInteraction::ComputeSubscriptionTimeout(System::Clock::Seconds16 aMaxInterval) { - // Add 100ms of slack to our max interval to make sure we hit the - // subscription liveness timer. + // Add 1000ms of slack to our max interval to make sure we hit the + // subscription liveness timer. 100ms was tried in the past and is not + // sufficient: our process can easily lose the timeslice for 100ms. const auto & ourMrpConfig = GetDefaultMRPConfig(); auto publisherTransmissionTimeout = GetRetransmissionTimeout(ourMrpConfig.mActiveRetransTimeout, ourMrpConfig.mIdleRetransTimeout, System::SystemClock().GetMonotonicTimestamp(), Transport::kMinActiveTime); - return publisherTransmissionTimeout + aMaxInterval + System::Clock::Milliseconds32(100); + return publisherTransmissionTimeout + aMaxInterval + System::Clock::Milliseconds32(1000); } // clang-format off From c270578663b3e0ea98fde8cea44c1d75af256d51 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 11 Jul 2023 14:09:54 -0400 Subject: [PATCH 23/34] Enable tracing for all linux app builds (#27871) * Enable tracing support for all linux apps * Restyled by gn * Add some output cleaning steps for standalone builds --------- Co-authored-by: Restyled.io --- .github/workflows/examples-linux-standalone.yaml | 6 ++++++ examples/all-clusters-app/linux/args.gni | 5 +++++ examples/all-clusters-minimal-app/linux/args.gni | 5 +++++ examples/bridge-app/linux/args.gni | 5 +++++ examples/contact-sensor-app/linux/args.gni | 4 ++++ examples/lock-app/linux/args.gni | 4 ++++ examples/log-source-app/linux/args.gni | 5 +++++ examples/ota-provider-app/linux/args.gni | 4 ++++ examples/ota-requestor-app/linux/args.gni | 4 ++++ examples/persistent-storage/linux/args.gni | 4 ++++ examples/placeholder/linux/args.gni | 4 ++++ examples/thermostat/linux/args.gni | 4 ++++ examples/tv-app/linux/args.gni | 5 +++++ examples/tv-casting-app/linux/args.gni | 5 +++++ 14 files changed, 64 insertions(+) diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 3bd48a1960b8ba..3613a6e39781fc 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -94,6 +94,8 @@ jobs: linux debug all-clusters-app \ out/linux-x64-all-clusters/chip-all-clusters-app \ /tmp/bloat_reports/ + - name: Clean out build output + run: rm -rf ./out - name: Build example Standalone All Clusters Minimal Server run: | ./scripts/run_in_build_env.sh \ @@ -134,6 +136,8 @@ jobs: linux debug+rpc+ui lighting-app \ out/linux-x64-light-rpc-with-ui/chip-lighting-app \ /tmp/bloat_reports/ + - name: Clean out build output + run: rm -rf ./out - name: Build example Standalone Bridge run: | ./scripts/run_in_build_env.sh \ @@ -164,6 +168,8 @@ jobs: linux debug ota-requestor-app \ out/linux-x64-ota-requestor/chip-ota-requestor-app \ /tmp/bloat_reports/ + - name: Clean out build output + run: rm -rf ./out - name: Build example Standalone Lock App run: | ./scripts/run_in_build_env.sh \ diff --git a/examples/all-clusters-app/linux/args.gni b/examples/all-clusters-app/linux/args.gni index 703c3576d66c19..49ecbd6dff99e8 100644 --- a/examples/all-clusters-app/linux/args.gni +++ b/examples/all-clusters-app/linux/args.gni @@ -23,3 +23,8 @@ chip_system_project_config_include = "" chip_project_config_include_dirs = [ "${chip_root}/examples/all-clusters-app/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] + +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/all-clusters-minimal-app/linux/args.gni b/examples/all-clusters-minimal-app/linux/args.gni index dc89c1c4d16b31..a87d4da8fd9320 100644 --- a/examples/all-clusters-minimal-app/linux/args.gni +++ b/examples/all-clusters-minimal-app/linux/args.gni @@ -23,3 +23,8 @@ chip_system_project_config_include = "" chip_project_config_include_dirs = [ "${chip_root}/examples/all-clusters-minimal-app/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] + +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/bridge-app/linux/args.gni b/examples/bridge-app/linux/args.gni index 7039d20e181994..ba90537f6ea0b7 100644 --- a/examples/bridge-app/linux/args.gni +++ b/examples/bridge-app/linux/args.gni @@ -23,3 +23,8 @@ chip_system_project_config_include = "" chip_project_config_include_dirs = [ "${chip_root}/examples/bridge-app/bridge-common/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] + +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/contact-sensor-app/linux/args.gni b/examples/contact-sensor-app/linux/args.gni index 0d9ddb3d2d5e8d..a94078f1c1c071 100644 --- a/examples/contact-sensor-app/linux/args.gni +++ b/examples/contact-sensor-app/linux/args.gni @@ -25,3 +25,7 @@ chip_system_project_config_include = "" chip_project_config_include_dirs = [ "${chip_root}/examples/contact-sensor-app/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/lock-app/linux/args.gni b/examples/lock-app/linux/args.gni index 703c3576d66c19..e01c49ddbbdf34 100644 --- a/examples/lock-app/linux/args.gni +++ b/examples/lock-app/linux/args.gni @@ -23,3 +23,7 @@ chip_system_project_config_include = "" chip_project_config_include_dirs = [ "${chip_root}/examples/all-clusters-app/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/log-source-app/linux/args.gni b/examples/log-source-app/linux/args.gni index 311ddab32d5fe5..5c36fb0cb40b6f 100644 --- a/examples/log-source-app/linux/args.gni +++ b/examples/log-source-app/linux/args.gni @@ -15,3 +15,8 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") + +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/ota-provider-app/linux/args.gni b/examples/ota-provider-app/linux/args.gni index 75fe130a3dfd81..442c2ba4d43edc 100644 --- a/examples/ota-provider-app/linux/args.gni +++ b/examples/ota-provider-app/linux/args.gni @@ -23,3 +23,7 @@ chip_system_project_config_include = "" chip_project_config_include_dirs = [ "${chip_root}/examples/ota-provider-app/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/ota-requestor-app/linux/args.gni b/examples/ota-requestor-app/linux/args.gni index 87c6eb3c1f59de..ee072aeca2defc 100644 --- a/examples/ota-requestor-app/linux/args.gni +++ b/examples/ota-requestor-app/linux/args.gni @@ -25,3 +25,7 @@ chip_project_config_include_dirs = chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] chip_enable_ota_requestor = true +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/persistent-storage/linux/args.gni b/examples/persistent-storage/linux/args.gni index a6463ca2c05fae..7ee4af9262fd15 100644 --- a/examples/persistent-storage/linux/args.gni +++ b/examples/persistent-storage/linux/args.gni @@ -15,3 +15,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/placeholder/linux/args.gni b/examples/placeholder/linux/args.gni index c38d497d4340cb..7a3a063a488116 100644 --- a/examples/placeholder/linux/args.gni +++ b/examples/placeholder/linux/args.gni @@ -22,3 +22,7 @@ chip_project_config_include = "" chip_project_config_include_dirs = [ "${chip_root}/examples/placeholder/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/thermostat/linux/args.gni b/examples/thermostat/linux/args.gni index 311ddab32d5fe5..9de55497298118 100644 --- a/examples/thermostat/linux/args.gni +++ b/examples/thermostat/linux/args.gni @@ -15,3 +15,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/tv-app/linux/args.gni b/examples/tv-app/linux/args.gni index 266d8cbe2c7b58..5193be22ff4cbb 100644 --- a/examples/tv-app/linux/args.gni +++ b/examples/tv-app/linux/args.gni @@ -29,3 +29,8 @@ chip_build_libshell = true chip_enable_additional_data_advertising = true chip_enable_rotating_device_id = true + +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" diff --git a/examples/tv-casting-app/linux/args.gni b/examples/tv-casting-app/linux/args.gni index f882ed23024643..0fb9de6aafe83f 100644 --- a/examples/tv-casting-app/linux/args.gni +++ b/examples/tv-casting-app/linux/args.gni @@ -31,3 +31,8 @@ chip_enable_additional_data_advertising = true chip_enable_rotating_device_id = true chip_max_discovered_ip_addresses = 20 + +matter_enable_tracing_support = true + +# Perfetto requires C++17 +cpp_standard = "gnu++17" From e522e4e21bd8795bd35d2e8f29d2caa831fb8223 Mon Sep 17 00:00:00 2001 From: Evgeny Margolis Date: Tue, 11 Jul 2023 08:16:48 -1000 Subject: [PATCH 24/34] Implemented ExtractCRLDistributionPointURIFromX509Cert() Helper Function (#26913) * Implemented ExtractCRLDistributionPointURIFromX509Cert() Helper Function - Extracts the CRL Distribution Point (CDP) extension from an X509 ASN.1 Encoded Certificate - The returned value only covers the URI of the CDP - Only a single URI distribution point GeneralName is supported - The valid URL should start with "http://" or "https://" - Added OpenSSL, mbedTLS, and TinyCrypt implementations - Added CDP extension support to the chip-cert tool - Added new test vectors * Update OpenSSL Impelementation to Address Review Comments. Added documentation to clarify each step of the implementation. * Added documentation to the mbedTLS-based implementations * Restyled by clang-format --------- Co-authored-by: Restyled.io --- ...hip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.der | Bin 0 -> 596 bytes ...hip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.pem | 15 + ...Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.der | Bin 0 -> 121 bytes ...Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.pem | 5 + ...Test-DAC-FFF1-8000-0000-CDP-2URIs-Cert.der | Bin 0 -> 590 bytes ...Test-DAC-FFF1-8000-0000-CDP-2URIs-Cert.pem | 15 + ...-Test-DAC-FFF1-8000-0000-CDP-2URIs-Key.der | Bin 0 -> 121 bytes ...-Test-DAC-FFF1-8000-0000-CDP-2URIs-Key.pem | 5 + .../Chip-Test-DAC-FFF1-8000-0000-CDP-Cert.der | Bin 0 -> 551 bytes .../Chip-Test-DAC-FFF1-8000-0000-CDP-Cert.pem | 14 + ...Test-DAC-FFF1-8000-0000-CDP-HTTPS-Cert.der | Bin 0 -> 553 bytes ...Test-DAC-FFF1-8000-0000-CDP-HTTPS-Cert.pem | 14 + ...-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Key.der | Bin 0 -> 121 bytes ...-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Key.pem | 5 + .../Chip-Test-DAC-FFF1-8000-0000-CDP-Key.der | Bin 0 -> 121 bytes .../Chip-Test-DAC-FFF1-8000-0000-CDP-Key.pem | 5 + ...-Test-DAC-FFF1-8000-0000-CDP-Long-Cert.der | Bin 0 -> 599 bytes ...-Test-DAC-FFF1-8000-0000-CDP-Long-Cert.pem | 15 + ...p-Test-DAC-FFF1-8000-0000-CDP-Long-Key.der | Bin 0 -> 121 bytes ...p-Test-DAC-FFF1-8000-0000-CDP-Long-Key.pem | 5 + ...C-FFF1-8000-0000-CDP-Wrong-Prefix-Cert.der | Bin 0 -> 521 bytes ...C-FFF1-8000-0000-CDP-Wrong-Prefix-Cert.pem | 13 + ...AC-FFF1-8000-0000-CDP-Wrong-Prefix-Key.der | Bin 0 -> 121 bytes ...AC-FFF1-8000-0000-CDP-Wrong-Prefix-Key.pem | 5 + .../test/gen-test-attestation-certs.sh | 59 ++- .../tests/CHIPAttCert_test_vectors.cpp | 364 +++++++++++++++++- .../tests/CHIPAttCert_test_vectors.h | 32 +- src/crypto/CHIPCryptoPAL.h | 14 + src/crypto/CHIPCryptoPALOpenSSL.cpp | 81 ++++ src/crypto/CHIPCryptoPALPSA.cpp | 123 ++++++ src/crypto/CHIPCryptoPALmbedTLS.cpp | 123 ++++++ src/crypto/tests/CHIPCryptoPALTest.cpp | 49 +++ .../common/crypto/CHIPCryptoPALTinyCrypt.cpp | 123 ++++++ .../crypto/CHIPCryptoPALNXPUltrafastP256.cpp | 123 ++++++ .../silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp | 123 ++++++ .../silabs/efr32/CHIPCryptoPALPsaEfr32.cpp | 123 ++++++ src/tools/chip-cert/CertUtils.cpp | 11 +- src/tools/chip-cert/Cmd_GenAttCert.cpp | 41 +- src/tools/chip-cert/chip-cert.h | 3 +- 39 files changed, 1487 insertions(+), 21 deletions(-) create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-2URIs-Cert.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-2URIs-Cert.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-2URIs-Key.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-2URIs-Key.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Cert.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Cert.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Cert.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Cert.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Key.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Key.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Key.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Key.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Cert.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Cert.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Key.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Key.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Cert.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Cert.pem create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Key.der create mode 100644 credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Key.pem diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.der b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..880b441bd42cc6ca50f5790b0ad817706dc771c6 GIT binary patch literal 596 zcmXqLVhS*5V*Iv%nTe5!iNiDZ_igLAP0j{fY#dr`9_MUXn3)XR3?&T2*qB3En0fep z6H7``ixfgqi%S#&96b$1420OYwAmP07@HQ=FfsD5xVgC*qKPu`uvi!Xfr2=%k)eT^ zk%gg&k+F$!lmx#e5EvR61Cgnvsb!Qwh@qN+3dAN^WSd+ZofW_)gp}tiIJ*QCquGGp z-be#sHg>RYm>8knVrFD#c4A=hS{wI8@mKpI&a5vDF~_%^y3hap!Uj{5%Yy2YZp>l4 zFT7op@zW93j7hV9%-*fRzaf1xuaAb)&*C7VaLfK}Mw9L=Zrp3oxXXYC=ww-8M#ldv zOa=@Fd>|e_hzATj_67r45TB1lj77xt&L7iLk{X4J--&G!?aq*X{IaXZKprHm%mNJJ z29fnn+c|w-Ulo0mciwo1pr}&3QBa404oHDKi>iULf#L%B1+s0@86_nJ#a8RAVYO0;@)fW@Zlt16L*mEenRd)(o?ru_%^8x- zmdL*T?bKQCd7>G$`FGBv2FUMgdVBA-{Pn2sk~<@t)`gecxTdPK_vjX CE38QX literal 0 HcmV?d00001 diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.pem b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.pem new file mode 100644 index 00000000000000..e9568978ab1aea --- /dev/null +++ b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICUDCCAfagAwIBAgIISW372zteskMwCgYIKoZIzj0EAwIwRjEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQB +gqJ8AgIMBDgwMDAwIBcNMjEwNjI4MTQyMzQzWhgPOTk5OTEyMzEyMzU5NTlaMFQx +JjAkBgNVBAMMHU1hdHRlciBUZXN0IERBQyAwMDAwIFR3byBDRFBzMRQwEgYKKwYB +BAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAwWTATBgcqhkjOPQIB +BggqhkjOPQMBBwNCAARKrV70IfqHoglq9IBcx7bK3w/30LA1NNMRJ5LYnAHfE7cV +AfLEBWiSm/ibuygPsGeTDUwoQvlzUhJXOY+2MpLco4G9MIG6MAwGA1UdEwEB/wQC +MAAwDgYDVR0PAQH/BAQDAgeAMB0GA1UdDgQWBBRF3Pw1yhkocaPuFrIVi2gb4+mK +jDAfBgNVHSMEGDAWgBSvQrcJTevVFexuzzO4ERUiXzJSiDAsBgNVHR8EJTAjMCGg +H6AdhhtodHRwczovL2V4YW1wbGUuY29tL2NybC5wZW0wLAYDVR0fBCUwIzAhoB+g +HYYbaHR0cDovL2V4YW1wbGUuY29tL2NybDIucGVtMAoGCCqGSM49BAMCA0gAMEUC +ICo4AL07AB1JwKlxGLhw/UsJVGsGYQev7ZWa7wxbASuPAiEA4YlR6OPubKM9Z7Jg +jBq99l+UvHneNRsmIWpB3JKzESI= +-----END CERTIFICATE----- diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.der b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..6db711ca7bde9c17d06f721587d41036be8165c0 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$9DLf8*RoJGcPYNtuQA%Fq4*vQ%_#BN2{N?d5D-+rJ91_&yK zNX|V20SBQ(13~}A^L}+32O9!T*tP`-w*fDur)N(5hs$^oB`hxw-o{M#06-Q boA{f%C=ak_lMPHLLiux25?48owlb335lu9W literal 0 HcmV?d00001 diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.pem b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.pem new file mode 100644 index 00000000000000..39a7c256c79722 --- /dev/null +++ b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIJj6QtgPRpxFxnBqp0m+IYABttjI2ijEbkXYSlxoqN9+oAoGCCqGSM49 +AwEHoUQDQgAESq1e9CH6h6IJavSAXMe2yt8P99CwNTTTESeS2JwB3xO3FQHyxAVo +kpv4m7soD7Bnkw1MKEL5c1ISVzmPtjKS3A== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-2URIs-Cert.der b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-2URIs-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..3e725cc85cd818fade063a80fae48781c44d7d53 GIT binary patch literal 590 zcmXqLV)8O*V*IdxnTe5!i6h=dWNF!~P+bEqHV&;ek8`#x%uEJuh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j-G}h210CH+H8z0j7^Jbm>79j+}zv@(L|YeSS$>HKtY_>$k4#d z$imRX$k@aykfymU-)H2E-%23BZ3u2QpvP~|I&I(`?oLvGGG(yVr6+(kN zi#5^g!Ebw{fiN38*iTH1P|q=%sBmLEOwGKurFAWPQ!^?lmRGq-7eRbY17(qmFJac2AD@WqWA4I0-O@Bkey zE6m9FpM}YQ!GI6M;|KA8LCD@BLE0aQ&h{<7}%UgY9 zmd`%Q;q?6O)wkO#jxK6_xh^E}zigRhJ(D8CTi-{_m!hs-F8saOH)hWFeJh2ob-2cP O-G888&zWN1u?GN$I(=BLHT>0$}X b5d>=QuZ}ANnYJnQAOk|Qj5K5FE8;4e#$2nUTW+nqSLkR;hHs(+kW*&au z#FCQKB88CD;u3`bM^8f$10gmpZ8k<0#->FzOpH7%Zf>nmZsK=NY*_oXfSROOV-J2g6wfW_)$*TW8Sx-A#7-RLy;#{L#$DiEi zYYfzse=le2w&T3~FJ!jhnRvd)9KYM=?5Y>3%kQ`_>x<$%+r^E2294bYJU~aw3NteP zXJIm6FyI66_(42i@Ub@-$b$HMEMhDo8O|q+7hBGs;UsFeam{)CsS)u~0S59QX=N5* zAUBAtciPVB`}(Tro4oVJI|N0Q;*Ekj475QCLPcF*QD@e^njyYxz1_M_ng;XyeVe6B(d_^iuSN~DDs`F;?g8oHcp1nG> wF2PaW?CTOHMTS)}3n$C(nf3pgyV2^;ax1FzOpH7%ZfQ%L+>t&1p^Ws)jur6-wH)!lJ-~qZ?R+y3T zKMRuqg8?6i#}DEG!;iheKo-R3V-aH!Sa#t9KC|nT;#Z8_Fyn@Wl{)!^XisOtoQbS)6aig^EYdTz*#iYovH9T(5a_N@3@~c-bIa{mDQ*;f;uS7M+3LT6@C<+UaEKnvjQ;2 literal 0 HcmV?d00001 diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Key.pem b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Key.pem new file mode 100644 index 00000000000000..ccd6216112c5e8 --- /dev/null +++ b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIASkFQOGOdFOYpJvRhpiVdejCwvcrGqYzfiLFnAqcp87oAoGCCqGSM49 +AwEHoUQDQgAE2Ssk3lFrjs0+aGLeh/w7935wEXHHC1mM/18CfwK4IOf6B7rU5Ni+ +JhwI+zGV1ag0gjoozEcDt8UVfhSeXqp4BQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Key.der b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..7d63f00c9bcfa480b6624c9304cdffeee1be57f2 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rw@k@)ma(=?@Yky6;3N@vzRsa0U+1_&yK zNX|V20SBQ(13~}<;{hJtpHW(~>AI68{_;DP&2d~h>Nw7U9*F#H=d3U$Bm1WYi#`d{ b{#2V0%wG;!Y);$GK6|1kAGpw(^dX)-&PX)- literal 0 HcmV?d00001 diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Key.pem b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Key.pem new file mode 100644 index 00000000000000..48fe09ad29812d --- /dev/null +++ b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIAZZ8hZ3GOkPEiO670Qo8bDOxHK1X7sH6ofXOYmc9zFqoAoGCCqGSM49 +AwEHoUQDQgAE4wEe3p9RWrPpupMl/vI7ls1xXDrqOM6BHoj8beesMCYj+6cGiz4J +0/5UmxHMXw5ZbE7bzj57oicfuNCa9CGePQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Cert.der b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..1ece300335a5fe455a5ab9cc6c3805be3d67b412 GIT binary patch literal 599 zcmXqLVhT2BV*I&)nTe5!i9H#av!G*KoV77GI)P!Q)eGBhwV zvM@9;GBz=elHj)l0z)HXATqTywTv>bHsm$nhS740wPplNDxU{LjKBg$nEDr|Bja<>;nl7MB!dCY6?C=I7}a*(QqeneSr*i)y-+5qtsZiDX6v8|1_&yK zNX|V20SBQ(13~}bx&~J8eY=<^}8HmoI8P?bIB`e1-3>-Cd literal 0 HcmV?d00001 diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Key.pem b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Key.pem new file mode 100644 index 00000000000000..d868b79ee31833 --- /dev/null +++ b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEINFUmafW3jhThp3mpGxLUtE7c1kW1Kq9UCaqrR5yeWbroAoGCCqGSM49 +AwEHoUQDQgAEQyj7uHFCjDXiJLN/noBkA1+yzHL48XEYU0bDIOGohbXkCQle7IVf +fVKvl6HQb3ZxbIc2fhmIzqEZ1tf0JSvHLw== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Cert.der b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..2ad2f7c7190a4dec4d7f1a22d134ac6d24ce157d GIT binary patch literal 521 zcmXqLVq!IDVqCp|nTe5!iKBpxW7WdzYjX{_*f_M>JkHs&Ff$pr8A=$4u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsL=$D=VX-g(0tIniBSQl- zBMUe~a zVfJ7!aAi_tc($WM?k(T4f~Errb#C8IwXhhjelYQxcx)q&#lj~aT+5jhEZO4s{rtN` e+I;=#jo)W6T1_&yK zNX|V20SBQ(13~}<{LRQIx?(qc#>ca6r@^mw%@xBayi0D42Y9+!f4lPv=MuJ8()sea b75F1ehvK6<_2*f3;7)4LJ%tO=WI6NCdHOjc literal 0 HcmV?d00001 diff --git a/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Key.pem b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Key.pem new file mode 100644 index 00000000000000..f9c33a94072281 --- /dev/null +++ b/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIKUdzfzZVduHJDVshxIakL0TGFN4p6mMcfRwRKKm2+vboAoGCCqGSM49 +AwEHoUQDQgAE/M3IKbpiN3zGx7Nup8Gvds0Vwyi8S26NB3i6WX+78wrnErZX0vny +uRX4I0yH4qM79edZduBOatA9hQvRZDnzzw== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/gen-test-attestation-certs.sh b/credentials/test/gen-test-attestation-certs.sh index 83bc7668a62bb2..04d0ba6130dac8 100755 --- a/credentials/test/gen-test-attestation-certs.sh +++ b/credentials/test/gen-test-attestation-certs.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # -# Copyright (c) 2021-2022 Project CHIP Authors +# Copyright (c) 2021-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. @@ -340,6 +340,59 @@ cert_lifetime=4294967295 "$chip_cert_tool" gen-att-cert --type i --subject-cn "Matter Test PAI" --subject-vid "$vid" --valid-from "$cert_valid_from" --lifetime "$cert_lifetime" --ca-key "$paa_key_file".pem --ca-cert "$paa_cert_file".pem --key "$pai_key_file".pem --out "$pai_cert_file".pem } +# Set #8: +# - Generate DACs with CRL Distribution Point (CDP) Extensions (Valid and Invalid cases) +{ + vid=FFF1 + pid=8000 + dac=0000 + + pai_key_file="$dest_dir/Chip-Test-PAI-$vid-$pid-Key" + pai_cert_file="$dest_dir/Chip-Test-PAI-$vid-$pid-Cert" + + dac_key_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-Key" + dac_cert_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-Cert" + + cdp_example="URI:http://example.com/crl.pem" + + "$chip_cert_tool" gen-att-cert --type d --subject-cn "Matter Test DAC $dac CDP (HTTP)" --subject-vid "$vid" --subject-pid "$pid" --valid-from "$cert_valid_from" --lifetime "$cert_lifetime" --cpd-ext "$cdp_example" --ca-key "$pai_key_file".pem --ca-cert "$pai_cert_file".pem --out-key "$dac_key_file".pem --out "$dac_cert_file".pem + + dac_key_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-HTTPS-Key" + dac_cert_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-HTTPS-Cert" + + cdp_example="URI:https://example.com/crl.pem" + + "$chip_cert_tool" gen-att-cert --type d --subject-cn "Matter Test DAC $dac CDP (HTTPS)" --subject-vid "$vid" --subject-pid "$pid" --valid-from "$cert_valid_from" --lifetime "$cert_lifetime" --cpd-ext "$cdp_example" --ca-key "$pai_key_file".pem --ca-cert "$pai_cert_file".pem --out-key "$dac_key_file".pem --out "$dac_cert_file".pem + + dac_key_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-2CDPs-Key" + dac_cert_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-2CDPs-Cert" + + cdp_example2="URI:http://example.com/crl2.pem" + + "$chip_cert_tool" gen-att-cert --type d --subject-cn "Matter Test DAC $dac Two CDPs" --subject-vid "$vid" --subject-pid "$pid" --valid-from "$cert_valid_from" --lifetime "$cert_lifetime" --cpd-ext "$cdp_example" --cpd-ext "$cdp_example2" --ca-key "$pai_key_file".pem --ca-cert "$pai_cert_file".pem --out-key "$dac_key_file".pem --out "$dac_cert_file".pem + + dac_key_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-2URIs-Key" + dac_cert_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-2URIs-Cert" + + cdp_example2in1="URI:http://example.com/crl.pem,URI:http://example.com/crl2.pem" + + "$chip_cert_tool" gen-att-cert --type d --subject-cn "Matter Test DAC $dac CDP (Two URIs)" --subject-vid "$vid" --subject-pid "$pid" --valid-from "$cert_valid_from" --lifetime "$cert_lifetime" --cpd-ext "$cdp_example2in1" --ca-key "$pai_key_file".pem --ca-cert "$pai_cert_file".pem --out-key "$dac_key_file".pem --out "$dac_cert_file".pem + + dac_key_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-Long-Key" + dac_cert_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-Long-Cert" + + cdp_example="URI:https://example.com/this-is-an-example-of-crl-distribution-point-extension-which-is-101-chars/crl.pem" + + "$chip_cert_tool" gen-att-cert --type d --subject-cn "Long" --subject-vid "$vid" --subject-pid "$pid" --valid-from "$cert_valid_from" --lifetime "$cert_lifetime" --cpd-ext "$cdp_example" --ca-key "$pai_key_file".pem --ca-cert "$pai_cert_file".pem --out-key "$dac_key_file".pem --out "$dac_cert_file".pem + + dac_key_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-Wrong-Prefix-Key" + dac_cert_file="$dest_dir/Chip-Test-DAC-$vid-$pid-$dac-CDP-Wrong-Prefix-Cert" + + cdp_example="URI:www.example.com/crl.pem" + + "$chip_cert_tool" gen-att-cert --type d --subject-cn "Long" --subject-vid "$vid" --subject-pid "$pid" --valid-from "$cert_valid_from" --lifetime "$cert_lifetime" --cpd-ext "$cdp_example" --ca-key "$pai_key_file".pem --ca-cert "$pai_cert_file".pem --out-key "$dac_key_file".pem --out "$dac_cert_file".pem +} + # In addition to PEM format also create certificates in DER form. for cert_file_pem in "$dest_dir"/*Cert.pem; do cert_file_der="${cert_file_pem/.pem/.der}" @@ -357,7 +410,7 @@ if [ ! -z "$output_cstyle_file" ]; then copyright_note='/* * - * Copyright (c) 2021-2022 Project CHIP Authors + * Copyright (c) 2021-2023 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -380,6 +433,8 @@ if [ ! -z "$output_cstyle_file" ]; then ' header_includes=' #pragma once + +#include ' namespaces_open=' diff --git a/src/credentials/tests/CHIPAttCert_test_vectors.cpp b/src/credentials/tests/CHIPAttCert_test_vectors.cpp index 82cda1285d8980..7318d5b925a4e5 100644 --- a/src/credentials/tests/CHIPAttCert_test_vectors.cpp +++ b/src/credentials/tests/CHIPAttCert_test_vectors.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021-2022 Project CHIP Authors + * Copyright (c) 2021-2023 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,6 +22,368 @@ namespace chip { namespace TestCerts { +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Cert.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_2CDPs_Cert_Array[] = { + 0x30, 0x82, 0x02, 0x50, 0x30, 0x82, 0x01, 0xf6, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x49, 0x6d, 0xfb, 0xdb, 0x3b, 0x5e, + 0xb2, 0x43, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x46, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x49, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, + 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, + 0x30, 0x30, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, + 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x54, 0x31, 0x26, 0x30, 0x24, + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1d, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x44, 0x41, + 0x43, 0x20, 0x30, 0x30, 0x30, 0x30, 0x20, 0x54, 0x77, 0x6f, 0x20, 0x43, 0x44, 0x50, 0x73, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, + 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, + 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, 0x30, 0x30, 0x59, 0x30, 0x13, + 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, + 0x00, 0x04, 0x4a, 0xad, 0x5e, 0xf4, 0x21, 0xfa, 0x87, 0xa2, 0x09, 0x6a, 0xf4, 0x80, 0x5c, 0xc7, 0xb6, 0xca, 0xdf, 0x0f, 0xf7, + 0xd0, 0xb0, 0x35, 0x34, 0xd3, 0x11, 0x27, 0x92, 0xd8, 0x9c, 0x01, 0xdf, 0x13, 0xb7, 0x15, 0x01, 0xf2, 0xc4, 0x05, 0x68, 0x92, + 0x9b, 0xf8, 0x9b, 0xbb, 0x28, 0x0f, 0xb0, 0x67, 0x93, 0x0d, 0x4c, 0x28, 0x42, 0xf9, 0x73, 0x52, 0x12, 0x57, 0x39, 0x8f, 0xb6, + 0x32, 0x92, 0xdc, 0xa3, 0x81, 0xbd, 0x30, 0x81, 0xba, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, + 0x30, 0x00, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x1d, 0x06, + 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x45, 0xdc, 0xfc, 0x35, 0xca, 0x19, 0x28, 0x71, 0xa3, 0xee, 0x16, 0xb2, 0x15, + 0x8b, 0x68, 0x1b, 0xe3, 0xe9, 0x8a, 0x8c, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xaf, + 0x42, 0xb7, 0x09, 0x4d, 0xeb, 0xd5, 0x15, 0xec, 0x6e, 0xcf, 0x33, 0xb8, 0x11, 0x15, 0x22, 0x5f, 0x32, 0x52, 0x88, 0x30, 0x2c, + 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x25, 0x30, 0x23, 0x30, 0x21, 0xa0, 0x1f, 0xa0, 0x1d, 0x86, 0x1b, 0x68, 0x74, 0x74, 0x70, + 0x73, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x70, + 0x65, 0x6d, 0x30, 0x2c, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x25, 0x30, 0x23, 0x30, 0x21, 0xa0, 0x1f, 0xa0, 0x1d, 0x86, 0x1b, + 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x72, + 0x6c, 0x32, 0x2e, 0x70, 0x65, 0x6d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, + 0x30, 0x45, 0x02, 0x20, 0x2a, 0x38, 0x00, 0xbd, 0x3b, 0x00, 0x1d, 0x49, 0xc0, 0xa9, 0x71, 0x18, 0xb8, 0x70, 0xfd, 0x4b, 0x09, + 0x54, 0x6b, 0x06, 0x61, 0x07, 0xaf, 0xed, 0x95, 0x9a, 0xef, 0x0c, 0x5b, 0x01, 0x2b, 0x8f, 0x02, 0x21, 0x00, 0xe1, 0x89, 0x51, + 0xe8, 0xe3, 0xee, 0x6c, 0xa3, 0x3d, 0x67, 0xb2, 0x60, 0x8c, 0x1a, 0xbd, 0xf6, 0x5f, 0x94, 0xbc, 0x79, 0xde, 0x35, 0x1b, 0x26, + 0x21, 0x6a, 0x41, 0xdc, 0x92, 0xb3, 0x11, 0x22, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_Cert = ByteSpan(sTestCert_DAC_FFF1_8000_0000_2CDPs_Cert_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_2CDPs_SKID_Array[] = { + 0x45, 0xDC, 0xFC, 0x35, 0xCA, 0x19, 0x28, 0x71, 0xA3, 0xEE, 0x16, 0xB2, 0x15, 0x8B, 0x68, 0x1B, 0xE3, 0xE9, 0x8A, 0x8C, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_SKID = ByteSpan(sTestCert_DAC_FFF1_8000_0000_2CDPs_SKID_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-2CDPs-Key.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_2CDPs_PublicKey_Array[] = { + 0x04, 0x4a, 0xad, 0x5e, 0xf4, 0x21, 0xfa, 0x87, 0xa2, 0x09, 0x6a, 0xf4, 0x80, 0x5c, 0xc7, 0xb6, 0xca, + 0xdf, 0x0f, 0xf7, 0xd0, 0xb0, 0x35, 0x34, 0xd3, 0x11, 0x27, 0x92, 0xd8, 0x9c, 0x01, 0xdf, 0x13, 0xb7, + 0x15, 0x01, 0xf2, 0xc4, 0x05, 0x68, 0x92, 0x9b, 0xf8, 0x9b, 0xbb, 0x28, 0x0f, 0xb0, 0x67, 0x93, 0x0d, + 0x4c, 0x28, 0x42, 0xf9, 0x73, 0x52, 0x12, 0x57, 0x39, 0x8f, 0xb6, 0x32, 0x92, 0xdc, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_PublicKey = ByteSpan(sTestCert_DAC_FFF1_8000_0000_2CDPs_PublicKey_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_2CDPs_PrivateKey_Array[] = { + 0x98, 0xfa, 0x42, 0xd8, 0x0f, 0x46, 0x9c, 0x45, 0xc6, 0x70, 0x6a, 0xa7, 0x49, 0xbe, 0x21, 0x80, + 0x01, 0xb6, 0xd8, 0xc8, 0xda, 0x28, 0xc4, 0x6e, 0x45, 0xd8, 0x4a, 0x5c, 0x68, 0xa8, 0xdf, 0x7e, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_PrivateKey = ByteSpan(sTestCert_DAC_FFF1_8000_0000_2CDPs_PrivateKey_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-2URIs-Cert.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_Cert_Array[] = { + 0x30, 0x82, 0x02, 0x4a, 0x30, 0x82, 0x01, 0xf0, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x5f, 0x3c, 0x14, 0xa5, 0x76, 0x9a, + 0x55, 0x2d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x46, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x49, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, + 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, + 0x30, 0x30, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, + 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x5a, 0x31, 0x2c, 0x30, 0x2a, + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x23, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x44, 0x41, + 0x43, 0x20, 0x30, 0x30, 0x30, 0x30, 0x20, 0x43, 0x44, 0x50, 0x20, 0x28, 0x54, 0x77, 0x6f, 0x20, 0x55, 0x52, 0x49, 0x73, 0x29, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, + 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, + 0x30, 0x30, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, + 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xda, 0x46, 0x42, 0x76, 0xca, 0x8a, 0x5b, 0x0f, 0x9f, 0x48, 0xcb, 0xa6, 0x07, + 0xff, 0xed, 0x92, 0xf6, 0xa8, 0x13, 0x14, 0x67, 0x61, 0xf8, 0x7b, 0xb9, 0x00, 0xef, 0x6c, 0x43, 0x6b, 0xe8, 0x01, 0xe6, 0xa7, + 0xc5, 0xc8, 0xe9, 0x62, 0x09, 0xcb, 0x11, 0x04, 0x6a, 0xef, 0xaf, 0x8e, 0x2b, 0x03, 0x99, 0xb6, 0x29, 0xf5, 0x20, 0x03, 0x42, + 0xb4, 0x8c, 0x34, 0x7a, 0x91, 0x99, 0x87, 0xe3, 0x57, 0xa3, 0x81, 0xb1, 0x30, 0x81, 0xae, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, + 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, + 0x02, 0x07, 0x80, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xcc, 0xac, 0x78, 0x09, 0x9a, 0xc4, 0x7f, + 0xad, 0x7a, 0x0e, 0xb9, 0x01, 0x2c, 0xc8, 0xf4, 0x22, 0x88, 0x09, 0xab, 0x61, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, + 0x18, 0x30, 0x16, 0x80, 0x14, 0xaf, 0x42, 0xb7, 0x09, 0x4d, 0xeb, 0xd5, 0x15, 0xec, 0x6e, 0xcf, 0x33, 0xb8, 0x11, 0x15, 0x22, + 0x5f, 0x32, 0x52, 0x88, 0x30, 0x4e, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x47, 0x30, 0x45, 0x30, 0x20, 0xa0, 0x1e, 0xa0, 0x1c, + 0x86, 0x1a, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x63, 0x72, 0x6c, 0x2e, 0x70, 0x65, 0x6d, 0x30, 0x21, 0xa0, 0x1f, 0xa0, 0x1d, 0x86, 0x1b, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x72, 0x6c, 0x32, 0x2e, 0x70, 0x65, 0x6d, + 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x6a, 0x14, + 0x34, 0xc3, 0x4c, 0xd3, 0xb5, 0x4c, 0x1c, 0xa7, 0x9b, 0xc5, 0x08, 0x42, 0xe7, 0xdd, 0xd5, 0xed, 0xb7, 0x78, 0xc5, 0xa2, 0x85, + 0xe9, 0xae, 0x54, 0x61, 0xff, 0x1d, 0x76, 0x39, 0x7f, 0x02, 0x21, 0x00, 0xed, 0x4d, 0xe2, 0x03, 0xd2, 0x5a, 0xd5, 0xd3, 0x71, + 0xfb, 0xb3, 0x4d, 0x5c, 0x9c, 0xf7, 0xbe, 0xa9, 0x12, 0xd6, 0x88, 0x45, 0x5e, 0x4a, 0xdf, 0xe0, 0x2f, 0x7f, 0x09, 0x64, 0x3f, + 0x88, 0xbc, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_Cert = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_Cert_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_SKID_Array[] = { + 0xCC, 0xAC, 0x78, 0x09, 0x9A, 0xC4, 0x7F, 0xAD, 0x7A, 0x0E, 0xB9, 0x01, 0x2C, 0xC8, 0xF4, 0x22, 0x88, 0x09, 0xAB, 0x61, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_SKID = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_SKID_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-2URIs-Key.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_PublicKey_Array[] = { + 0x04, 0xda, 0x46, 0x42, 0x76, 0xca, 0x8a, 0x5b, 0x0f, 0x9f, 0x48, 0xcb, 0xa6, 0x07, 0xff, 0xed, 0x92, + 0xf6, 0xa8, 0x13, 0x14, 0x67, 0x61, 0xf8, 0x7b, 0xb9, 0x00, 0xef, 0x6c, 0x43, 0x6b, 0xe8, 0x01, 0xe6, + 0xa7, 0xc5, 0xc8, 0xe9, 0x62, 0x09, 0xcb, 0x11, 0x04, 0x6a, 0xef, 0xaf, 0x8e, 0x2b, 0x03, 0x99, 0xb6, + 0x29, 0xf5, 0x20, 0x03, 0x42, 0xb4, 0x8c, 0x34, 0x7a, 0x91, 0x99, 0x87, 0xe3, 0x57, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_PublicKey = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_PublicKey_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_PrivateKey_Array[] = { + 0xbd, 0xc5, 0xcc, 0x3d, 0x9b, 0x85, 0x0d, 0x14, 0x0b, 0x6e, 0x1d, 0xea, 0xf5, 0xd2, 0xb7, 0xcb, + 0x63, 0xfc, 0x71, 0xf6, 0x4e, 0x6c, 0xa8, 0x9a, 0xf3, 0x34, 0xb9, 0x98, 0x43, 0x7e, 0x6d, 0xc7, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_PrivateKey = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_PrivateKey_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Cert.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Cert_Array[] = { + 0x30, 0x82, 0x02, 0x23, 0x30, 0x82, 0x01, 0xc9, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x71, 0x65, 0x6d, 0x1b, 0x7a, 0x2e, + 0x16, 0xa4, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x46, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x49, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, + 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, + 0x30, 0x30, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, + 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x56, 0x31, 0x28, 0x30, 0x26, + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x44, 0x41, + 0x43, 0x20, 0x30, 0x30, 0x30, 0x30, 0x20, 0x43, 0x44, 0x50, 0x20, 0x28, 0x48, 0x54, 0x54, 0x50, 0x29, 0x31, 0x14, 0x30, 0x12, + 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x31, 0x31, 0x14, 0x30, + 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, 0x30, 0x30, 0x59, + 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, + 0x03, 0x42, 0x00, 0x04, 0xe3, 0x01, 0x1e, 0xde, 0x9f, 0x51, 0x5a, 0xb3, 0xe9, 0xba, 0x93, 0x25, 0xfe, 0xf2, 0x3b, 0x96, 0xcd, + 0x71, 0x5c, 0x3a, 0xea, 0x38, 0xce, 0x81, 0x1e, 0x88, 0xfc, 0x6d, 0xe7, 0xac, 0x30, 0x26, 0x23, 0xfb, 0xa7, 0x06, 0x8b, 0x3e, + 0x09, 0xd3, 0xfe, 0x54, 0x9b, 0x11, 0xcc, 0x5f, 0x0e, 0x59, 0x6c, 0x4e, 0xdb, 0xce, 0x3e, 0x7b, 0xa2, 0x27, 0x1f, 0xb8, 0xd0, + 0x9a, 0xf4, 0x21, 0x9e, 0x3d, 0xa3, 0x81, 0x8e, 0x30, 0x81, 0x8b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, + 0x04, 0x02, 0x30, 0x00, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, + 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x68, 0x43, 0xc8, 0x33, 0xa3, 0x39, 0x9f, 0x98, 0x42, 0x15, 0x3e, + 0xb1, 0xac, 0xcf, 0x2f, 0x95, 0x58, 0x5f, 0x1a, 0x50, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, + 0x14, 0xaf, 0x42, 0xb7, 0x09, 0x4d, 0xeb, 0xd5, 0x15, 0xec, 0x6e, 0xcf, 0x33, 0xb8, 0x11, 0x15, 0x22, 0x5f, 0x32, 0x52, 0x88, + 0x30, 0x2b, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x24, 0x30, 0x22, 0x30, 0x20, 0xa0, 0x1e, 0xa0, 0x1c, 0x86, 0x1a, 0x68, 0x74, + 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x72, 0x6c, 0x2e, + 0x70, 0x65, 0x6d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, + 0x20, 0x65, 0x4a, 0x4c, 0x13, 0x3b, 0xc9, 0xda, 0x4d, 0x14, 0x78, 0x35, 0xab, 0xfc, 0x24, 0xd5, 0x2c, 0xec, 0xa3, 0xa0, 0x8f, + 0xa2, 0xf4, 0xe6, 0xea, 0xc2, 0xae, 0x60, 0x41, 0x1f, 0x36, 0xf5, 0xa4, 0x02, 0x21, 0x00, 0xaa, 0x1c, 0xa1, 0x93, 0x1f, 0xbc, + 0x9a, 0xff, 0xd6, 0x47, 0x32, 0xab, 0xf3, 0x1e, 0xa8, 0xf6, 0x13, 0xc1, 0x67, 0x1f, 0x0f, 0x22, 0xa4, 0x31, 0x67, 0xe2, 0x8e, + 0x9d, 0xac, 0x93, 0x1e, 0x18, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Cert = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Cert_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_SKID_Array[] = { + 0x68, 0x43, 0xC8, 0x33, 0xA3, 0x39, 0x9F, 0x98, 0x42, 0x15, 0x3E, 0xB1, 0xAC, 0xCF, 0x2F, 0x95, 0x58, 0x5F, 0x1A, 0x50, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_SKID = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_SKID_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Key.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_PublicKey_Array[] = { + 0x04, 0xe3, 0x01, 0x1e, 0xde, 0x9f, 0x51, 0x5a, 0xb3, 0xe9, 0xba, 0x93, 0x25, 0xfe, 0xf2, 0x3b, 0x96, + 0xcd, 0x71, 0x5c, 0x3a, 0xea, 0x38, 0xce, 0x81, 0x1e, 0x88, 0xfc, 0x6d, 0xe7, 0xac, 0x30, 0x26, 0x23, + 0xfb, 0xa7, 0x06, 0x8b, 0x3e, 0x09, 0xd3, 0xfe, 0x54, 0x9b, 0x11, 0xcc, 0x5f, 0x0e, 0x59, 0x6c, 0x4e, + 0xdb, 0xce, 0x3e, 0x7b, 0xa2, 0x27, 0x1f, 0xb8, 0xd0, 0x9a, 0xf4, 0x21, 0x9e, 0x3d, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_PublicKey = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_PublicKey_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_PrivateKey_Array[] = { + 0x06, 0x59, 0xf2, 0x16, 0x77, 0x18, 0xe9, 0x0f, 0x12, 0x23, 0xba, 0xef, 0x44, 0x28, 0xf1, 0xb0, + 0xce, 0xc4, 0x72, 0xb5, 0x5f, 0xbb, 0x07, 0xea, 0x87, 0xd7, 0x39, 0x89, 0x9c, 0xf7, 0x31, 0x6a, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_PrivateKey = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_PrivateKey_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Cert.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_Cert_Array[] = { + 0x30, 0x82, 0x02, 0x25, 0x30, 0x82, 0x01, 0xcb, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x34, 0xa8, 0x41, 0x5b, 0x7d, 0x3f, + 0x2b, 0x1e, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x46, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x49, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, + 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, + 0x30, 0x30, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, + 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x57, 0x31, 0x29, 0x30, 0x27, + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x20, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x44, 0x41, + 0x43, 0x20, 0x30, 0x30, 0x30, 0x30, 0x20, 0x43, 0x44, 0x50, 0x20, 0x28, 0x48, 0x54, 0x54, 0x50, 0x53, 0x29, 0x31, 0x14, 0x30, + 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x31, 0x31, 0x14, + 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, 0x30, 0x30, + 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, + 0x07, 0x03, 0x42, 0x00, 0x04, 0xd9, 0x2b, 0x24, 0xde, 0x51, 0x6b, 0x8e, 0xcd, 0x3e, 0x68, 0x62, 0xde, 0x87, 0xfc, 0x3b, 0xf7, + 0x7e, 0x70, 0x11, 0x71, 0xc7, 0x0b, 0x59, 0x8c, 0xff, 0x5f, 0x02, 0x7f, 0x02, 0xb8, 0x20, 0xe7, 0xfa, 0x07, 0xba, 0xd4, 0xe4, + 0xd8, 0xbe, 0x26, 0x1c, 0x08, 0xfb, 0x31, 0x95, 0xd5, 0xa8, 0x34, 0x82, 0x3a, 0x28, 0xcc, 0x47, 0x03, 0xb7, 0xc5, 0x15, 0x7e, + 0x14, 0x9e, 0x5e, 0xaa, 0x78, 0x05, 0xa3, 0x81, 0x8f, 0x30, 0x81, 0x8c, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, + 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, + 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xa3, 0x02, 0x33, 0xf8, 0x6f, 0x40, 0xd1, 0x1a, 0xc5, 0x5f, + 0x80, 0xa5, 0xc0, 0xa9, 0x2a, 0x50, 0x6f, 0xea, 0x9f, 0x31, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, + 0x80, 0x14, 0xaf, 0x42, 0xb7, 0x09, 0x4d, 0xeb, 0xd5, 0x15, 0xec, 0x6e, 0xcf, 0x33, 0xb8, 0x11, 0x15, 0x22, 0x5f, 0x32, 0x52, + 0x88, 0x30, 0x2c, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x25, 0x30, 0x23, 0x30, 0x21, 0xa0, 0x1f, 0xa0, 0x1d, 0x86, 0x1b, 0x68, + 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x72, + 0x6c, 0x2e, 0x70, 0x65, 0x6d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, + 0x45, 0x02, 0x20, 0x53, 0xec, 0xea, 0xda, 0x3c, 0x5d, 0x4b, 0xb7, 0x50, 0xcb, 0xe7, 0xf8, 0xd1, 0x09, 0x59, 0x12, 0xd4, 0xc8, + 0xe5, 0xfb, 0x1f, 0xef, 0x30, 0x24, 0x1f, 0xcf, 0x95, 0x83, 0x29, 0x40, 0xd0, 0x9a, 0x02, 0x21, 0x00, 0xb5, 0x57, 0x5e, 0xbc, + 0xa7, 0x1b, 0x84, 0x7e, 0x77, 0xd5, 0xd5, 0xd1, 0x41, 0x06, 0xbb, 0x87, 0xbf, 0x37, 0x9d, 0x92, 0xa4, 0x9d, 0xea, 0x8d, 0x10, + 0xa0, 0xe1, 0x8b, 0x48, 0x10, 0x2e, 0x1f, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_Cert = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_Cert_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_SKID_Array[] = { + 0xA3, 0x02, 0x33, 0xF8, 0x6F, 0x40, 0xD1, 0x1A, 0xC5, 0x5F, 0x80, 0xA5, 0xC0, 0xA9, 0x2A, 0x50, 0x6F, 0xEA, 0x9F, 0x31, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_SKID = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_SKID_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-HTTPS-Key.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_PublicKey_Array[] = { + 0x04, 0xd9, 0x2b, 0x24, 0xde, 0x51, 0x6b, 0x8e, 0xcd, 0x3e, 0x68, 0x62, 0xde, 0x87, 0xfc, 0x3b, 0xf7, + 0x7e, 0x70, 0x11, 0x71, 0xc7, 0x0b, 0x59, 0x8c, 0xff, 0x5f, 0x02, 0x7f, 0x02, 0xb8, 0x20, 0xe7, 0xfa, + 0x07, 0xba, 0xd4, 0xe4, 0xd8, 0xbe, 0x26, 0x1c, 0x08, 0xfb, 0x31, 0x95, 0xd5, 0xa8, 0x34, 0x82, 0x3a, + 0x28, 0xcc, 0x47, 0x03, 0xb7, 0xc5, 0x15, 0x7e, 0x14, 0x9e, 0x5e, 0xaa, 0x78, 0x05, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_PublicKey = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_PublicKey_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_PrivateKey_Array[] = { + 0x04, 0xa4, 0x15, 0x03, 0x86, 0x39, 0xd1, 0x4e, 0x62, 0x92, 0x6f, 0x46, 0x1a, 0x62, 0x55, 0xd7, + 0xa3, 0x0b, 0x0b, 0xdc, 0xac, 0x6a, 0x98, 0xcd, 0xf8, 0x8b, 0x16, 0x70, 0x2a, 0x72, 0x9f, 0x3b, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_PrivateKey = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_PrivateKey_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Cert.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Long_Cert_Array[] = { + 0x30, 0x82, 0x02, 0x53, 0x30, 0x82, 0x01, 0xf9, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x1d, 0x6e, 0x6d, 0x50, 0x41, 0x86, + 0x00, 0x07, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x46, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x49, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, + 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, + 0x30, 0x30, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, + 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x3b, 0x31, 0x0d, 0x30, 0x0b, + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x04, 0x4c, 0x6f, 0x6e, 0x67, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, + 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, + 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, 0x30, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, + 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x43, 0x28, + 0xfb, 0xb8, 0x71, 0x42, 0x8c, 0x35, 0xe2, 0x24, 0xb3, 0x7f, 0x9e, 0x80, 0x64, 0x03, 0x5f, 0xb2, 0xcc, 0x72, 0xf8, 0xf1, 0x71, + 0x18, 0x53, 0x46, 0xc3, 0x20, 0xe1, 0xa8, 0x85, 0xb5, 0xe4, 0x09, 0x09, 0x5e, 0xec, 0x85, 0x5f, 0x7d, 0x52, 0xaf, 0x97, 0xa1, + 0xd0, 0x6f, 0x76, 0x71, 0x6c, 0x87, 0x36, 0x7e, 0x19, 0x88, 0xce, 0xa1, 0x19, 0xd6, 0xd7, 0xf4, 0x25, 0x2b, 0xc7, 0x2f, 0xa3, + 0x81, 0xd9, 0x30, 0x81, 0xd6, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0e, + 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, + 0x04, 0x16, 0x04, 0x14, 0xf6, 0x4c, 0x7b, 0xf1, 0xa8, 0xb6, 0xe0, 0xba, 0x10, 0x8e, 0xbd, 0xeb, 0x4f, 0xe1, 0xf6, 0x77, 0x7c, + 0xc9, 0x2c, 0x29, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xaf, 0x42, 0xb7, 0x09, 0x4d, + 0xeb, 0xd5, 0x15, 0xec, 0x6e, 0xcf, 0x33, 0xb8, 0x11, 0x15, 0x22, 0x5f, 0x32, 0x52, 0x88, 0x30, 0x76, 0x06, 0x03, 0x55, 0x1d, + 0x1f, 0x04, 0x6f, 0x30, 0x6d, 0x30, 0x6b, 0xa0, 0x69, 0xa0, 0x67, 0x86, 0x65, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x68, 0x69, 0x73, 0x2d, 0x69, 0x73, 0x2d, 0x61, + 0x6e, 0x2d, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2d, 0x6f, 0x66, 0x2d, 0x63, 0x72, 0x6c, 0x2d, 0x64, 0x69, 0x73, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2d, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x2d, 0x77, 0x68, 0x69, 0x63, 0x68, 0x2d, 0x69, 0x73, 0x2d, 0x31, 0x30, 0x31, 0x2d, 0x63, 0x68, 0x61, 0x72, + 0x73, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x70, 0x65, 0x6d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, + 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x43, 0x43, 0x62, 0x74, 0x55, 0x45, 0xb8, 0x10, 0xeb, 0x33, 0x3d, 0x59, 0x2d, 0x3f, + 0x46, 0x82, 0x3c, 0x53, 0xf5, 0x61, 0x19, 0xf0, 0x86, 0x44, 0xe2, 0x79, 0x4c, 0xba, 0x4a, 0xda, 0xb7, 0xb1, 0x02, 0x21, 0x00, + 0xaf, 0x51, 0x97, 0x6a, 0x44, 0x4d, 0x43, 0x9e, 0xba, 0x17, 0xb8, 0xa1, 0x63, 0x75, 0x81, 0x53, 0x09, 0x93, 0xf6, 0x18, 0xc2, + 0x74, 0x18, 0x87, 0xd3, 0xe6, 0xde, 0x47, 0x91, 0xa4, 0xc9, 0xa4, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Long_Cert = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Long_Cert_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Long_SKID_Array[] = { + 0xF6, 0x4C, 0x7B, 0xF1, 0xA8, 0xB6, 0xE0, 0xBA, 0x10, 0x8E, 0xBD, 0xEB, 0x4F, 0xE1, 0xF6, 0x77, 0x7C, 0xC9, 0x2C, 0x29, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Long_SKID = ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Long_SKID_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Long-Key.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Long_PublicKey_Array[] = { + 0x04, 0x43, 0x28, 0xfb, 0xb8, 0x71, 0x42, 0x8c, 0x35, 0xe2, 0x24, 0xb3, 0x7f, 0x9e, 0x80, 0x64, 0x03, + 0x5f, 0xb2, 0xcc, 0x72, 0xf8, 0xf1, 0x71, 0x18, 0x53, 0x46, 0xc3, 0x20, 0xe1, 0xa8, 0x85, 0xb5, 0xe4, + 0x09, 0x09, 0x5e, 0xec, 0x85, 0x5f, 0x7d, 0x52, 0xaf, 0x97, 0xa1, 0xd0, 0x6f, 0x76, 0x71, 0x6c, 0x87, + 0x36, 0x7e, 0x19, 0x88, 0xce, 0xa1, 0x19, 0xd6, 0xd7, 0xf4, 0x25, 0x2b, 0xc7, 0x2f, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Long_PublicKey = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Long_PublicKey_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Long_PrivateKey_Array[] = { + 0xd1, 0x54, 0x99, 0xa7, 0xd6, 0xde, 0x38, 0x53, 0x86, 0x9d, 0xe6, 0xa4, 0x6c, 0x4b, 0x52, 0xd1, + 0x3b, 0x73, 0x59, 0x16, 0xd4, 0xaa, 0xbd, 0x50, 0x26, 0xaa, 0xad, 0x1e, 0x72, 0x79, 0x66, 0xeb, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Long_PrivateKey = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Long_PrivateKey_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Cert.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_Cert_Array[] = { + 0x30, 0x82, 0x02, 0x05, 0x30, 0x82, 0x01, 0xab, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x70, 0x06, 0x08, 0xaa, 0xa1, 0xd7, + 0xad, 0x6d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x46, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x49, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, + 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, + 0x30, 0x30, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, + 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x3b, 0x31, 0x0d, 0x30, 0x0b, + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x04, 0x4c, 0x6f, 0x6e, 0x67, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, + 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, + 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, 0x30, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, + 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xfc, 0xcd, + 0xc8, 0x29, 0xba, 0x62, 0x37, 0x7c, 0xc6, 0xc7, 0xb3, 0x6e, 0xa7, 0xc1, 0xaf, 0x76, 0xcd, 0x15, 0xc3, 0x28, 0xbc, 0x4b, 0x6e, + 0x8d, 0x07, 0x78, 0xba, 0x59, 0x7f, 0xbb, 0xf3, 0x0a, 0xe7, 0x12, 0xb6, 0x57, 0xd2, 0xf9, 0xf2, 0xb9, 0x15, 0xf8, 0x23, 0x4c, + 0x87, 0xe2, 0xa3, 0x3b, 0xf5, 0xe7, 0x59, 0x76, 0xe0, 0x4e, 0x6a, 0xd0, 0x3d, 0x85, 0x0b, 0xd1, 0x64, 0x39, 0xf3, 0xcf, 0xa3, + 0x81, 0x8b, 0x30, 0x81, 0x88, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0e, + 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, + 0x04, 0x16, 0x04, 0x14, 0x07, 0x30, 0x1c, 0xef, 0x8b, 0x9e, 0x44, 0x26, 0xd2, 0xe4, 0x6e, 0xc6, 0xfa, 0x3a, 0xd3, 0xb7, 0x44, + 0x1d, 0xef, 0xbd, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xaf, 0x42, 0xb7, 0x09, 0x4d, + 0xeb, 0xd5, 0x15, 0xec, 0x6e, 0xcf, 0x33, 0xb8, 0x11, 0x15, 0x22, 0x5f, 0x32, 0x52, 0x88, 0x30, 0x28, 0x06, 0x03, 0x55, 0x1d, + 0x1f, 0x04, 0x21, 0x30, 0x1f, 0x30, 0x1d, 0xa0, 0x1b, 0xa0, 0x19, 0x86, 0x17, 0x77, 0x77, 0x77, 0x2e, 0x65, 0x78, 0x61, 0x6d, + 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x70, 0x65, 0x6d, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, + 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xe6, 0xb8, 0x88, 0x1e, 0xed, 0x0e, 0xa6, + 0x70, 0x82, 0xc0, 0x60, 0x7e, 0x46, 0xf6, 0xca, 0x84, 0x04, 0x31, 0xab, 0xe0, 0x91, 0xd6, 0x17, 0x5d, 0x81, 0x0c, 0x38, 0xa1, + 0xe4, 0xf0, 0x45, 0x77, 0x02, 0x20, 0x39, 0x06, 0x5f, 0xbe, 0xf9, 0xfd, 0xa4, 0x1b, 0x37, 0xaf, 0xcb, 0xb1, 0xf6, 0xdf, 0x09, + 0x0e, 0x1a, 0x44, 0x3b, 0xac, 0x6e, 0x65, 0x2c, 0x3b, 0xda, 0xc1, 0x03, 0xf4, 0xd3, 0xac, 0x4e, 0x76, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_Cert = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_Cert_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_SKID_Array[] = { + 0x07, 0x30, 0x1C, 0xEF, 0x8B, 0x9E, 0x44, 0x26, 0xD2, 0xE4, 0x6E, 0xC6, 0xFA, 0x3A, 0xD3, 0xB7, 0x44, 0x1D, 0xEF, 0xBD, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_SKID = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_SKID_Array); + +// ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-CDP-Wrong-Prefix-Key.pem + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_PublicKey_Array[] = { + 0x04, 0xfc, 0xcd, 0xc8, 0x29, 0xba, 0x62, 0x37, 0x7c, 0xc6, 0xc7, 0xb3, 0x6e, 0xa7, 0xc1, 0xaf, 0x76, + 0xcd, 0x15, 0xc3, 0x28, 0xbc, 0x4b, 0x6e, 0x8d, 0x07, 0x78, 0xba, 0x59, 0x7f, 0xbb, 0xf3, 0x0a, 0xe7, + 0x12, 0xb6, 0x57, 0xd2, 0xf9, 0xf2, 0xb9, 0x15, 0xf8, 0x23, 0x4c, 0x87, 0xe2, 0xa3, 0x3b, 0xf5, 0xe7, + 0x59, 0x76, 0xe0, 0x4e, 0x6a, 0xd0, 0x3d, 0x85, 0x0b, 0xd1, 0x64, 0x39, 0xf3, 0xcf, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_PublicKey = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_PublicKey_Array); + +constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_PrivateKey_Array[] = { + 0xa5, 0x1d, 0xcd, 0xfc, 0xd9, 0x55, 0xdb, 0x87, 0x24, 0x35, 0x6c, 0x87, 0x12, 0x1a, 0x90, 0xbd, + 0x13, 0x18, 0x53, 0x78, 0xa7, 0xa9, 0x8c, 0x71, 0xf4, 0x70, 0x44, 0xa2, 0xa6, 0xdb, 0xeb, 0xdb, +}; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_PrivateKey = + ByteSpan(sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_PrivateKey_Array); + // ${chip_root}/credentials/test/attestation/Chip-Test-DAC-FFF1-8000-0000-Cert.pem constexpr uint8_t sTestCert_DAC_FFF1_8000_0000_Cert_Array[] = { diff --git a/src/credentials/tests/CHIPAttCert_test_vectors.h b/src/credentials/tests/CHIPAttCert_test_vectors.h index 2419c6bfd578c3..1e59b5321cf19d 100644 --- a/src/credentials/tests/CHIPAttCert_test_vectors.h +++ b/src/credentials/tests/CHIPAttCert_test_vectors.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021-2022 Project CHIP Authors + * Copyright (c) 2021-2023 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,36 @@ namespace chip { namespace TestCerts { +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_Cert; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_SKID; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_PublicKey; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_PrivateKey; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_Cert; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_SKID; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_PublicKey; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_PrivateKey; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Cert; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_SKID; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_PublicKey; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_PrivateKey; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_Cert; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_SKID; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_PublicKey; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_PrivateKey; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Long_Cert; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Long_SKID; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Long_PublicKey; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Long_PrivateKey; + +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_Cert; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_SKID; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_PublicKey; +extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_PrivateKey; + extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_Cert; extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_SKID; extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_PublicKey; diff --git a/src/crypto/CHIPCryptoPAL.h b/src/crypto/CHIPCryptoPAL.h index a5e2c080f012a6..1ad60b4c68d61a 100644 --- a/src/crypto/CHIPCryptoPAL.h +++ b/src/crypto/CHIPCryptoPAL.h @@ -52,6 +52,10 @@ constexpr size_t kSubjectKeyIdentifierLength = kSHA1_Hash_Length; constexpr size_t kAuthorityKeyIdentifierLength = kSHA1_Hash_Length; constexpr size_t kMaxCertificateSerialNumberLength = 20; constexpr size_t kMaxCertificateDistinguishedNameLength = 200; +constexpr size_t kMaxCRLDistributionPointURLLength = 100; + +constexpr const char * kValidCDPURIHttpPrefix = "http://"; +constexpr const char * kValidCDPURIHttpsPrefix = "https://"; constexpr size_t CHIP_CRYPTO_GROUP_SIZE_BYTES = kP256_FE_Length; constexpr size_t CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES = kP256_Point_Length; @@ -1568,6 +1572,16 @@ CHIP_ERROR ExtractSKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan **/ CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan & akid); +/** + * @brief Extracts the CRL Distribution Point (CDP) extension from an X509 ASN.1 Encoded Certificate. + * The returned value only covers the URI of the CDP. Only a single URI distribution point + * GeneralName is supported, and only those that start with "http://" and "https://". + * + * @returns CHIP_ERROR_NOT_FOUND if not found or wrong format. + * CHIP_NO_ERROR otherwise. + **/ +CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl); + /** * @brief Extracts Serial Number from X509 Certificate. **/ diff --git a/src/crypto/CHIPCryptoPALOpenSSL.cpp b/src/crypto/CHIPCryptoPALOpenSSL.cpp index e181190a109bb6..741603e0829d5f 100644 --- a/src/crypto/CHIPCryptoPALOpenSSL.cpp +++ b/src/crypto/CHIPCryptoPALOpenSSL.cpp @@ -1971,6 +1971,87 @@ CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan return ExtractKIDFromX509Cert(false, certificate, akid); } +CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + X509 * x509certificate = nullptr; + const unsigned char * pCertificate = certificate.data(); + const unsigned char ** ppCertificate = &pCertificate; + STACK_OF(DIST_POINT) * crldp = nullptr; + DIST_POINT * dp = nullptr; + GENERAL_NAMES * gens = nullptr; + GENERAL_NAME * gen = nullptr; + ASN1_STRING * uri = nullptr; + const char * urlptr = nullptr; + size_t len = 0; + + VerifyOrReturnError(!certificate.empty() && CanCastTo(certificate.size()), CHIP_ERROR_INVALID_ARGUMENT); + + x509certificate = d2i_X509(nullptr, ppCertificate, static_cast(certificate.size())); + VerifyOrExit(x509certificate != nullptr, err = CHIP_ERROR_NO_MEMORY); + + // CRL Distribution Point Extension is encoded as a secuense of DistributionPoint: + // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + // + // This implementation only supports a single DistributionPoint (sequence of size 1) + crldp = + reinterpret_cast(X509_get_ext_d2i(x509certificate, NID_crl_distribution_points, nullptr, nullptr)); + VerifyOrExit(crldp != nullptr, err = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(sk_DIST_POINT_num(crldp) == 1, err = CHIP_ERROR_NOT_FOUND); + + dp = sk_DIST_POINT_value(crldp, 0); + VerifyOrExit(dp != nullptr, err = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(dp->distpoint != nullptr && dp->distpoint->type == 0, err = CHIP_ERROR_NOT_FOUND); + + // The DistributionPoint is a sequence of three optional elements: + // DistributionPoint ::= SEQUENCE { + // distributionPoint [0] DistributionPointName OPTIONAL, + // reasons [1] ReasonFlags OPTIONAL, + // cRLIssuer [2] GeneralNames OPTIONAL } + // + // where the DistributionPointName is a CHOICE of: + // DistributionPointName ::= CHOICE { + // fullName [0] GeneralNames, + // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + // + // The URI should be encoded in the fullName element. + // This implementation only supports a single GeneralName in the fullName sequence: + // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + gens = dp->distpoint->name.fullname; + VerifyOrExit(sk_GENERAL_NAME_num(gens) == 1, err = CHIP_ERROR_NOT_FOUND); + + // The CDP URI is encoded as a uniformResourceIdentifier field of the GeneralName: + // GeneralName ::= CHOICE { + // otherName [0] OtherName, + // rfc822Name [1] IA5String, + // dNSName [2] IA5String, + // x400Address [3] ORAddress, + // directoryName [4] Name, + // ediPartyName [5] EDIPartyName, + // uniformResourceIdentifier [6] IA5String, + // iPAddress [7] OCTET STRING, + // registeredID [8] OBJECT IDENTIFIER } + gen = sk_GENERAL_NAME_value(gens, 0); + VerifyOrExit(gen->type == GEN_URI, err = CHIP_ERROR_NOT_FOUND); + + uri = reinterpret_cast(GENERAL_NAME_get0_value(gen, nullptr)); + urlptr = reinterpret_cast(ASN1_STRING_get0_data(uri)); + VerifyOrExit(CanCastTo(ASN1_STRING_length(uri)), err = CHIP_ERROR_NOT_FOUND); + len = static_cast(ASN1_STRING_length(uri)); + VerifyOrExit( + (len > strlen(kValidCDPURIHttpPrefix) && strncmp(urlptr, kValidCDPURIHttpPrefix, strlen(kValidCDPURIHttpPrefix)) == 0) || + (len > strlen(kValidCDPURIHttpsPrefix) && + strncmp(urlptr, kValidCDPURIHttpsPrefix, strlen(kValidCDPURIHttpsPrefix)) == 0), + err = CHIP_ERROR_NOT_FOUND); + err = CopyCharSpanToMutableCharSpan(CharSpan(urlptr, len), cdpurl); + +exit: + sk_DIST_POINT_pop_free(crldp, DIST_POINT_free); + X509_free(x509certificate); + + return err; +} + CHIP_ERROR ExtractSerialNumberFromX509Cert(const ByteSpan & certificate, MutableByteSpan & serialNumber) { CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/src/crypto/CHIPCryptoPALPSA.cpp b/src/crypto/CHIPCryptoPALPSA.cpp index e8d4b75c9221b1..d1afbf1dbb05e3 100644 --- a/src/crypto/CHIPCryptoPALPSA.cpp +++ b/src/crypto/CHIPCryptoPALPSA.cpp @@ -1218,6 +1218,7 @@ constexpr uint8_t sOID_Extension_BasicConstraints[] = { 0x55, 0x1D, 0x13 } constexpr uint8_t sOID_Extension_KeyUsage[] = { 0x55, 0x1D, 0x0F }; constexpr uint8_t sOID_Extension_SubjectKeyIdentifier[] = { 0x55, 0x1D, 0x0E }; constexpr uint8_t sOID_Extension_AuthorityKeyIdentifier[] = { 0x55, 0x1D, 0x23 }; +constexpr uint8_t sOID_Extension_CRLDistributionPoint[] = { 0x55, 0x1D, 0x1F }; /** * Compares an mbedtls_asn1_buf structure (oidBuf) to a reference OID represented as uint8_t array (oid). @@ -1684,6 +1685,128 @@ CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan return ExtractKIDFromX509Cert(false, certificate, akid); } +CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl) +{ +#if defined(MBEDTLS_X509_CRT_PARSE_C) + CHIP_ERROR error = CHIP_ERROR_NOT_FOUND; + mbedtls_x509_crt mbed_cert; + unsigned char * p = nullptr; + const unsigned char * end = nullptr; + size_t len = 0; + size_t cdpExtCount = 0; + + VerifyOrReturnError(!certificate.empty() && CanCastTo(certificate.size()), CHIP_ERROR_INVALID_ARGUMENT); + + mbedtls_x509_crt_init(&mbed_cert); + + int result = mbedtls_x509_crt_parse(&mbed_cert, Uint8::to_const_uchar(certificate.data()), certificate.size()); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); + + p = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p); + end = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p) + + mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(len); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + while (p < end) + { + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OID); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + mbedtls_x509_buf extOID = { MBEDTLS_ASN1_OID, len, p }; + bool isCurrentExtCDP = OID_CMP(sOID_Extension_CRLDistributionPoint, extOID); + p += len; + + int is_critical = 0; + result = mbedtls_asn1_get_bool(&p, end, &is_critical); + VerifyOrExit(result == 0 || result == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG, error = CHIP_ERROR_WRONG_CERT_TYPE); + + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OCTET_STRING); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + unsigned char * end_of_ext = p + len; + + if (isCurrentExtCDP) + { + // Only one CRL Distribution Point Extension is allowed. + cdpExtCount++; + VerifyOrExit(cdpExtCount <= 1, error = CHIP_ERROR_NOT_FOUND); + + // CRL Distribution Point Extension is encoded as a secuense of DistributionPoint: + // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + // + // This implementation only supports a single DistributionPoint (sequence of size 1), + // which is verified by comparing (p + len == end_of_ext) + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPoint is a sequence of three optional elements: + // DistributionPoint ::= SEQUENCE { + // distributionPoint [0] DistributionPointName OPTIONAL, + // reasons [1] ReasonFlags OPTIONAL, + // cRLIssuer [2] GeneralNames OPTIONAL } + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPointName is: + // DistributionPointName ::= CHOICE { + // fullName [0] GeneralNames, + // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + // + // The URI should be encoded in the fullName element. + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | 0); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // The CDP URI is encoded as a uniformResourceIdentifier field of the GeneralName: + // GeneralName ::= CHOICE { + // otherName [0] OtherName, + // rfc822Name [1] IA5String, + // dNSName [2] IA5String, + // x400Address [3] ORAddress, + // directoryName [4] Name, + // ediPartyName [5] EDIPartyName, + // uniformResourceIdentifier [6] IA5String, + // iPAddress [7] OCTET STRING, + // registeredID [8] OBJECT IDENTIFIER } + result = + mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + const char * urlptr = reinterpret_cast(p); + VerifyOrExit((len > strlen(kValidCDPURIHttpPrefix) && + strncmp(urlptr, kValidCDPURIHttpPrefix, strlen(kValidCDPURIHttpPrefix)) == 0) || + (len > strlen(kValidCDPURIHttpsPrefix) && + strncmp(urlptr, kValidCDPURIHttpsPrefix, strlen(kValidCDPURIHttpsPrefix)) == 0), + error = CHIP_ERROR_NOT_FOUND); + error = CopyCharSpanToMutableCharSpan(CharSpan(urlptr, len), cdpurl); + SuccessOrExit(error); + } + p = end_of_ext; + } + + VerifyOrExit(cdpExtCount == 1, error = CHIP_ERROR_NOT_FOUND); + +exit: + logMbedTLSError(result); + mbedtls_x509_crt_free(&mbed_cert); + +#else + (void) certificate; + (void) cdpurl; + CHIP_ERROR error = CHIP_ERROR_NOT_IMPLEMENTED; +#endif // defined(MBEDTLS_X509_CRT_PARSE_C) + + return error; +} + CHIP_ERROR ExtractSerialNumberFromX509Cert(const ByteSpan & certificate, MutableByteSpan & serialNumber) { #if defined(MBEDTLS_X509_CRT_PARSE_C) diff --git a/src/crypto/CHIPCryptoPALmbedTLS.cpp b/src/crypto/CHIPCryptoPALmbedTLS.cpp index 92ec3048fe8de6..195bd56cf745a2 100644 --- a/src/crypto/CHIPCryptoPALmbedTLS.cpp +++ b/src/crypto/CHIPCryptoPALmbedTLS.cpp @@ -1309,6 +1309,7 @@ constexpr uint8_t sOID_Extension_BasicConstraints[] = { 0x55, 0x1D, 0x13 } constexpr uint8_t sOID_Extension_KeyUsage[] = { 0x55, 0x1D, 0x0F }; constexpr uint8_t sOID_Extension_SubjectKeyIdentifier[] = { 0x55, 0x1D, 0x0E }; constexpr uint8_t sOID_Extension_AuthorityKeyIdentifier[] = { 0x55, 0x1D, 0x23 }; +constexpr uint8_t sOID_Extension_CRLDistributionPoint[] = { 0x55, 0x1D, 0x1F }; /** * Compares an mbedtls_asn1_buf structure (oidBuf) to a reference OID represented as uint8_t array (oid). @@ -1776,6 +1777,128 @@ CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan return ExtractKIDFromX509Cert(false, certificate, akid); } +CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl) +{ +#if defined(MBEDTLS_X509_CRT_PARSE_C) + CHIP_ERROR error = CHIP_ERROR_NOT_FOUND; + mbedtls_x509_crt mbed_cert; + unsigned char * p = nullptr; + const unsigned char * end = nullptr; + size_t len = 0; + size_t cdpExtCount = 0; + + VerifyOrReturnError(!certificate.empty() && CanCastTo(certificate.size()), CHIP_ERROR_INVALID_ARGUMENT); + + mbedtls_x509_crt_init(&mbed_cert); + + int result = mbedtls_x509_crt_parse(&mbed_cert, Uint8::to_const_uchar(certificate.data()), certificate.size()); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); + + p = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p); + end = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p) + + mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(len); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + while (p < end) + { + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OID); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + mbedtls_x509_buf extOID = { MBEDTLS_ASN1_OID, len, p }; + bool isCurrentExtCDP = OID_CMP(sOID_Extension_CRLDistributionPoint, extOID); + p += len; + + int is_critical = 0; + result = mbedtls_asn1_get_bool(&p, end, &is_critical); + VerifyOrExit(result == 0 || result == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG, error = CHIP_ERROR_WRONG_CERT_TYPE); + + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OCTET_STRING); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + unsigned char * end_of_ext = p + len; + + if (isCurrentExtCDP) + { + // Only one CRL Distribution Point Extension is allowed. + cdpExtCount++; + VerifyOrExit(cdpExtCount <= 1, error = CHIP_ERROR_NOT_FOUND); + + // CRL Distribution Point Extension is encoded as a secuense of DistributionPoint: + // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + // + // This implementation only supports a single DistributionPoint (sequence of size 1), + // which is verified by comparing (p + len == end_of_ext) + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPoint is a sequence of three optional elements: + // DistributionPoint ::= SEQUENCE { + // distributionPoint [0] DistributionPointName OPTIONAL, + // reasons [1] ReasonFlags OPTIONAL, + // cRLIssuer [2] GeneralNames OPTIONAL } + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPointName is: + // DistributionPointName ::= CHOICE { + // fullName [0] GeneralNames, + // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + // + // The URI should be encoded in the fullName element. + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | 0); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // The CDP URI is encoded as a uniformResourceIdentifier field of the GeneralName: + // GeneralName ::= CHOICE { + // otherName [0] OtherName, + // rfc822Name [1] IA5String, + // dNSName [2] IA5String, + // x400Address [3] ORAddress, + // directoryName [4] Name, + // ediPartyName [5] EDIPartyName, + // uniformResourceIdentifier [6] IA5String, + // iPAddress [7] OCTET STRING, + // registeredID [8] OBJECT IDENTIFIER } + result = + mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + const char * urlptr = reinterpret_cast(p); + VerifyOrExit((len > strlen(kValidCDPURIHttpPrefix) && + strncmp(urlptr, kValidCDPURIHttpPrefix, strlen(kValidCDPURIHttpPrefix)) == 0) || + (len > strlen(kValidCDPURIHttpsPrefix) && + strncmp(urlptr, kValidCDPURIHttpsPrefix, strlen(kValidCDPURIHttpsPrefix)) == 0), + error = CHIP_ERROR_NOT_FOUND); + error = CopyCharSpanToMutableCharSpan(CharSpan(urlptr, len), cdpurl); + SuccessOrExit(error); + } + p = end_of_ext; + } + + VerifyOrExit(cdpExtCount == 1, error = CHIP_ERROR_NOT_FOUND); + +exit: + _log_mbedTLS_error(result); + mbedtls_x509_crt_free(&mbed_cert); + +#else + (void) certificate; + (void) cdpurl; + CHIP_ERROR error = CHIP_ERROR_NOT_IMPLEMENTED; +#endif // defined(MBEDTLS_X509_CRT_PARSE_C) + + return error; +} + CHIP_ERROR ExtractSerialNumberFromX509Cert(const ByteSpan & certificate, MutableByteSpan & serialNumber) { #if defined(MBEDTLS_X509_CRT_PARSE_C) diff --git a/src/crypto/tests/CHIPCryptoPALTest.cpp b/src/crypto/tests/CHIPCryptoPALTest.cpp index 5f377841935725..9eb01b6723dabb 100644 --- a/src/crypto/tests/CHIPCryptoPALTest.cpp +++ b/src/crypto/tests/CHIPCryptoPALTest.cpp @@ -2106,6 +2106,54 @@ static void TestAKID_x509Extraction(nlTestSuite * inSuite, void * inContext) } } +static void TestCDPExtension_x509Extraction(nlTestSuite * inSuite, void * inContext) +{ + using namespace TestCerts; + + HeapChecker heapChecker(inSuite); + CHIP_ERROR err = CHIP_NO_ERROR; + + struct CDPTestCase + { + ByteSpan Cert; + CHIP_ERROR mExpectedError; + CharSpan mExpectedResult; + }; + + constexpr const char * exampleHttpURI = "http://example.com/crl.pem"; + constexpr const char * exampleHttpsURI = "https://example.com/crl.pem"; + + // clang-format off + static CDPTestCase sCDPTestCases[] = { + // Cert Expected Error Expected Output + // =============================================================================================== + { ByteSpan(), CHIP_ERROR_INVALID_ARGUMENT, CharSpan() }, + { sTestCert_PAA_FFF1_Cert, CHIP_ERROR_NOT_FOUND, CharSpan() }, + { sTestCert_PAI_FFF2_8001_Cert, CHIP_ERROR_NOT_FOUND, CharSpan() }, + { sTestCert_DAC_FFF2_8003_0019_FB_Cert, CHIP_ERROR_NOT_FOUND, CharSpan() }, + { sTestCert_DAC_FFF1_8000_0000_CDP_Cert, CHIP_NO_ERROR, CharSpan::fromCharString(exampleHttpURI) }, + { sTestCert_DAC_FFF1_8000_0000_CDP_HTTPS_Cert, CHIP_NO_ERROR, CharSpan::fromCharString(exampleHttpsURI) }, + { sTestCert_DAC_FFF1_8000_0000_2CDPs_Cert, CHIP_ERROR_NOT_FOUND, CharSpan() }, + { sTestCert_DAC_FFF1_8000_0000_CDP_2URIs_Cert, CHIP_ERROR_NOT_FOUND, CharSpan() }, + { sTestCert_DAC_FFF1_8000_0000_CDP_Wrong_Prefix_Cert, CHIP_ERROR_NOT_FOUND, CharSpan() }, + { sTestCert_DAC_FFF1_8000_0000_CDP_Long_Cert, CHIP_ERROR_BUFFER_TOO_SMALL, CharSpan() }, + }; + // clang-format on + + for (auto & testCase : sCDPTestCases) + { + char cdpBuf[kMaxCRLDistributionPointURLLength] = { '\0' }; + MutableCharSpan cdp(cdpBuf); + err = ExtractCRLDistributionPointURIFromX509Cert(testCase.Cert, cdp); + NL_TEST_ASSERT(inSuite, err == testCase.mExpectedError); + if (err == CHIP_NO_ERROR) + { + NL_TEST_ASSERT(inSuite, cdp.size() == testCase.mExpectedResult.size()); + NL_TEST_ASSERT(inSuite, cdp.data_equal(testCase.mExpectedResult)); + } + } +} + static void TestSerialNumber_x509Extraction(nlTestSuite * inSuite, void * inContext) { using namespace TestCerts; @@ -2703,6 +2751,7 @@ static const nlTest sTests[] = { NL_TEST_DEF("Test x509 Certificate Timestamp Validation", TestX509_IssuingTimestampValidation), NL_TEST_DEF("Test Subject Key Id Extraction from x509 Certificate", TestSKID_x509Extraction), NL_TEST_DEF("Test Authority Key Id Extraction from x509 Certificate", TestAKID_x509Extraction), + NL_TEST_DEF("Test CRL Distribution Point Extension Extraction from x509 Certificate", TestCDPExtension_x509Extraction), NL_TEST_DEF("Test Serial Number Extraction from x509 Certificate", TestSerialNumber_x509Extraction), NL_TEST_DEF("Test Subject Extraction from x509 Certificate", TestSubject_x509Extraction), NL_TEST_DEF("Test Issuer Extraction from x509 Certificate", TestIssuer_x509Extraction), diff --git a/src/platform/nxp/common/crypto/CHIPCryptoPALTinyCrypt.cpp b/src/platform/nxp/common/crypto/CHIPCryptoPALTinyCrypt.cpp index e5fedf2d7f994d..96973dcf12046d 100644 --- a/src/platform/nxp/common/crypto/CHIPCryptoPALTinyCrypt.cpp +++ b/src/platform/nxp/common/crypto/CHIPCryptoPALTinyCrypt.cpp @@ -1150,6 +1150,7 @@ constexpr uint8_t sOID_Extension_BasicConstraints[] = { 0x55, 0x1D, 0x13 } constexpr uint8_t sOID_Extension_KeyUsage[] = { 0x55, 0x1D, 0x0F }; constexpr uint8_t sOID_Extension_SubjectKeyIdentifier[] = { 0x55, 0x1D, 0x0E }; constexpr uint8_t sOID_Extension_AuthorityKeyIdentifier[] = { 0x55, 0x1D, 0x23 }; +constexpr uint8_t sOID_Extension_CRLDistributionPoint[] = { 0x55, 0x1D, 0x1F }; /** * Compares an mbedtls_asn1_buf structure (oidBuf) to a reference OID represented as uint8_t array (oid). @@ -1612,6 +1613,128 @@ CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan return ExtractKIDFromX509Cert(false, certificate, akid); } +CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl) +{ +#if defined(MBEDTLS_X509_CRT_PARSE_C) + CHIP_ERROR error = CHIP_ERROR_NOT_FOUND; + mbedtls_x509_crt mbed_cert; + unsigned char * p = nullptr; + const unsigned char * end = nullptr; + size_t len = 0; + size_t cdpExtCount = 0; + + VerifyOrReturnError(!certificate.empty() && CanCastTo(certificate.size()), CHIP_ERROR_INVALID_ARGUMENT); + + mbedtls_x509_crt_init(&mbed_cert); + + int result = mbedtls_x509_crt_parse(&mbed_cert, Uint8::to_const_uchar(certificate.data()), certificate.size()); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); + + p = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p); + end = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p) + + mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(len); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + while (p < end) + { + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OID); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + mbedtls_x509_buf extOID = { MBEDTLS_ASN1_OID, len, p }; + bool isCurrentExtCDP = OID_CMP(sOID_Extension_CRLDistributionPoint, extOID); + p += len; + + int is_critical = 0; + result = mbedtls_asn1_get_bool(&p, end, &is_critical); + VerifyOrExit(result == 0 || result == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG, error = CHIP_ERROR_WRONG_CERT_TYPE); + + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OCTET_STRING); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + unsigned char * end_of_ext = p + len; + + if (isCurrentExtCDP) + { + // Only one CRL Distribution Point Extension is allowed. + cdpExtCount++; + VerifyOrExit(cdpExtCount <= 1, error = CHIP_ERROR_NOT_FOUND); + + // CRL Distribution Point Extension is encoded as a secuense of DistributionPoint: + // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + // + // This implementation only supports a single DistributionPoint (sequence of size 1), + // which is verified by comparing (p + len == end_of_ext) + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPoint is a sequence of three optional elements: + // DistributionPoint ::= SEQUENCE { + // distributionPoint [0] DistributionPointName OPTIONAL, + // reasons [1] ReasonFlags OPTIONAL, + // cRLIssuer [2] GeneralNames OPTIONAL } + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPointName is: + // DistributionPointName ::= CHOICE { + // fullName [0] GeneralNames, + // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + // + // The URI should be encoded in the fullName element. + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | 0); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // The CDP URI is encoded as a uniformResourceIdentifier field of the GeneralName: + // GeneralName ::= CHOICE { + // otherName [0] OtherName, + // rfc822Name [1] IA5String, + // dNSName [2] IA5String, + // x400Address [3] ORAddress, + // directoryName [4] Name, + // ediPartyName [5] EDIPartyName, + // uniformResourceIdentifier [6] IA5String, + // iPAddress [7] OCTET STRING, + // registeredID [8] OBJECT IDENTIFIER } + result = + mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + const char * urlptr = reinterpret_cast(p); + VerifyOrExit((len > strlen(kValidCDPURIHttpPrefix) && + strncmp(urlptr, kValidCDPURIHttpPrefix, strlen(kValidCDPURIHttpPrefix)) == 0) || + (len > strlen(kValidCDPURIHttpsPrefix) && + strncmp(urlptr, kValidCDPURIHttpsPrefix, strlen(kValidCDPURIHttpsPrefix)) == 0), + error = CHIP_ERROR_NOT_FOUND); + error = CopyCharSpanToMutableCharSpan(CharSpan(urlptr, len), cdpurl); + SuccessOrExit(error); + } + p = end_of_ext; + } + + VerifyOrExit(cdpExtCount == 1, error = CHIP_ERROR_NOT_FOUND); + +exit: + _log_mbedTLS_error(result); + mbedtls_x509_crt_free(&mbed_cert); + +#else + (void) certificate; + (void) cdpurl; + CHIP_ERROR error = CHIP_ERROR_NOT_IMPLEMENTED; +#endif // defined(MBEDTLS_X509_CRT_PARSE_C) + + return error; +} + CHIP_ERROR ExtractSerialNumberFromX509Cert(const ByteSpan & certificate, MutableByteSpan & serialNumber) { #if defined(MBEDTLS_X509_CRT_PARSE_C) diff --git a/src/platform/nxp/k32w/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp b/src/platform/nxp/k32w/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp index 93c286c0edaa9f..b7d49c4fdb2e66 100644 --- a/src/platform/nxp/k32w/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp +++ b/src/platform/nxp/k32w/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp @@ -1120,6 +1120,7 @@ constexpr uint8_t sOID_Extension_BasicConstraints[] = { 0x55, 0x1D, 0x13 } constexpr uint8_t sOID_Extension_KeyUsage[] = { 0x55, 0x1D, 0x0F }; constexpr uint8_t sOID_Extension_SubjectKeyIdentifier[] = { 0x55, 0x1D, 0x0E }; constexpr uint8_t sOID_Extension_AuthorityKeyIdentifier[] = { 0x55, 0x1D, 0x23 }; +constexpr uint8_t sOID_Extension_CRLDistributionPoint[] = { 0x55, 0x1D, 0x1F }; /** * Compares an mbedtls_asn1_buf structure (oidBuf) to a reference OID represented as uint8_t array (oid). @@ -1581,6 +1582,128 @@ CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan return ExtractKIDFromX509Cert(false, certificate, akid); } +CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl) +{ +#if defined(MBEDTLS_X509_CRT_PARSE_C) + CHIP_ERROR error = CHIP_ERROR_NOT_FOUND; + mbedtls_x509_crt mbed_cert; + unsigned char * p = nullptr; + const unsigned char * end = nullptr; + size_t len = 0; + size_t cdpExtCount = 0; + + VerifyOrReturnError(!certificate.empty() && CanCastTo(certificate.size()), CHIP_ERROR_INVALID_ARGUMENT); + + mbedtls_x509_crt_init(&mbed_cert); + + int result = mbedtls_x509_crt_parse(&mbed_cert, Uint8::to_const_uchar(certificate.data()), certificate.size()); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); + + p = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p); + end = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p) + + mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(len); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + while (p < end) + { + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OID); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + mbedtls_x509_buf extOID = { MBEDTLS_ASN1_OID, len, p }; + bool isCurrentExtCDP = OID_CMP(sOID_Extension_CRLDistributionPoint, extOID); + p += len; + + int is_critical = 0; + result = mbedtls_asn1_get_bool(&p, end, &is_critical); + VerifyOrExit(result == 0 || result == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG, error = CHIP_ERROR_WRONG_CERT_TYPE); + + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OCTET_STRING); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + unsigned char * end_of_ext = p + len; + + if (isCurrentExtCDP) + { + // Only one CRL Distribution Point Extension is allowed. + cdpExtCount++; + VerifyOrExit(cdpExtCount <= 1, error = CHIP_ERROR_NOT_FOUND); + + // CRL Distribution Point Extension is encoded as a secuense of DistributionPoint: + // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + // + // This implementation only supports a single DistributionPoint (sequence of size 1), + // which is verified by comparing (p + len == end_of_ext) + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPoint is a sequence of three optional elements: + // DistributionPoint ::= SEQUENCE { + // distributionPoint [0] DistributionPointName OPTIONAL, + // reasons [1] ReasonFlags OPTIONAL, + // cRLIssuer [2] GeneralNames OPTIONAL } + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPointName is: + // DistributionPointName ::= CHOICE { + // fullName [0] GeneralNames, + // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + // + // The URI should be encoded in the fullName element. + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | 0); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // The CDP URI is encoded as a uniformResourceIdentifier field of the GeneralName: + // GeneralName ::= CHOICE { + // otherName [0] OtherName, + // rfc822Name [1] IA5String, + // dNSName [2] IA5String, + // x400Address [3] ORAddress, + // directoryName [4] Name, + // ediPartyName [5] EDIPartyName, + // uniformResourceIdentifier [6] IA5String, + // iPAddress [7] OCTET STRING, + // registeredID [8] OBJECT IDENTIFIER } + result = + mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + const char * urlptr = reinterpret_cast(p); + VerifyOrExit((len > strlen(kValidCDPURIHttpPrefix) && + strncmp(urlptr, kValidCDPURIHttpPrefix, strlen(kValidCDPURIHttpPrefix)) == 0) || + (len > strlen(kValidCDPURIHttpsPrefix) && + strncmp(urlptr, kValidCDPURIHttpsPrefix, strlen(kValidCDPURIHttpsPrefix)) == 0), + error = CHIP_ERROR_NOT_FOUND); + error = CopyCharSpanToMutableCharSpan(CharSpan(urlptr, len), cdpurl); + SuccessOrExit(error); + } + p = end_of_ext; + } + + VerifyOrExit(cdpExtCount == 1, error = CHIP_ERROR_NOT_FOUND); + +exit: + _log_mbedTLS_error(result); + mbedtls_x509_crt_free(&mbed_cert); + +#else + (void) certificate; + (void) cdpurl; + CHIP_ERROR error = CHIP_ERROR_NOT_IMPLEMENTED; +#endif // defined(MBEDTLS_X509_CRT_PARSE_C) + + return error; +} + CHIP_ERROR ExtractSerialNumberFromX509Cert(const ByteSpan & certificate, MutableByteSpan & serialNumber) { #if defined(MBEDTLS_X509_CRT_PARSE_C) diff --git a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp index 321aaac5363d19..1bcfbdc59edaa5 100644 --- a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp +++ b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp @@ -1151,6 +1151,7 @@ constexpr uint8_t sOID_Extension_BasicConstraints[] = { 0x55, 0x1D, 0x13 } constexpr uint8_t sOID_Extension_KeyUsage[] = { 0x55, 0x1D, 0x0F }; constexpr uint8_t sOID_Extension_SubjectKeyIdentifier[] = { 0x55, 0x1D, 0x0E }; constexpr uint8_t sOID_Extension_AuthorityKeyIdentifier[] = { 0x55, 0x1D, 0x23 }; +constexpr uint8_t sOID_Extension_CRLDistributionPoint[] = { 0x55, 0x1D, 0x1F }; /** * Compares an mbedtls_asn1_buf structure (oidBuf) to a reference OID represented as uint8_t array (oid). @@ -1612,6 +1613,128 @@ CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan return ExtractKIDFromX509Cert(false, certificate, akid); } +CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl) +{ +#if defined(MBEDTLS_X509_CRT_PARSE_C) + CHIP_ERROR error = CHIP_ERROR_NOT_FOUND; + mbedtls_x509_crt mbed_cert; + unsigned char * p = nullptr; + const unsigned char * end = nullptr; + size_t len = 0; + size_t cdpExtCount = 0; + + VerifyOrReturnError(!certificate.empty() && CanCastTo(certificate.size()), CHIP_ERROR_INVALID_ARGUMENT); + + mbedtls_x509_crt_init(&mbed_cert); + + int result = mbedtls_x509_crt_parse(&mbed_cert, Uint8::to_const_uchar(certificate.data()), certificate.size()); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); + + p = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p); + end = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p) + + mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(len); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + while (p < end) + { + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OID); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + mbedtls_x509_buf extOID = { MBEDTLS_ASN1_OID, len, p }; + bool isCurrentExtCDP = OID_CMP(sOID_Extension_CRLDistributionPoint, extOID); + p += len; + + int is_critical = 0; + result = mbedtls_asn1_get_bool(&p, end, &is_critical); + VerifyOrExit(result == 0 || result == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG, error = CHIP_ERROR_WRONG_CERT_TYPE); + + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OCTET_STRING); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + unsigned char * end_of_ext = p + len; + + if (isCurrentExtCDP) + { + // Only one CRL Distribution Point Extension is allowed. + cdpExtCount++; + VerifyOrExit(cdpExtCount <= 1, error = CHIP_ERROR_NOT_FOUND); + + // CRL Distribution Point Extension is encoded as a secuense of DistributionPoint: + // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + // + // This implementation only supports a single DistributionPoint (sequence of size 1), + // which is verified by comparing (p + len == end_of_ext) + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPoint is a sequence of three optional elements: + // DistributionPoint ::= SEQUENCE { + // distributionPoint [0] DistributionPointName OPTIONAL, + // reasons [1] ReasonFlags OPTIONAL, + // cRLIssuer [2] GeneralNames OPTIONAL } + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPointName is: + // DistributionPointName ::= CHOICE { + // fullName [0] GeneralNames, + // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + // + // The URI should be encoded in the fullName element. + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | 0); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // The CDP URI is encoded as a uniformResourceIdentifier field of the GeneralName: + // GeneralName ::= CHOICE { + // otherName [0] OtherName, + // rfc822Name [1] IA5String, + // dNSName [2] IA5String, + // x400Address [3] ORAddress, + // directoryName [4] Name, + // ediPartyName [5] EDIPartyName, + // uniformResourceIdentifier [6] IA5String, + // iPAddress [7] OCTET STRING, + // registeredID [8] OBJECT IDENTIFIER } + result = + mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + const char * urlptr = reinterpret_cast(p); + VerifyOrExit((len > strlen(kValidCDPURIHttpPrefix) && + strncmp(urlptr, kValidCDPURIHttpPrefix, strlen(kValidCDPURIHttpPrefix)) == 0) || + (len > strlen(kValidCDPURIHttpsPrefix) && + strncmp(urlptr, kValidCDPURIHttpsPrefix, strlen(kValidCDPURIHttpsPrefix)) == 0), + error = CHIP_ERROR_NOT_FOUND); + error = CopyCharSpanToMutableCharSpan(CharSpan(urlptr, len), cdpurl); + SuccessOrExit(error); + } + p = end_of_ext; + } + + VerifyOrExit(cdpExtCount == 1, error = CHIP_ERROR_NOT_FOUND); + +exit: + _log_mbedTLS_error(result); + mbedtls_x509_crt_free(&mbed_cert); + +#else + (void) certificate; + (void) cdpurl; + CHIP_ERROR error = CHIP_ERROR_NOT_IMPLEMENTED; +#endif // defined(MBEDTLS_X509_CRT_PARSE_C) + + return error; +} + CHIP_ERROR ExtractSerialNumberFromX509Cert(const ByteSpan & certificate, MutableByteSpan & serialNumber) { #if defined(MBEDTLS_X509_CRT_PARSE_C) diff --git a/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp b/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp index 63a7a17308ab13..e0b5906c1a816b 100644 --- a/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp +++ b/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp @@ -1457,6 +1457,7 @@ constexpr uint8_t sOID_Extension_BasicConstraints[] = { 0x55, 0x1D, 0x13 } constexpr uint8_t sOID_Extension_KeyUsage[] = { 0x55, 0x1D, 0x0F }; constexpr uint8_t sOID_Extension_SubjectKeyIdentifier[] = { 0x55, 0x1D, 0x0E }; constexpr uint8_t sOID_Extension_AuthorityKeyIdentifier[] = { 0x55, 0x1D, 0x23 }; +constexpr uint8_t sOID_Extension_CRLDistributionPoint[] = { 0x55, 0x1D, 0x1F }; /** * Compares an mbedtls_asn1_buf structure (oidBuf) to a reference OID represented as uint8_t array (oid). @@ -1973,6 +1974,128 @@ CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan return ExtractKIDFromX509Cert(false, certificate, akid); } +CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl) +{ +#if defined(MBEDTLS_X509_CRT_PARSE_C) + CHIP_ERROR error = CHIP_ERROR_NOT_FOUND; + mbedtls_x509_crt mbed_cert; + unsigned char * p = nullptr; + const unsigned char * end = nullptr; + size_t len = 0; + size_t cdpExtCount = 0; + + VerifyOrReturnError(!certificate.empty() && CanCastTo(certificate.size()), CHIP_ERROR_INVALID_ARGUMENT); + + mbedtls_x509_crt_init(&mbed_cert); + + int result = mbedtls_x509_crt_parse(&mbed_cert, Uint8::to_const_uchar(certificate.data()), certificate.size()); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); + + p = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p); + end = mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(p) + + mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(v3_ext).CHIP_CRYPTO_PAL_PRIVATE_X509(len); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + while (p < end) + { + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OID); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + mbedtls_x509_buf extOID = { MBEDTLS_ASN1_OID, len, p }; + bool isCurrentExtCDP = OID_CMP(sOID_Extension_CRLDistributionPoint, extOID); + p += len; + + int is_critical = 0; + result = mbedtls_asn1_get_bool(&p, end, &is_critical); + VerifyOrExit(result == 0 || result == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG, error = CHIP_ERROR_WRONG_CERT_TYPE); + + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OCTET_STRING); + VerifyOrExit(result == 0, error = CHIP_ERROR_WRONG_CERT_TYPE); + + unsigned char * end_of_ext = p + len; + + if (isCurrentExtCDP) + { + // Only one CRL Distribution Point Extension is allowed. + cdpExtCount++; + VerifyOrExit(cdpExtCount <= 1, error = CHIP_ERROR_NOT_FOUND); + + // CRL Distribution Point Extension is encoded as a secuense of DistributionPoint: + // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + // + // This implementation only supports a single DistributionPoint (sequence of size 1), + // which is verified by comparing (p + len == end_of_ext) + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPoint is a sequence of three optional elements: + // DistributionPoint ::= SEQUENCE { + // distributionPoint [0] DistributionPointName OPTIONAL, + // reasons [1] ReasonFlags OPTIONAL, + // cRLIssuer [2] GeneralNames OPTIONAL } + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + VerifyOrExit(p + len == end_of_ext, error = CHIP_ERROR_NOT_FOUND); + + // The DistributionPointName is: + // DistributionPointName ::= CHOICE { + // fullName [0] GeneralNames, + // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + // + // The URI should be encoded in the fullName element. + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | 0); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName + result = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + // The CDP URI is encoded as a uniformResourceIdentifier field of the GeneralName: + // GeneralName ::= CHOICE { + // otherName [0] OtherName, + // rfc822Name [1] IA5String, + // dNSName [2] IA5String, + // x400Address [3] ORAddress, + // directoryName [4] Name, + // ediPartyName [5] EDIPartyName, + // uniformResourceIdentifier [6] IA5String, + // iPAddress [7] OCTET STRING, + // registeredID [8] OBJECT IDENTIFIER } + result = + mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER); + VerifyOrExit(result == 0, error = CHIP_ERROR_NOT_FOUND); + + const char * urlptr = reinterpret_cast(p); + VerifyOrExit((len > strlen(kValidCDPURIHttpPrefix) && + strncmp(urlptr, kValidCDPURIHttpPrefix, strlen(kValidCDPURIHttpPrefix)) == 0) || + (len > strlen(kValidCDPURIHttpsPrefix) && + strncmp(urlptr, kValidCDPURIHttpsPrefix, strlen(kValidCDPURIHttpsPrefix)) == 0), + error = CHIP_ERROR_NOT_FOUND); + error = CopyCharSpanToMutableCharSpan(CharSpan(urlptr, len), cdpurl); + SuccessOrExit(error); + } + p = end_of_ext; + } + + VerifyOrExit(cdpExtCount == 1, error = CHIP_ERROR_NOT_FOUND); + +exit: + _log_mbedTLS_error(result); + mbedtls_x509_crt_free(&mbed_cert); + +#else + (void) certificate; + (void) cdpurl; + CHIP_ERROR error = CHIP_ERROR_NOT_IMPLEMENTED; +#endif // defined(MBEDTLS_X509_CRT_PARSE_C) + + return error; +} + CHIP_ERROR ExtractSerialNumberFromX509Cert(const ByteSpan & certificate, MutableByteSpan & serialNumber) { #if defined(MBEDTLS_X509_CRT_PARSE_C) diff --git a/src/tools/chip-cert/CertUtils.cpp b/src/tools/chip-cert/CertUtils.cpp index 2fece459ac4495..3fcf474e9abba8 100644 --- a/src/tools/chip-cert/CertUtils.cpp +++ b/src/tools/chip-cert/CertUtils.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021-2022 Project CHIP Authors + * Copyright (c) 2021-2023 Project CHIP Authors * Copyright (c) 2013-2017 Nest Labs, Inc. * All rights reserved. * @@ -1284,7 +1284,8 @@ bool ResignCert(X509 * cert, X509 * caCert, EVP_PKEY * caKey) bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subjectVID, uint16_t subjectPID, bool encodeVIDandPIDasCN, X509 * caCert, EVP_PKEY * caKey, const struct tm & validFrom, uint32_t validDays, - X509 * newCert, EVP_PKEY * newKey, CertStructConfig & certConfig) + X509 * newCert, EVP_PKEY * newKey, CertStructConfig & certConfig, const FutureExtensionWithNID * exts, + uint8_t extsCount) { bool res = true; uint16_t vid = certConfig.IsSubjectVIDMismatch() ? static_cast(subjectVID + 1) : subjectVID; @@ -1468,6 +1469,12 @@ bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subje VerifyTrueOrExit(res); } + for (uint8_t i = 0; i < extsCount; i++) + { + res = AddExtension(newCert, exts[i].nid, exts[i].info); + VerifyTrueOrExit(res); + } + // Sign the new certificate. if (!X509_sign(newCert, caKey, certConfig.GetSignatureAlgorithmDER())) { diff --git a/src/tools/chip-cert/Cmd_GenAttCert.cpp b/src/tools/chip-cert/Cmd_GenAttCert.cpp index 270e42cfcbd1d6..7f57e1df20542d 100644 --- a/src/tools/chip-cert/Cmd_GenAttCert.cpp +++ b/src/tools/chip-cert/Cmd_GenAttCert.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021-2022 Project CHIP Authors + * Copyright (c) 2021-2023 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -57,6 +57,7 @@ OptionDef gCmdOptionDefs[] = { "out-key", kArgumentRequired, 'O' }, { "valid-from", kArgumentRequired, 'f' }, { "lifetime", kArgumentRequired, 'l' }, + { "cpd-ext", kArgumentRequired, 'x' }, #if CHIP_CONFIG_INTERNAL_FLAG_GENERATE_DA_TEST_CASES { "ignore-error", kNoArgument, 'I' }, { "error-type", kArgumentRequired, 'E' }, @@ -125,6 +126,11 @@ const char * const gCmdOptionHelp = " 4294967295 to indicate that certificate doesn't have well defined\n" " expiration date\n" "\n" + " -x, --cpd-ext \n" + "\n" + " CRL Distribution Points (CDP) extension (NID_crl_distribution_points) extension to be added to the list\n" + " of certificate extensions.\n" + "\n" #if CHIP_CONFIG_INTERNAL_FLAG_GENERATE_DA_TEST_CASES " -I, --ignore-error\n" "\n" @@ -201,17 +207,19 @@ OptionSet *gCmdOptionSets[] = }; // clang-format on -AttCertType gAttCertType = kAttCertType_NotSpecified; -const char * gSubjectCN = nullptr; -uint16_t gSubjectVID = VendorId::NotSpecified; -uint16_t gSubjectPID = 0; -bool gEncodeVIDandPIDasCN = false; -const char * gCACertFileNameOrStr = nullptr; -const char * gCAKeyFileNameOrStr = nullptr; -const char * gInKeyFileNameOrStr = nullptr; -const char * gOutCertFileName = nullptr; -const char * gOutKeyFileName = nullptr; -uint32_t gValidDays = kCertValidDays_Undefined; +AttCertType gAttCertType = kAttCertType_NotSpecified; +const char * gSubjectCN = nullptr; +uint16_t gSubjectVID = VendorId::NotSpecified; +uint16_t gSubjectPID = 0; +bool gEncodeVIDandPIDasCN = false; +const char * gCACertFileNameOrStr = nullptr; +const char * gCAKeyFileNameOrStr = nullptr; +const char * gInKeyFileNameOrStr = nullptr; +const char * gOutCertFileName = nullptr; +const char * gOutKeyFileName = nullptr; +uint32_t gValidDays = kCertValidDays_Undefined; +FutureExtensionWithNID gCPDExtensions[3] = { { 0, nullptr } }; +uint8_t gCPDExtensionsCount = 0; struct tm gValidFrom; CertStructConfig gCertConfig; @@ -291,6 +299,11 @@ bool HandleOption(const char * progName, OptionSet * optSet, int id, const char return false; } break; + case 'x': + gCPDExtensions[gCPDExtensionsCount].nid = NID_crl_distribution_points; + gCPDExtensions[gCPDExtensionsCount].info = arg; + gCPDExtensionsCount++; + break; #if CHIP_CONFIG_INTERNAL_FLAG_GENERATE_DA_TEST_CASES case 'I': gCertConfig.EnableErrorTestCase(); @@ -555,7 +568,7 @@ bool Cmd_GenAttCert(int argc, char * argv[]) if (gAttCertType == kAttCertType_PAA) { res = MakeAttCert(gAttCertType, gSubjectCN, gSubjectVID, gSubjectPID, gEncodeVIDandPIDasCN, newCert.get(), newKey.get(), - gValidFrom, gValidDays, newCert.get(), newKey.get(), gCertConfig); + gValidFrom, gValidDays, newCert.get(), newKey.get(), gCertConfig, gCPDExtensions, gCPDExtensionsCount); VerifyTrueOrExit(res); } else @@ -570,7 +583,7 @@ bool Cmd_GenAttCert(int argc, char * argv[]) VerifyTrueOrExit(res); res = MakeAttCert(gAttCertType, gSubjectCN, gSubjectVID, gSubjectPID, gEncodeVIDandPIDasCN, caCert.get(), caKey.get(), - gValidFrom, gValidDays, newCert.get(), newKey.get(), gCertConfig); + gValidFrom, gValidDays, newCert.get(), newKey.get(), gCertConfig, gCPDExtensions, gCPDExtensionsCount); VerifyTrueOrExit(res); } diff --git a/src/tools/chip-cert/chip-cert.h b/src/tools/chip-cert/chip-cert.h index 1c0e4a2b1d90d9..2f203193e38e44 100644 --- a/src/tools/chip-cert/chip-cert.h +++ b/src/tools/chip-cert/chip-cert.h @@ -437,7 +437,8 @@ extern bool ResignCert(X509 * cert, X509 * caCert, EVP_PKEY * caKey); extern bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subjectVID, uint16_t subjectPID, bool encodeVIDandPIDasCN, X509 * caCert, EVP_PKEY * caKey, const struct tm & validFrom, uint32_t validDays, - X509 * newCert, EVP_PKEY * newKey, CertStructConfig & certConfig); + X509 * newCert, EVP_PKEY * newKey, CertStructConfig & certConfig, const FutureExtensionWithNID * exts, + uint8_t extsCount); extern bool GenerateKeyPair(EVP_PKEY * key); extern bool GenerateKeyPair_Secp256k1(EVP_PKEY * key); extern bool ReadKey(const char * fileNameOrStr, std::unique_ptr & key, From c3f1f1ace0132b93240566b011ee25446a51550a Mon Sep 17 00:00:00 2001 From: C Freeman Date: Tue, 11 Jul 2023 14:42:07 -0400 Subject: [PATCH 25/34] TC-ACE-1.2 (#27157) * TC-ACE-1.2 * Add TC-ACE-1.2 to CI * Whoops, added test twice * Fixes to TC-ACE-1.2 * Set an option to not auto-resubscribe If we error on initial subscription becuase we're NEVER going to have access, the python scripts will never return - they will continue to resubscribe forever and the future never completes. This flag prevents any resubscription attempts. It's used in this test becuase I know we're going to get a failure and I'd like to have it returned. * Fix python linter * Restyled by isort * linter. * Apply suggestions from code review Co-authored-by: Marc Lepage <67919234+mlepage-google@users.noreply.github.com> * Fix weird typo. --------- Co-authored-by: Restyled.io Co-authored-by: Marc Lepage <67919234+mlepage-google@users.noreply.github.com> --- .github/workflows/tests.yaml | 1 + src/controller/python/chip/ChipDeviceCtrl.py | 15 +- .../python/chip/clusters/Attribute.py | 10 +- .../python/chip/clusters/attribute.cpp | 16 +- src/python_testing/TC_ACE_1_2.py | 272 ++++++++++++++++++ 5 files changed, 303 insertions(+), 11 deletions(-) create mode 100644 src/python_testing/TC_ACE_1_2.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5aa759bed4807c..b8e5afb551d559 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -442,6 +442,7 @@ jobs: 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_decode 1" --script "src/python_testing/TC_SC_3_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021"' 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_decode 1" --script "src/python_testing/TC_DA_1_7.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --bool-arg allow_sdk_dac:true"' 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_decode 1 --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_TestEventTrigger.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --bool-arg allow_sdk_dac:true"' + 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_decode 1" --script "src/python_testing/TC_ACE_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021"' 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_decode 1" --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"' 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_decode 1" --script "src/python_testing/TC_ACE_1_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021"' 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_decode 1" --script "src/python_testing/TC_CGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021"' diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 4e4f7752d2d580..1022182a9d94cd 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -1016,7 +1016,7 @@ async def Read(self, nodeid: int, attributes: typing.List[typing.Union[ ]] = None, eventNumberFilter: typing.Optional[int] = None, returnClusterObject: bool = False, reportInterval: typing.Tuple[int, int] = None, - fabricFiltered: bool = True, keepSubscriptions: bool = False): + fabricFiltered: bool = True, keepSubscriptions: bool = False, autoResubscribe: bool = True): ''' Read a list of attributes and/or events from a target node @@ -1076,7 +1076,7 @@ async def Read(self, nodeid: int, attributes: typing.List[typing.Union[ subscriptionParameters=ClusterAttribute.SubscriptionParameters( reportInterval[0], reportInterval[1]) if reportInterval else None, fabricFiltered=fabricFiltered, - keepSubscriptions=keepSubscriptions).raise_on_error() + keepSubscriptions=keepSubscriptions, autoResubscribe=autoResubscribe).raise_on_error() return await future async def ReadAttribute(self, nodeid: int, attributes: typing.List[typing.Union[ @@ -1093,7 +1093,7 @@ async def ReadAttribute(self, nodeid: int, attributes: typing.List[typing.Union[ ]], dataVersionFilters: typing.List[typing.Tuple[int, typing.Type[ClusterObjects.Cluster], int]] = None, returnClusterObject: bool = False, reportInterval: typing.Tuple[int, int] = None, - fabricFiltered: bool = True, keepSubscriptions: bool = False): + fabricFiltered: bool = True, keepSubscriptions: bool = False, autoResubscribe: bool = True): ''' Read a list of attributes from a target node, this is a wrapper of DeviceController.Read() @@ -1125,7 +1125,8 @@ async def ReadAttribute(self, nodeid: int, attributes: typing.List[typing.Union[ returnClusterObject=returnClusterObject, reportInterval=reportInterval, fabricFiltered=fabricFiltered, - keepSubscriptions=keepSubscriptions) + keepSubscriptions=keepSubscriptions, + autoResubscribe=autoResubscribe) if isinstance(res, ClusterAttribute.SubscriptionTransaction): return res else: @@ -1146,7 +1147,8 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[ ]], eventNumberFilter: typing.Optional[int] = None, fabricFiltered: bool = True, reportInterval: typing.Tuple[int, int] = None, - keepSubscriptions: bool = False): + keepSubscriptions: bool = False, + autoResubscribe: bool = True): ''' Read a list of events from a target node, this is a wrapper of DeviceController.Read() @@ -1174,7 +1176,8 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[ When not provided, a read request will be sent. ''' res = await self.Read(nodeid=nodeid, events=events, eventNumberFilter=eventNumberFilter, - fabricFiltered=fabricFiltered, reportInterval=reportInterval, keepSubscriptions=keepSubscriptions) + fabricFiltered=fabricFiltered, reportInterval=reportInterval, keepSubscriptions=keepSubscriptions, + autoResubscribe=autoResubscribe) if isinstance(res, ClusterAttribute.SubscriptionTransaction): return res else: diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index 6f2b52ff179ca3..4572065e3df501 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -615,8 +615,8 @@ def __repr__(self): return f'' -async def DefaultResubscriptionAttemptedCallback(transaction: SubscriptionTransaction, - terminationError, nextResubscribeIntervalMsec): +def DefaultResubscriptionAttemptedCallback(transaction: SubscriptionTransaction, + terminationError, nextResubscribeIntervalMsec): print(f"Previous subscription failed with Error: {terminationError} - re-subscribing in {nextResubscribeIntervalMsec}ms...") @@ -773,6 +773,8 @@ def handleSubscriptionEstablished(self, subscriptionId): self._handleSubscriptionEstablished, subscriptionId) def handleResubscriptionAttempted(self, terminationCause: PyChipError, nextResubscribeIntervalMsec: int): + if not self._subscription_handler: + return if (self._subscription_handler._onResubscriptionAttemptedCb_isAsync): self._event_loop.create_task(self._subscription_handler._onResubscriptionAttemptedCb( self._subscription_handler, terminationCause.code, nextResubscribeIntervalMsec)) @@ -1040,6 +1042,7 @@ def WriteGroupAttributes(groupId: int, devCtrl: c_void_p, attributes: List[Attri "IsSubscription" / construct.Flag, "IsFabricFiltered" / construct.Flag, "KeepSubscriptions" / construct.Flag, + "AutoResubscribe" / construct.Flag, ) @@ -1047,7 +1050,7 @@ def Read(future: Future, eventLoop, device, devCtrl, attributes: List[AttributePath] = None, dataVersionFilters: List[DataVersionFilter] = None, events: List[EventPath] = None, eventNumberFilter: Optional[int] = None, returnClusterObject: bool = True, subscriptionParameters: SubscriptionParameters = None, - fabricFiltered: bool = True, keepSubscriptions: bool = False) -> PyChipError: + fabricFiltered: bool = True, keepSubscriptions: bool = False, autoResubscribe: bool = True) -> PyChipError: if (not attributes) and dataVersionFilters: raise ValueError( "Must provide valid attribute list when data version filters is not null") @@ -1119,6 +1122,7 @@ def Read(future: Future, eventLoop, device, devCtrl, if subscriptionParameters is not None: params.MinInterval = subscriptionParameters.MinReportIntervalFloorSeconds params.MaxInterval = subscriptionParameters.MaxReportIntervalCeilingSeconds + params.AutoResubscribe = autoResubscribe params.IsSubscription = True params.KeepSubscriptions = keepSubscriptions params.IsFabricFiltered = fabricFiltered diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index d30655b5daf177..d85d132b36bf8a 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -149,10 +149,17 @@ class ReadClientCallback : public ReadClient::Callback CHIP_ERROR OnResubscriptionNeeded(ReadClient * apReadClient, CHIP_ERROR aTerminationCause) override { - ReturnErrorOnFailure(ReadClient::Callback::OnResubscriptionNeeded(apReadClient, aTerminationCause)); + if (mAutoResubscribe) + { + ReturnErrorOnFailure(ReadClient::Callback::OnResubscriptionNeeded(apReadClient, aTerminationCause)); + } gOnResubscriptionAttemptedCallback(mAppContext, ToPyChipError(aTerminationCause), apReadClient->ComputeTimeTillNextSubscription()); - return CHIP_NO_ERROR; + if (mAutoResubscribe) + { + return CHIP_NO_ERROR; + } + return aTerminationCause; } void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override @@ -226,12 +233,15 @@ class ReadClientCallback : public ReadClient::Callback void AdoptReadClient(std::unique_ptr apReadClient) { mReadClient = std::move(apReadClient); } + void SetAutoResubscribe(bool autoResubscribe) { mAutoResubscribe = autoResubscribe; } + private: BufferedReadCallback mBufferedReadCallback; PyObject * mAppContext; std::unique_ptr mReadClient; + bool mAutoResubscribe = true; }; extern "C" { @@ -243,6 +253,7 @@ struct __attribute__((packed)) PyReadAttributeParams bool isSubscription; bool isFabricFiltered; bool keepSubscriptions; + bool autoResubscribe; }; // Encodes n attribute write requests, follows 3 * n arguments, in the (AttributeWritePath*=void *, uint8_t*, size_t) order. @@ -564,6 +575,7 @@ PyChipError pychip_ReadClient_Read(void * appContext, ReadClient ** pReadClient, params.mMinIntervalFloorSeconds = pyParams.minInterval; params.mMaxIntervalCeilingSeconds = pyParams.maxInterval; params.mKeepSubscriptions = pyParams.keepSubscriptions; + callback->SetAutoResubscribe(pyParams.autoResubscribe); dataVersionFilters.release(); attributePaths.release(); diff --git a/src/python_testing/TC_ACE_1_2.py b/src/python_testing/TC_ACE_1_2.py new file mode 100644 index 00000000000000..1bf5189d04c956 --- /dev/null +++ b/src/python_testing/TC_ACE_1_2.py @@ -0,0 +1,272 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import logging +import queue + +import chip.clusters as Clusters +from chip.clusters import ClusterObjects as ClusterObjects +from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction, TypedAttributePath +from chip.exceptions import ChipStackError +from chip.interaction_model import Status +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class AttributeChangeCallback: + def __init__(self, expected_attribute: ClusterObjects.ClusterAttributeDescriptor, output: queue.Queue): + self._output = output + self._expected_attribute = expected_attribute + + def __call__(self, path: TypedAttributePath, transaction: SubscriptionTransaction): + if path.AttributeType == self._expected_attribute: + q = (path, transaction) + logging.info(f'Got subscription report for {path.AttributeType}') + self._output.put(q) + + +class EventChangeCallback: + def __init__(self, expected_event: ClusterObjects.ClusterEvent, output: queue.Queue): + self._output = output + self._expected_cluster_id = expected_event.cluster_id + self._expected_event_id = expected_event.event_id + + def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): + if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster_id and res.Header.EventId == self._expected_event_id: + logging.info( + f'Got subscription report for event {self._expected_event_id} on cluster {self._expected_cluster_id}: {res.Data}') + self._output.put(res) + + +def WaitForAttributeReport(q: queue.Queue, expected_attribute: ClusterObjects.ClusterAttributeDescriptor): + try: + path, transaction = q.get(block=True, timeout=10) + except queue.Empty: + asserts.fail("Failed to receive a report for the attribute change for {}".format(expected_attribute)) + + asserts.assert_equal(path.AttributeType, expected_attribute, "Received incorrect attribute report") + try: + transaction.GetAttribute(path) + except KeyError: + asserts.fail("Attribute not found in returned report") + + +def WaitForEventReport(q: queue.Queue, expected_event: ClusterObjects.ClusterEvent): + try: + res = q.get(block=True, timeout=10) + except queue.Empty: + asserts.fail("Failed to receive a report for the event {}".format(expected_event)) + + asserts.assert_equal(res.Header.ClusterId, expected_event.cluster_id, "Expected cluster ID not found in event report") + asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") + + +class TC_ACE_1_2(MatterBaseTest): + def __init__(self, *args): + self.breadcrumb = 1 + self.breadcrumb_queue = queue.Queue() + self.subscription_breadcrumb = None + super().__init__(*args) + + async def write_acl(self, acl): + # This returns an attribute status + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(0, Clusters.AccessControl.Attributes.Acl(acl))]) + asserts.assert_equal(result[0].Status, Status.Success, "ACL write failed") + + async def steps_subscribe_breadcrumb(self, print_steps: bool): + if print_steps: + self.print_step(3, "TH2 subscribes to the Breadcrumb attribute") + self.subscription_breadcrumb = await self.TH2.ReadAttribute(nodeid=self.dut_node_id, attributes=[(0, Clusters.GeneralCommissioning.Attributes.Breadcrumb)], reportInterval=(1, 5), keepSubscriptions=False, autoResubscribe=False) + breadcrumb_cb = AttributeChangeCallback(Clusters.GeneralCommissioning.Attributes.Breadcrumb, self.breadcrumb_queue) + self.subscription_breadcrumb.SetAttributeUpdateCallback(breadcrumb_cb) + + async def steps_receive_breadcrumb(self, print_steps: bool): + if print_steps: + self.print_step(9, "TH1 writes the breadcrumb attribute") + await self.default_controller.WriteAttribute(nodeid=self.dut_node_id, attributes=[(0, Clusters.GeneralCommissioning.Attributes.Breadcrumb(self.breadcrumb))]) + + if print_steps: + self.print_step(10, "TH2 waits for a subscription report from the DUT for breadcrumb") + WaitForAttributeReport(self.breadcrumb_queue, Clusters.GeneralCommissioning.Attributes.Breadcrumb) + self.breadcrumb = self.breadcrumb + 1 + + async def steps_admin_subscription_error(self, print_steps: bool): + if print_steps: + self.print_step(13, "Subscribe to the ACL attribute, expect INVALID_ACTION") + try: + await self.TH2.ReadAttribute(nodeid=self.dut_node_id, attributes=[(0, Clusters.AccessControl.Attributes.Acl)], reportInterval=(1, 5), fabricFiltered=False, keepSubscriptions=False, autoResubscribe=False) + asserts.fail("Incorrectly subscribed to attribute with invalid permissions") + except ChipStackError as e: + asserts.assert_equal(e.err, 0x580, "Incorrect error message received from subscription with no permission") + + if print_steps: + self.print_step(14, "Subscribe to the AccessControlEntryChanged event, expect INVALID_ACTION") + try: + await self.TH2.ReadEvent(nodeid=self.dut_node_id, events=[(0, Clusters.AccessControl.Events.AccessControlEntryChanged)], reportInterval=( + 1, 5), fabricFiltered=False, keepSubscriptions=False, autoResubscribe=False) + asserts.fail("Incorrectly subscribed to event with invalid permissions") + except ChipStackError as e: + asserts.assert_equal(e.err, 0x580, "Incorrect error message received from subscription with no permission") + + @async_test_body + async def test_TC_ACE_1_2(self): + self.print_step(1, "Commissioning, already done") + + fabric_admin = self.certificate_authority_manager.activeCaList[0].adminList[0] + + TH1_nodeid = self.matter_test_config.controller_node_id + TH2_nodeid = self.matter_test_config.controller_node_id + 1 + + self.TH2 = fabric_admin.NewController(nodeId=TH2_nodeid, + paaTrustStorePath=str(self.matter_test_config.paa_trust_store_path)) + + self.print_step(2, "TH1 writes ACL for admin with two subjects") + TH1_2_admin = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH1_nodeid, TH2_nodeid], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=0)]) + await self.write_acl([TH1_2_admin]) + + # Step 3 - subscribe to breadcrumb - print handled in function + await self.steps_subscribe_breadcrumb(print_steps=True) + + self.print_step(4, "TH2 subscribes to ACL attribute") + subscription_acl = await self.TH2.ReadAttribute(nodeid=self.dut_node_id, attributes=[(0, Clusters.AccessControl.Attributes.Acl)], reportInterval=(1, 5), fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) + acl_queue = queue.Queue() + acl_cb = AttributeChangeCallback(Clusters.AccessControl.Attributes.Acl, acl_queue) + subscription_acl.SetAttributeUpdateCallback(acl_cb) + + self.print_step(5, "TH2 subscribes to the AccessControlEntryChanged event") + subscription_ace = await self.TH2.ReadEvent(nodeid=self.dut_node_id, events=[(0, Clusters.AccessControl.Events.AccessControlEntryChanged)], reportInterval=(1, 5), fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) + ace_queue = queue.Queue() + ace_cb = EventChangeCallback(Clusters.AccessControl.Events.AccessControlEntryChanged, ace_queue) + subscription_ace.SetEventUpdateCallback(ace_cb) + + self.print_step(6, "TH1 writes ACL attribute") + acl = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH1_nodeid, TH2_nodeid, TH2_nodeid + 1], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=0)]) + await self.write_acl([acl]) + + self.print_step(7, "TH2 waits for subscription report for ACL") + WaitForAttributeReport(acl_queue, Clusters.AccessControl.Attributes.Acl) + + self.print_step(8, "TH2 waits for subscription report for access control entry changed event") + WaitForEventReport(ace_queue, Clusters.AccessControl.Events.AccessControlEntryChanged) + + # this function prints the steps for 9 and 10 + await self.steps_receive_breadcrumb(print_steps=True) + + self.print_step(11, "TH1 writes ACL attribute") + acl1 = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH1_nodeid], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=0)]) + acl2 = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kManage, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH2_nodeid], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=0)]) + await self.write_acl([acl1, acl2]) + + self.print_step(12, "TH2 Repeats steps to change breadcrumb and receive subscription report") + await self.steps_receive_breadcrumb(print_steps=False) + + # step 13 and 14 - printed in the function + await self.steps_admin_subscription_error(print_steps=True) + + self.print_step(15, "TH2 subscribes to breadcrumb attribute") + await self.steps_subscribe_breadcrumb(print_steps=False) + + self.print_step(16, "TH2 Repeats steps to change breadcrumb and receive subscription report") + await self.steps_receive_breadcrumb(print_steps=False) + + self.print_step(17, "TH1 writes ACL attribute") + acl1 = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH1_nodeid], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=0)]) + acl2 = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kOperate, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH2_nodeid], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=0)]) + await self.write_acl([acl1, acl2]) + + self.print_step(18, "TH2 Repeats steps to change breadcrumb and receive subscription report") + await self.steps_receive_breadcrumb(print_steps=False) + + self.print_step(19, "TH2 repeats subscriptions to Admin attribute and event to ensure it still errors") + await self.steps_admin_subscription_error(print_steps=False) + + self.print_step(20, "TH2 subscribes to breadcrumb attribute") + await self.steps_subscribe_breadcrumb(print_steps=False) + + self.print_step(21, "TH2 Repeats steps to change breadcrumb and receive subscription report") + await self.steps_receive_breadcrumb(print_steps=False) + + self.print_step(22, "TH1 writes ACL attribute") + acl1 = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH1_nodeid], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=0)]) + acl2 = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kView, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH2_nodeid], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=0)]) + await self.write_acl([acl1, acl2]) + + self.print_step(23, "TH2 Repeats steps to change breadcrumb and receive subscription report") + await self.steps_receive_breadcrumb(print_steps=False) + + self.print_step(24, "TH2 repeats subscriptions to Admin attribute and event to ensure it still errors") + await self.steps_admin_subscription_error(print_steps=False) + + self.print_step(25, "TH2 subscribes to breadcrumb attribute") + await self.steps_subscribe_breadcrumb(print_steps=False) + + self.print_step(26, "TH2 Repeats steps to change breadcrumb and receive subscription report") + await self.steps_receive_breadcrumb(print_steps=False) + + self.print_step(27, "TH1 writes ACL attribute") + acl = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH1_nodeid], + targets=[]) + await self.write_acl([acl]) + + self.print_step(28, "TH2 repeats subscriptions to Admin attribute and event to ensure it still errors") + await self.steps_admin_subscription_error(print_steps=False) + + self.print_step(29, "TH2 attempts to subscribe to the breadcrumb attribute - expect error") + try: + await self.TH2.ReadAttribute(nodeid=self.dut_node_id, attributes=[(0, Clusters.GeneralCommissioning.Attributes.Breadcrumb)], reportInterval=(1, 5), keepSubscriptions=False, autoResubscribe=False) + asserts.fail("Incorrectly subscribed to attribute with invalid permissions") + except ChipStackError as e: + asserts.assert_equal(e.err, 0x580, "Incorrect error message received from subscription with no permission") + + +if __name__ == "__main__": + default_matter_test_main() From d0be501dbe9a97aa1d7d3b1cf68c9e517a1c8f05 Mon Sep 17 00:00:00 2001 From: manjunath-grl <102359958+manjunath-grl@users.noreply.github.com> Date: Wed, 12 Jul 2023 00:33:59 +0530 Subject: [PATCH 26/34] Test added JUN 28 (#27521) * Fixes issue: 871 & 568 Modifed tests TC-CC-6.1 TC-CC-6.2 TC-CC-6.3 TC-CC-6.5 TC-ACE-1.6 Semi-Automated tests TC-ContentLauncher-10.3 TC-ContentLauncher-10.5 TC-ContentLauncher-10.7 * Auto generated files * Modified tests TC-FLW-2.1 TC-PRS-2.1 TC-RH-2.1 TC-TMP-2.1 Semi-Automated test TC-SC-4.1 Auto generated files * Restyled by whitespace * Added new testcases TC-ICDM-1.1 TC-ICDM-2.1 Added auto generated files * Modified tests TC-CONTENTLAUNCHER-10.5 TC-MEDIAPLAYBACK-6.4 Auto generated files * Added YAML test for TIMESYNC-2.3 * Restyled by prettier-json --------- Co-authored-by: Restyled.io --- .../templates/tests/ciTests.json | 5 +- scripts/tests/chiptest/__init__.py | 1 + src/app/tests/suites/certification/PICS.yaml | 73 + .../suites/certification/Test_TC_ACE_1_6.yaml | 8 +- .../suites/certification/Test_TC_CC_6_1.yaml | 11 + .../suites/certification/Test_TC_CC_6_2.yaml | 11 + .../suites/certification/Test_TC_CC_6_3.yaml | 11 + .../suites/certification/Test_TC_CC_6_5.yaml | 26 + .../Test_TC_CONTENTLAUNCHER_10_3.yaml | 143 +- .../Test_TC_CONTENTLAUNCHER_10_5.yaml | 238 +- .../Test_TC_CONTENTLAUNCHER_10_7.yaml | 576 ++- .../suites/certification/Test_TC_FLW_2_1.yaml | 8 +- .../certification/Test_TC_ICDM_1_1.yaml | 138 + .../certification/Test_TC_ICDM_2_1.yaml | 87 + .../Test_TC_MEDIAPLAYBACK_6_4.yaml | 38 +- .../suites/certification/Test_TC_PRS_2_1.yaml | 12 +- .../suites/certification/Test_TC_RH_2_1.yaml | 8 +- .../suites/certification/Test_TC_SC_4_1.yaml | 1325 ++++- .../certification/Test_TC_TIMESYNC_2_3.yaml | 85 + .../suites/certification/Test_TC_TMP_2_1.yaml | 12 +- .../tests/suites/certification/ci-pics-values | 36 +- src/app/tests/suites/ciTests.json | 9 +- src/app/tests/suites/manualTests.json | 3 - .../chip-tool/zap-generated/test/Commands.h | 4282 +++++++++++++++-- .../zap-generated/test/Commands.h | 2096 +++++++- 25 files changed, 8118 insertions(+), 1124 deletions(-) create mode 100644 src/app/tests/suites/certification/Test_TC_ICDM_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_TIMESYNC_2_3.yaml diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index bf7fcca70ce307..db8f7f38dd88fb 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -1,7 +1,7 @@ { "include": "../../../../src/app/tests/suites/ciTests.json", "disable": [ - "Test_TC_SC_4_2", + "Test_TC_SC_4_1", "Test_TC_SC_5_2", "TestClusterComplexTypes", "TestEvents", @@ -33,8 +33,11 @@ "DL_LockUnlock", "Disabled due to using ICD Management (ICDManagement) cluster, which is provisional on Darwin for now:", "TestIcdManagementCluster", + "Test_TC_ICDM_1_1", + "Test_TC_ICDM_2_1", "Disabled due to using Time Synchronization (TimeSynchronization) cluster, which is provisional on Darwin for now:", "Test_TC_TIMESYNC_1_1", + "Test_TC_TIMESYNC_2_3", "TestTimeSynchronization", "Disabled due to using provisional Ceramic Filter Monitoring (CeramicFilterMonitoring) cluster:", "Test_TC_CFREMON_1_1", diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index b493c4c9d56371..1f824e9e29a2eb 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -134,6 +134,7 @@ def _GetInDevelopmentTests() -> Set[str]: "TestEqualities.yaml", # chip-repl does not support pseudo-cluster commands that return a value "TestExampleCluster.yaml", # chip-repl does not load custom pseudo clusters "Test_TC_TIMESYNC_1_1.yaml", # Time sync SDK is not yet ready + "Test_TC_TIMESYNC_2_3.yaml", # Time sync SDK is not yet ready "TestAttributesById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestCommandsById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestEventsById.yaml", # chip-repl does not support AnyCommands (06/06/2023) diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index c7948d14eb96b3..82d7d55a1ff0ea 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -9463,3 +9463,76 @@ PICS: # - label: "Does the device implement receiving the Step command?" id: FAN.S.C00.Rsp + + #ICD Management + # + # Server Attribute + # + - label: "Does the device implement the IdleModeInterval attribute?" + id: ICDM.S.A0000 + + - label: "Does the device implement the ActiveModeInterval attribute?" + id: ICDM.S.A0001 + + - label: "Does the device implement the ActiveModeThreshold attribute?" + id: ICDM.S.A0002 + + - label: "Does the device implement the RegisteredClients attribute?" + id: ICDM.S.A0003 + + - label: "Does the device implement the IcdCounter attribute?" + id: ICDM.S.A0004 + + - label: + "Does the device implement the ClientsSupportedPerFabric attribute?" + id: ICDM.S.A0005 + + # + # Features + # + - label: "Does the device support this specific cluster feature?" + id: ICDM.S.F00 + + # + #Commands: + # + - label: + "Does the device implement receiving the StayActiveRequest command?" + id: ICDM.S.C03.Rsp + + # + #RVC Clean Mode Select + # + #Feature + - label: + "Does the device support depending on an On/Off cluster implemented on + the same DUT?" + id: RVCCLEANMS.S.F00 + + - label: "Does the device support the extended status feature?" + id: RVCCLEANMS.S.F01 + + - label: + "Does the device implementation deprecate the ChangeToMode command?" + id: RVCCLEANMS.S.F02 + + #Server Attributes + - label: "Does the device implement the StartUpMode attribute?" + id: RVCCLEANMS.S.A0004 + + - label: "Does the device implement the OnMode attribute?" + id: RVCCLEANMS.S.A0005 + + #Server Commands recived + - label: "Does the device implement receiving the ChangeToMode command?" + id: RVCCLEANMS.S.C00.Rsp + + - label: + "Does the device implement receiving the ChangeToModeWithStatus + command?" + id: RVCCLEANMS.S.C01.Rsp + + #server commands generated + - label: + "Does the device implement sending the ChangeToModeResponse command?" + id: RVCCLEANMS.S.C03.Tx diff --git a/src/app/tests/suites/certification/Test_TC_ACE_1_6.yaml b/src/app/tests/suites/certification/Test_TC_ACE_1_6.yaml index d241d40ab6f720..833d95d3750509 100644 --- a/src/app/tests/suites/certification/Test_TC_ACE_1_6.yaml +++ b/src/app/tests/suites/certification/Test_TC_ACE_1_6.yaml @@ -219,10 +219,10 @@ tests: Manage privileges for group 0x0103 and maintain the current administrative privileges for the TH on the Access Control cluster. The following access control list shall be used: List item 1 (TH - admin): Privilege: Administer (5) AuthMode: CASE (2) Subjects: [N1] - Targets: [{Cluster: AccessControl (0x001f), Endpoint: 0}] List item 2 - (group Manage access): Privilege: Manage (4) AuthMode: Group (3) - Subjects: group 0x0103 ([0x0103]) Targets: {Cluster: Groups (0x001d), + admin): Privilege: Administer (5), AuthMode: CASE (2), Subjects: [N1], + Targets: [{Cluster: AccessControl (0x001f), Endpoint: 0}]. List item 2 + (group Manage access): Privilege: Manage (4), AuthMode: Group (3), + Subjects: group 0x0103 ([0x0103]), Targets: {Cluster: Groups (0x0004), Endpoint: PIXIT.G.ENDPOINT}" verification: | ./chip-tool accesscontrol write acl '[{ "privilege": 5, "authMode": 2, "subjects": [112233], "targets": [{ "cluster": 31, "endpoint": 0, "deviceType": null }]},{ "privilege": 4, "authMode": 3, "subjects": [259], "targets": [{ "cluster": 4, "endpoint": 0, "deviceType": null }]}]' 1 0 diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_1.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_1.yaml index d4840d4a7d47d4..0da5eb815e658a 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_1.yaml @@ -23,6 +23,9 @@ config: nodeId: 0x12344321 cluster: "Color Control" endpoint: 1 + ConfigWait: + type: int16u + defaultValue: 5000 tests: - label: "Wait for the commissioned device to be retrieved" @@ -215,6 +218,14 @@ tests: cluster: "On/Off" command: "Off" + - label: "Wait to turn Off light" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: ConfigWait + - label: "Check on/off attribute value is false after off command" cluster: "On/Off" command: "readAttribute" diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml index b4367c0b104d45..6cd718241c1607 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml @@ -22,6 +22,9 @@ config: nodeId: 0x12344321 cluster: "Color Control" endpoint: 1 + ConfigWait: + type: int16u + defaultValue: 5000 tests: - label: "Wait for the commissioned device to be retrieved" @@ -367,6 +370,14 @@ tests: cluster: "On/Off" command: "Off" + - label: "Wait to turn Off light" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: ConfigWait + - label: "Check on/off attribute value is false after off command" cluster: "On/Off" command: "readAttribute" diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml index 64f22a5932f413..967f44230e2714 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml @@ -22,6 +22,9 @@ config: nodeId: 0x12344321 cluster: "Color Control" endpoint: 1 + ConfigWait: + type: int16u + defaultValue: 5000 tests: - label: "Wait for the commissioned device to be retrieved" @@ -289,6 +292,14 @@ tests: cluster: "On/Off" command: "Off" + - label: "Wait to turn Off light" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: ConfigWait + - label: "Check on/off attribute value is false after off command" cluster: "On/Off" command: "readAttribute" diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_5.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_5.yaml index 438cb1312a07c4..951d77b28d7d86 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_5.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_5.yaml @@ -23,6 +23,9 @@ config: nodeId: 0x12344321 cluster: "Color Control" endpoint: 1 + ConfigWait: + type: int16u + defaultValue: 5000 tests: - label: "Wait for the commissioned device to be retrieved" @@ -91,6 +94,8 @@ tests: verification: | ./chip-tool colorcontrol write start-up-color-temperature-mireds 32639 1 1 + Verify DUT responds with a successful (value 0x00) status response On TH(chip-tool) Log and below is the sample log provided for the raspi platform + [1684869285516] [29746:343264] [DMG] WriteResponseMessage = [1684869285516] [29746:343264] [DMG] { [1684869285516] [29746:343264] [DMG] AttributeStatusIBs = @@ -211,3 +216,24 @@ tests: constraints: minValue: 0 maxValue: 3 + + - label: "Turn Off light that we turned on" + PICS: OO.S.C00.Rsp + cluster: "On/Off" + command: "Off" + + - label: "Wait to turn Off light" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: ConfigWait + + - label: "Check on/off attribute value is false after off command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + PICS: OO.S.A0000 + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_3.yaml b/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_3.yaml index 99920cfb23a99c..2932c6c0f0084e 100644 --- a/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_3.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Project CHIP Authors +# 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. @@ -11,47 +11,136 @@ # 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: 3.12.2. [TC-CONTENTLAUNCHER-10.3] Launch Content Verification +name: 19.12.2. [TC-CONTENTLAUNCHER-10.3] Launch Content Verification PICS: - CONTENTLAUNCHER.S config: nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 + cluster: "Content Launcher" + endpoint: 1 + data: + type: char_string + defaultValue: "exampleData" + SearchValue: + type: char_string + defaultValue: "exampleValue" + ExternalIdName: + type: char_string + defaultValue: "name" + ExternalIdValue: + type: char_string + defaultValue: "value" tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + - label: "TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay flag set to false" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 0, "value": "exampleString", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 0, "value": "exampleString", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651062794.114531][157317:157322] CHIP:TOO: LaunchResponse: { - [1651062794.114546][157317:157322] CHIP:TOO: status: 0 - [1651062794.114553][157317:157322] CHIP:TOO: data: exampleData - [1651062794.114560][157317:157322] CHIP:TOO: } - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: false + - name: "Data" + value: data + - name: "Search" + value: + { + ParameterList: + [ + { + Type: 0, + Value: SearchValue, + ExternalIDList: + [ + { + Name: ExternalIdName, + Value: ExternalIdValue, + }, + ], + }, + ], + } + response: + values: + - name: "Data" + value: data + - name: "Status" + value: 0 + + - label: + "Verify that DUT present via its user interface a list of matches + based on the provided search criteria." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT present via its user interface a + list of matches based on the provided search criteria." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay flag set to true" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 0, "value": "exampleString", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 1 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 0, "value": "exampleString", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 1 1 1 - - On TH verify the success response (value 0) received from DUT - [1651062895.695667][157343:157348] CHIP:TOO: LaunchResponse: { - [1651062895.695703][157343:157348] CHIP:TOO: status: 0 - [1651062895.695724][157343:157348] CHIP:TOO: data: exampleData - [1651062895.695746][157343:157348] CHIP:TOO: } - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Data" + value: data + - name: "Search" + value: + { + ParameterList: + [ + { + Type: 0, + Value: SearchValue, + ExternalIDList: + [ + { + Name: ExternalIdName, + Value: ExternalIdValue, + }, + ], + }, + ], + } + response: + values: + - name: "Data" + value: data + - name: "Status" + value: 0 + + - label: + "Verify that DUT should also begin playing content that best matched + the given search criteria" + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT begin playing content that best + matched the given search criteria" + - name: "expectedValue" + value: "y" diff --git a/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_5.yaml b/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_5.yaml index f5d728caa08758..3faa520e477f5f 100644 --- a/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_5.yaml +++ b/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_5.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Project CHIP Authors +# 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. @@ -11,146 +11,166 @@ # 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: 3.12.4. [TC-CONTENTLAUNCHER-10.5] Launch URL Verification +name: 19.12.4. [TC-CONTENTLAUNCHER-10.5] Launch URL Verification PICS: - CONTENTLAUNCHER.S config: nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 + cluster: "Content Launcher" + endpoint: 1 + GoodURL: + type: char_string + defaultValue: "https://csa-iot.org/" + BadURL: + type: char_string + defaultValue: "https://badurl" + UnauthorizedURL: + type: char_string + defaultValue: "https://csa-iot.org/badauth" + DisplayContent: + type: char_string + defaultValue: "exampleData" + providerNameString: + type: char_string + defaultValue: "exampleName" tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + - label: "TH sends a LaunchURL command to the DUT with a known good content URL string" PICS: CONTENTLAUNCHER.S.C01.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-url "exampleUrl" '{"providerName": "exampleName", "background": { "color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 - ./chip-tv-casting-app contentlauncher launch-url "exampleUrl" '{"providerName": "exampleName", "background": { "color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 - - On TH verify the success response (value 0) received from DUT - - [1678789736.472050][327646:327648] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_050A Command=0x0000_0002 - [1678789736.472076][327646:327648] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1678789736.472108][327646:327648] CHIP:TOO: LauncherResponse: { - [1678789736.472137][327646:327648] CHIP:TOO: status: 0 - [1678789736.472147][327646:327648] CHIP:TOO: data: exampleData - [1678789736.472156][327646:327648] CHIP:TOO: } - [1678789736.472184][327646:327648] CHIP:DMG: ICR moving to [AwaitingDe] - - - Example tv-app log file shows receipt of launchurl command: - [1678789736.471351][324821:324821] CHIP:ZCL: ContentLauncherManager::HandleLaunchUrl TEST CASE ContentURL=exampleUrl DisplayString= BrandingInformation.ProviderName=exampleName - disabled: true + command: "LaunchURL" + arguments: + values: + - name: "ContentURL" + value: GoodURL + - name: "BrandingInformation" + value: { ProviderName: providerNameString } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT launched the content at the given URL" + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT launched the content at the given + URL" + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchURL command to the DUT with a known good content URL string and a display string" PICS: CONTENTLAUNCHER.S.C01.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-url "https://csa-iot.org/" '{"providerName": "exampleName", "background": {"color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 --DisplayString "Custom Display String" - ./chip-tv-casting-app contentlauncher launch-url "https://csa-iot.org/" '{"providerName": "exampleName", "background": {"color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 --DisplayString "Custom Display String" + command: "LaunchURL" + arguments: + values: + - name: "ContentURL" + value: GoodURL + - name: "DisplayString" + value: DisplayContent + - name: "BrandingInformation" + value: { ProviderName: providerNameString } + response: + values: + - name: "Data" + value: DisplayContent + - name: "Status" + value: 0 - On TH verify the success response (value 0) received from DUT - [1678789892.544748][327789:327791] CHIP:DMG: }, - [1678789892.544778][327789:327791] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_050A Command=0x0000_0002 - [1678789892.544785][327789:327791] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1678789892.544800][327789:327791] CHIP:TOO: LauncherResponse: { - [1678789892.544806][327789:327791] CHIP:TOO: status: 0 - [1678789892.544809][327789:327791] CHIP:TOO: data: exampleData - [1678789892.544811][327789:327791] CHIP:TOO: } - [1678789892.544816][327789:327791] CHIP:DMG: ICR moving to [AwaitingDe] - [1678789892.544827][327789:327791] CHIP:EM: <<< [E:5462i S:11532 M:235261867 (Ack:223833241)] (S) Msg TX to 1:0000000000000001 [67DC] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1678789892.544831][327789:327791] CHIP:IN: (S) Sending msg 235261867 on secure session with LSID: 11532 - - - - Example tv-app log file shows receipt of launchurl command: - [1678789892.544284][324821:324821] CHIP:ZCL: ContentLauncherManager::HandleLaunchUrl TEST CASE ContentURL=https://csa-iot.org/ DisplayString=Custom Display String BrandingInformation.ProviderName=exampleName - disabled: true + - label: + "Verify that DUT launched the content at the given URL with the given + display string in the application-specific description area" + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT launched the content at the given + URL with the given display string in the + application-specific description area" + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchURL command to the DUT with a known good content URL string and a brand information object." PICS: CONTENTLAUNCHER.S.C01.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-url "https://csa-iot.org/" '{"providerName": "exampleName", "background": {"color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 - ./chip-tv-casting-app contentlauncher launch-url "https://csa-iot.org/" '{"providerName": "exampleName", "background": { "color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 + command: "LaunchURL" + arguments: + values: + - name: "ContentURL" + value: GoodURL + - name: "BrandingInformation" + value: { ProviderName: providerNameString } + response: + values: + - name: "Status" + value: 0 - On TH verify the success response (value 0) received from DUT - [1678789976.395074][327809:327811] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_050A Command=0x0000_0002 - [1678789976.395083][327809:327811] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1678789976.395095][327809:327811] CHIP:TOO: LauncherResponse: { - [1678789976.395106][327809:327811] CHIP:TOO: status: 0 - [1678789976.395109][327809:327811] CHIP:TOO: data: exampleData - [1678789976.395112][327809:327811] CHIP:TOO: } - [1678789976.395120][327809:327811] CHIP:DMG: ICR moving to [AwaitingDe] - - - - Example tv-app log file shows receipt of launchurl command: - [1678789976.394509][324821:324821] CHIP:ZCL: ContentLauncherManager::HandleLaunchUrl TEST CASE ContentURL=https://csa-iot.org/ DisplayString= BrandingInformation.ProviderName=exampleName - disabled: true + - label: + "Verify that DUT launched the content at the given URL with the player + interface updated as per the provided branding information" + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT launched the content at the given + URL with the player interface updated as per the provided + branding information" + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchURL command to the DUT with a known unreachable content URL string." PICS: CONTENTLAUNCHER.S.C01.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-url "https://badurl" '{"providerName": "exampleName", "background": { "color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 - ./chip-tv-casting-app contentlauncher launch-url "https://badurl" '{"providerName": "exampleName", "background": {"color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 - - On TH verify the success response (value 0) received from DUT - [1678790057.261934][327869:327871] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_050A Command=0x0000_0002 - [1678790057.261963][327869:327871] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1678790057.261997][327869:327871] CHIP:TOO: LauncherResponse: { - [1678790057.262025][327869:327871] CHIP:TOO: status: 1 - [1678790057.262035][327869:327871] CHIP:TOO: data: exampleData - [1678790057.262045][327869:327871] CHIP:TOO: } - [1678790057.262072][327869:327871] CHIP:DMG: ICR moving to [AwaitingDe] - [1678790057.262115][327869:327871] CHIP:EM: <<< [E:61104i S:23930 M:82030218 (Ack:133196816)] (S) Msg TX to 1:0000000000000001 [67DC] --- Type 0000:10 (SecureChannel:StandaloneAck) - - Example tv-app log file shows receipt of launchurl command: - [1678790092.751184][324821:324821] CHIP:ZCL: Content Launcher NOT returning ContentApp delegate for endpoint:1 - [1678790092.751199][324821:324821] CHIP:ZCL: ContentLauncherManager::HandleLaunchUrl - [1678790092.751206][324821:324821] CHIP:ZCL: ContentLauncherManager::HandleLaunchUrl TEST CASE ContentURL=https://badurl DisplayString= BrandingInformation.ProviderName=exampleName - [1678790092.751223][324821:324821] CHIP:DMG: Command handler moving to [ Preparing] - disabled: true + command: "LaunchURL" + arguments: + values: + - name: "ContentURL" + value: BadURL + - name: "BrandingInformation" + value: { ProviderName: providerNameString } + response: + values: + - name: "Status" + value: 1 #URL_NOT_AVAILABLE - label: "TH sends a LaunchURL command to the DUT with a known un-authorized content URL string." PICS: CONTENTLAUNCHER.S.C01.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-url "https://csa-iot.org/badauth" '{"providerName": "exampleName", "background": {"color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 - ./chip-tv-casting-app contentlauncher launch-url "https://csa-iot.org/badauth" '{"providerName": "exampleName", "background": { "color": "blue", "size" : {"width": 1.0, "height": 1.0, "metric": 0} }}' 1 1 - - On TH verify the success response (value 0) received from DUT - [1678790163.014868][327910:327912] CHIP:DMG: }, - [1678790163.014878][327910:327912] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_050A Command=0x0000_0002 - [1678790163.014885][327910:327912] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1678790163.014894][327910:327912] CHIP:TOO: LauncherResponse: { - [1678790163.014903][327910:327912] CHIP:TOO: status: 2 - [1678790163.014905][327910:327912] CHIP:TOO: data: exampleData - [1678790163.014908][327910:327912] CHIP:TOO: } - [1678790163.014912][327910:327912] CHIP:DMG: ICR moving to [AwaitingDe] - [1678790163.014926][327910:327912] CHIP:EM: <<< [E:6864i S:36983 M:190033825 (Ack:105150405)] (S) Msg TX to 1:0000000000000001 [67DC] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1678790163.014930][327910:327912] CHIP:IN: (S) Sending msg 190033825 on secure session with LSID: 36983 - - - Example tv-app log file shows receipt of launchurl command: - [1678790163.014705][324821:324821] CHIP:DL: GetContentAppByEndpointId() - endpoint 1 not found - [1678790163.014707][324821:324821] CHIP:ZCL: Content Launcher NOT returning ContentApp delegate for endpoint:1 - [1678790163.014711][324821:324821] CHIP:ZCL: ContentLauncherManager::HandleLaunchUrl - [1678790163.014713][324821:324821] CHIP:ZCL: ContentLauncherManager::HandleLaunchUrl TEST CASE ContentURL=https://csa-iot.org/badauth DisplayString= BrandingInformation.ProviderName=exampleName - [1678790163.014719][324821:324821] CHIP:DMG: Command handler moving to [ Preparing] - disabled: true + command: "LaunchURL" + arguments: + values: + - name: "ContentURL" + value: UnauthorizedURL + - name: "BrandingInformation" + value: { ProviderName: providerNameString } + response: + values: + - name: "Status" + value: 2 #AUTH_FAILED diff --git a/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_7.yaml b/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_7.yaml index 7c4aa59c6f86a6..eff9299eff511f 100644 --- a/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_7.yaml +++ b/src/app/tests/suites/certification/Test_TC_CONTENTLAUNCHER_10_7.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Project CHIP Authors +# 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. @@ -11,303 +11,401 @@ # 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: 3.12.6. [TC-CONTENTLAUNCHER-10.7] Content Search Verification +name: 19.12.6. [TC-CONTENTLAUNCHER-10.7] Content Search Verification PICS: - CONTENTLAUNCHER.S config: nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 + cluster: "Content Launcher" + endpoint: 1 + PopularityName: + type: char_string + defaultValue: "popular content" tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Actor' and Value as An Actors name, for - example, Gaby sHoffman" + consisting of Type As Actor and Value as An Actor’s name, for example, + Gaby sHoffman" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 0, "value": "Gaby sHoffman", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 0, "value": "Gaby sHoffman", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651225059.893636][4190:4195] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651225059.893741][4190:4195] CHIP:TOO: LaunchResponse: { - [1651225059.893814][4190:4195] CHIP:TOO: status: 0 - [1651225059.893869][4190:4195] CHIP:TOO: data: exampleData - [1651225059.893924][4190:4195] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=TV Show Example type=0 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 0, Value: "Gaby sHoffman" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Channel' and Value as Channel Name name, for - example, 'PBS'" + consisting of Type As Channel and Value as Channel Name name, for + example, PBS" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 1, "value": "PBS", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 1, "value": "PBS", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651225141.737648][4203:4209] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651225141.737778][4203:4209] CHIP:TOO: LaunchResponse: { - [1651225141.737854][4203:4209] CHIP:TOO: status: 0 - [1651225141.737936][4203:4209] CHIP:TOO: data: exampleData - [1651225141.737994][4203:4209] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=TV Show Example type=1 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 1, Value: "PBS" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Character' and Value as Characters name,for - example, Snow White" + consisting of Type As Character and Value as Character’s name,for + example,Snow White" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 2, "value": "Snow White", "externalIDList": [ { "name": "foo", "value": "2"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 2, "value": "Snow White", "externalIDList": [ { "name": "foo", "value": "2"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651578539.231066][9699:9704] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578539.231135][9699:9704] CHIP:TOO: LaunchResponse: { - [1651578539.231184][9699:9704] CHIP:TOO: status: 0 - [1651578539.231214][9699:9704] CHIP:TOO: data: exampleData - [1651578539.231247][9699:9704] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=TV Show Example type=2 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: false + - name: "Search" + value: { ParameterList: [{ Type: 2, Value: "Snow White" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Director' and Value as Directors name, for + consisting of Type As Director and Value as Director’s name, for example, Spike Lee" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 3, "value": "Spike Lee", "externalIDList": [ { "name": "Spike Lee", "value": "3"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 3, "value": "Spike Lee", "externalIDList": [ { "name": "Spike Lee", "value": "3"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651578561.129609][9706:9711] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578561.129678][9706:9711] CHIP:TOO: LaunchResponse: { - [1651578561.129725][9706:9711] CHIP:TOO: status: 0 - [1651578561.129760][9706:9711] CHIP:TOO: data: exampleData - [1651578561.129796][9706:9711] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=TV Show Example type=3 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 3, Value: "Spike Lee" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Event' and Value as An Events name , for - example 'Football games'" + consisting of Type As Event and Value as An Event’s name , for example + Football games" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 4, "value": "Football games", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 4, "value": "Football games", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651578612.348295][9717:9722] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578612.348350][9717:9722] CHIP:TOO: LaunchResponse: { - [1651578612.348388][9717:9722] CHIP:TOO: status: 0 - [1651578612.348413][9717:9722] CHIP:TOO: data: exampleData - [1651578612.348437][9717:9722] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236636669] [74577:2229859] CHIP: [ZCL] TEST CASE found match=Sports Example type=4 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 4, Value: "Football games" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Franchise' and Value as Franchises name,for - example 'Star Wars'" + consisting of Type As Franchise and Value as Franchise’s name,for + example Star Wars" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 5, "value": "Star Wars", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 5, "value": "Star Wars", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - - [1651578634.392516][9725:9730] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578634.392581][9725:9730] CHIP:TOO: LaunchResponse: { - [1651578634.392629][9725:9730] CHIP:TOO: status: 0 - [1651578634.392662][9725:9730] CHIP:TOO: data: exampleData - [1651578634.392694][9725:9730] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=TV Show Example type=5 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 5, Value: "Star Wars" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Genre' and Value as Genres name, for example - 'Horror'" + consisting of Type As Genre and Value as Genre’s name, for example + Horror" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 6, "value": "Horror", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 6, "value": "Horror", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1652091775.613303][9916:9922] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_050A Command=0x0000_0002 - [1652091775.613395][9916:9922] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1652091775.613490][9916:9922] CHIP:TOO: LaunchResponse: { - [1652091775.613578][9916:9922] CHIP:TOO: status: 0 - [1652091775.613620][9916:9922] CHIP:TOO: data: exampleData - [1652091775.613661][9916:9922] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=TV Show Example type=6 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 6, Value: "Horror" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'League' and Value as Leagues name, for example - 'NCAA'" + consisting of Type As League and Value as League’s name, for example + NCAA" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 7, "value": "NCAA", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 7, "value": "NCAA", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - - [1651578662.336318][9733:9738] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578662.336370][9733:9738] CHIP:TOO: LaunchResponse: { - [1651578662.336479][9733:9738] CHIP:TOO: status: 0 - [1651578662.336505][9733:9738] CHIP:TOO: data: exampleData - [1651578662.336526][9733:9738] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236636669] [74577:2229859] CHIP: [ZCL] TEST CASE found match=Sports Example type=7 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 7, Value: "NCAA" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Popularity' and Value as Popularitys name" + consisting of Type As Popularity and Value as Popularity’s name" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 8, "value": "Popularity", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 8, "value": "Popularity", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651578680.236952][9740:9745] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578680.237036][9740:9745] CHIP:TOO: LaunchResponse: { - [1651578680.237093][9740:9745] CHIP:TOO: status: 0 - [1651578680.237135][9740:9745] CHIP:TOO: data: exampleData - [1651578680.237176][9740:9745] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=TV Show Example type=8 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 8, Value: PopularityName }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Provider' and Value as Providers name, for - example 'Netflix'" + consisting of Type As Provider and Value as Provider’s name, for + example Netflix" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 9, "value": "Netflix", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 9, "value": "Netflix", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651578697.912544][9750:9755] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578697.912620][9750:9755] CHIP:TOO: LaunchResponse: { - [1651578697.912673][9750:9755] CHIP:TOO: status: 0 - [1651578697.912715][9750:9755] CHIP:TOO: data: exampleData - [1651578697.912753][9750:9755] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=TV Show Example type=9 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 9, Value: "Netflix" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Sport' and Value as Sports name, for example, + consisting of Type As Sport and Value as Sport’s name, for example, football" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 10, "value": "football", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 10, "value": "football", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651578716.145536][9757:9762] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578716.145622][9757:9762] CHIP:TOO: LaunchResponse: { - [1651578716.145682][9757:9762] CHIP:TOO: status: 0 - [1651578716.145725][9757:9762] CHIP:TOO: data: exampleData - [1651578716.145767][9757:9762] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236636669] [74577:2229859] CHIP: [ZCL] TEST CASE found match=Sports Example type=10 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 10, Value: "football" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'SportsTeam' and Value as SportTeams name , for - example 'Arsenel'" + consisting of Type As SportsTeam and Value as SportTeam’s name , for + example Arsenel" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 11, "value": "Arsenel", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 11, "value": "Arsenel", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651578735.341387][9764:9769] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578735.341498][9764:9769] CHIP:TOO: LaunchResponse: { - [1651578735.341574][9764:9769] CHIP:TOO: status: 0 - [1651578735.341630][9764:9769] CHIP:TOO: data: exampleData - [1651578735.341686][9764:9769] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236636669] [74577:2229859] CHIP: [ZCL] TEST CASE found match=Sports Example type=11 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 11, Value: "Arsenel" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" - label: "TH sends a LaunchContent command to the DUT with search parameter - consisting of Type As 'Type' and Value as Types name, for example - 'TVSeries'" + consisting of Type As Type and Value as Type’s name, for example + TVSeries" PICS: CONTENTLAUNCHER.S.C00.Rsp - verification: | - The TH commands for this test step can be invoked using chip-tool (when DUT is a commissionee) or tv-casting-app (when DUT is a commissioner): - ./chip-tool contentlauncher launch-content '{"parameterList": [ { "type": 12, "value": "TVSeries", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - ./chip-tv-casting-app contentlauncher launch-content '{"parameterList": [ { "type": 12, "value": "TVSeries", "externalIDList": [ { "name": "exampleName", "value": "exampleValue"} ] } ] }' 0 1 1 - - On TH verify the success response (value 0) received from DUT - [1651578755.904379][9773:9778] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_050A Command 0x0000_0002 - [1651578755.904459][9773:9778] CHIP:TOO: LaunchResponse: { - [1651578755.904517][9773:9778] CHIP:TOO: status: 0 - [1651578755.904560][9773:9778] CHIP:TOO: data: exampleData - [1651578755.904604][9773:9778] CHIP:TOO: } - - tv-app DUT shows matches via console: - - [1653236823721] [74577:2234439] CHIP: [ZCL] TEST CASE found match=Sports Example type=12 - disabled: true + command: "LaunchContent" + arguments: + values: + - name: "AutoPlay" + value: true + - name: "Search" + value: { ParameterList: [{ Type: 12, Value: "TVSeries" }] } + response: + values: + - name: "Status" + value: 0 + + - label: "Verify that DUT should play or display the search result." + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp + arguments: + values: + - name: "message" + value: + "Please enter 'y' if DUT play or display the search result." + - name: "expectedValue" + value: "y" diff --git a/src/app/tests/suites/certification/Test_TC_FLW_2_1.yaml b/src/app/tests/suites/certification/Test_TC_FLW_2_1.yaml index dce6dbb1058c22..51dbc0c5c4d011 100644 --- a/src/app/tests/suites/certification/Test_TC_FLW_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_FLW_2_1.yaml @@ -36,6 +36,7 @@ tests: command: "readAttribute" attribute: "MinMeasuredValue" response: + saveAs: MinMeasuredVariable constraints: type: int16u minValue: 0 @@ -46,9 +47,10 @@ tests: command: "readAttribute" attribute: "MaxMeasuredValue" response: + saveAs: MaxMeasuredVariable constraints: type: int16u - minValue: 0 + minValue: MinMeasuredVariable maxValue: 65534 - label: "Read the mandatory attribute: MeasuredValue" @@ -58,8 +60,8 @@ tests: response: constraints: type: int16u - minValue: 0 - maxValue: 65535 + minValue: MinMeasuredVariable + maxValue: MaxMeasuredVariable - label: "TH reads from the DUT the Tolerance attribute" PICS: FLW.S.A0003 diff --git a/src/app/tests/suites/certification/Test_TC_ICDM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ICDM_1_1.yaml new file mode 100644 index 00000000000000..aac4c654209f18 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ICDM_1_1.yaml @@ -0,0 +1,138 @@ +# 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: 312.1.1. [TC-ICDM-1.1] Global attributes with DUT as Server + +PICS: + - ICDM.S + +config: + nodeId: 0x12344321 + cluster: "ICD Management" + endpoint: 0 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + PICS: ICDM.S.F00 + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 1 + constraints: + type: bitmap32 + + - label: "Read the global attribute: FeatureMap" + PICS: " !ICDM.S.F00 " + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 0 + constraints: + type: bitmap32 + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1, 2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute(RegisteredClients) in AttributeList" + PICS: ICDM.S.A0003 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the optional attribute(IcdCounter) in AttributeList" + PICS: ICDM.S.A0004 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [4] + + - label: + "Read the optional attribute(ClientsSupportedPerFabric) in + AttributeList" + PICS: ICDM.S.A0005 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [5] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0, 2] + + - label: "Read the optional command (StayActiveRequest) in AttributeList" + PICS: ICDM.S.C03.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: GeneratedCommandList" + PICS: " !ICDM.S.F00 " + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + PICS: ICDM.S.F00 + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + constraints: + type: list + contains: [1] diff --git a/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml b/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml new file mode 100644 index 00000000000000..00e9d687346425 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml @@ -0,0 +1,87 @@ +# 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: 312.2.1. [TC-ICDM-2.1] Attributes with DUT as Server + +PICS: + - ICDM.S + +config: + nodeId: 0x12344321 + cluster: "ICD Management" + endpoint: 0 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the IdleModeInterval attribute" + PICS: ICDM.S.A0000 + command: "readAttribute" + attribute: "IdleModeInterval" + response: + saveAs: IdleModeIntervalValue + constraints: + type: int32u + minValue: 500 + maxValue: 64800000 + + - label: "TH reads from the DUT the ActiveModeInterval attribute" + PICS: ICDM.S.A0001 + command: "readAttribute" + attribute: "ActiveModeInterval" + response: + constraints: + type: int32u + minValue: 300 + maxValue: IdleModeIntervalValue + + - label: "TH reads from the DUT the ActiveModeThreshold attribute" + PICS: ICDM.S.A0002 + command: "readAttribute" + attribute: "ActiveModeThreshold" + response: + constraints: + type: int16u + minValue: 300 + + - label: "TH reads from the DUT the RegisteredClients attribute" + PICS: ICDM.S.A0003 + command: "readAttribute" + attribute: "RegisteredClients" + response: + constraints: + type: list + + - label: "TH reads from the DUT the IcdCounter attribute" + PICS: ICDM.S.A0004 + command: "readAttribute" + attribute: "ICDCounter" + response: + constraints: + type: int32u + + - label: "TH reads from the DUT the ClientsSupportedPerFabric attribute" + PICS: ICDM.S.A0005 + command: "readAttribute" + attribute: "ClientsSupportedPerFabric" + response: + constraints: + type: int16u + minValue: 1 diff --git a/src/app/tests/suites/certification/Test_TC_MEDIAPLAYBACK_6_4.yaml b/src/app/tests/suites/certification/Test_TC_MEDIAPLAYBACK_6_4.yaml index 17ba4d8cbb7334..f28781ceaa9025 100644 --- a/src/app/tests/suites/certification/Test_TC_MEDIAPLAYBACK_6_4.yaml +++ b/src/app/tests/suites/certification/Test_TC_MEDIAPLAYBACK_6_4.yaml @@ -142,20 +142,11 @@ tests: #Issue 19800 - label: "Reads the PlaybackSpeed attribute from the DUT" - verification: | - ./chip-tool mediaplayback read playback-speed 1 3 - [1655114487.018204][41855:41860] CHIP:TOO: Endpoint: 3 Cluster: 0x0000_0506 Attribute 0x0000_0004 DataVersion: 4174921750 - [1655114487.018302][41855:41860] CHIP:TOO: PlaybackSpeed: -1.000000 - [1655114487.018421][41855:41860] CHIP:EM: Sending Standalone Ack for MessageCounter:163883813 on exchange 24959 - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp - arguments: - values: - - name: "message" - value: "Please enter 'y' if PlaybackSpeed value is -1" - - name: "expectedValue" - value: "y" + PICS: MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp + command: "readAttribute" + attribute: "PlaybackSpeed" + response: + value: -1 - label: "Sends a Rewind command to the DUT" PICS: MEDIAPLAYBACK.S.C06.Rsp @@ -182,20 +173,11 @@ tests: #Issue 19800 - label: "Reads the PlaybackSpeed attribute from the DUT" - verification: | - ./chip-tool mediaplayback read playback-speed 1 3 - [1655114711.400529][41871:41876] CHIP:TOO: Endpoint: 3 Cluster: 0x0000_0506 Attribute 0x0000_0004 DataVersion: 4174921750 - [1655114711.400683][41871:41876] CHIP:TOO: PlaybackSpeed: -2.000000 - [1655114711.400853][41871:41876] CHIP:EM: Sending Standalone Ack for MessageCounter:17386470 on exchange 38376 - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp - arguments: - values: - - name: "message" - value: "Please enter 'y' if PlaybackSpeed value is -2" - - name: "expectedValue" - value: "y" + PICS: MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp + command: "readAttribute" + attribute: "PlaybackSpeed" + response: + value: -2 - label: "Sends a Play command" PICS: MEDIAPLAYBACK.S.C00.Rsp diff --git a/src/app/tests/suites/certification/Test_TC_PRS_2_1.yaml b/src/app/tests/suites/certification/Test_TC_PRS_2_1.yaml index 3bc25e6fae7f58..cf302ecf0a9b99 100644 --- a/src/app/tests/suites/certification/Test_TC_PRS_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_PRS_2_1.yaml @@ -39,8 +39,8 @@ tests: saveAs: MinMeasuredValue constraints: type: int16s - minValue: -32768 - maxValue: 32767 + minValue: -32767 + maxValue: 32766 - label: "Read the mandatory attribute constraints: MaxMeasuredValue" PICS: PRS.S.A0002 @@ -50,7 +50,7 @@ tests: saveAs: MaxMeasuredValue constraints: type: int16s - minValue: -32768 + minValue: MinMeasuredValue maxValue: 32767 - label: "Read the mandatory attribute constraints: MeasuredValue" @@ -81,8 +81,8 @@ tests: saveAs: MinScaledValue constraints: type: int16s - minValue: -32768 - maxValue: 32767 + minValue: -32767 + maxValue: 32766 - label: "Read the optional attribute: MaxScaledValue" PICS: PRS.S.A0012 @@ -92,7 +92,7 @@ tests: saveAs: MaxScaledValue constraints: type: int16s - minValue: -32768 + minValue: MinScaledValue maxValue: 32767 - label: "Read the optional attribute: ScaledValue" diff --git a/src/app/tests/suites/certification/Test_TC_RH_2_1.yaml b/src/app/tests/suites/certification/Test_TC_RH_2_1.yaml index 44504a58830017..eaa7c15e80663f 100644 --- a/src/app/tests/suites/certification/Test_TC_RH_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_RH_2_1.yaml @@ -36,6 +36,7 @@ tests: command: "readAttribute" attribute: "MinMeasuredValue" response: + saveAs: CurrentMinMeasured constraints: type: int16u minValue: 0 @@ -46,9 +47,10 @@ tests: command: "readAttribute" attribute: "MaxMeasuredValue" response: + saveAs: CurrentMaxMeasured constraints: type: int16u - minValue: 1 + minValue: CurrentMinMeasured maxValue: 10000 - label: "TH reads the MeasuredValue attribute from the DUT" @@ -58,8 +60,8 @@ tests: response: constraints: type: int16u - minValue: 0 - maxValue: 10000 + minValue: CurrentMinMeasured + maxValue: CurrentMaxMeasured - label: "TH reads the Tolerance attribute from the DUT" PICS: RH.S.A0003 diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_1.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_1.yaml index bd04f242522dc4..7ae1cdacc5f419 100644 --- a/src/app/tests/suites/certification/Test_TC_SC_4_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_SC_4_1.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Project CHIP Authors +# 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. @@ -13,69 +13,81 @@ # 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: 15.4.1. [TC-SC-4.1] Commissionable Node Discovery [DUT as Commissionee] +name: 22.4.1. [TC-SC-4.1] Commissionable Node Discovery [DUT as Commissionee] PICS: - MCORE.ROLE.COMMISSIONEE config: nodeId: 0x12344321 - cluster: "Basic Information" endpoint: 0 + discriminator: + type: int16u + defaultValue: 3840 + shortDiscriminator: + type: int16u + defaultValue: 15 + vendorId: + type: int16u + defaultValue: 65521 + productId: + type: int16u + defaultValue: 32769 + deviceType: + type: int16u + defaultValue: 65535 + PakeVerifier: + type: octet_string + defaultValue: "hex:b96170aae803346884724fe9a3b287c30330c2a660375d17bb205a8cf1aecb350457f8ab79ee253ab6a8e46bb09e543ae422736de501e3db37d441fe344920d09548e4c18240630c4ff4913c53513839b7c07fcc0627a1b8573a149fcd1fa466cf" + timeout: 900 + waitAfterCommissioning: + type: int16u + defaultValue: 5000 tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + - label: - "DUT is Commissioned and put in Commissioning Mode using Open Basic - Commissioning Window command and starts advertising Commissionable - Node Discovery service using DNS-SD" - PICS: CADMIN.S.C01.Rsp - verification: | - ./chip-tool administratorcommissioning open-basic-commissioning-window 200 1 0 --timedInteractionTimeoutMs 1000 - - verify success on TH (Chip-tool) Logs: - - [1652340903.034346][2874:2879] CHIP:DMG: InvokeResponseMessage = - [1652340903.034398][2874:2879] CHIP:DMG: { - [1652340903.034447][2874:2879] CHIP:DMG: suppressResponse = false, - [1652340903.034499][2874:2879] CHIP:DMG: InvokeResponseIBs = - [1652340903.034565][2874:2879] CHIP:DMG: [ - [1652340903.034615][2874:2879] CHIP:DMG: InvokeResponseIB = - [1652340903.034748][2874:2879] CHIP:DMG: { - [1652340903.034806][2874:2879] CHIP:DMG: CommandStatusIB = - [1652340903.034873][2874:2879] CHIP:DMG: { - [1652340903.034936][2874:2879] CHIP:DMG: CommandPathIB = - [1652340903.035006][2874:2879] CHIP:DMG: { - [1652340903.035078][2874:2879] CHIP:DMG: EndpointId = 0x0, - [1652340903.035159][2874:2879] CHIP:DMG: ClusterId = 0x3c, - [1652340903.035223][2874:2879] CHIP:DMG: CommandId = 0x1, - [1652340903.035291][2874:2879] CHIP:DMG: }, - [1652340903.035362][2874:2879] CHIP:DMG: - [1652340903.035423][2874:2879] CHIP:DMG: StatusIB = - [1652340903.035495][2874:2879] CHIP:DMG: { - [1652340903.035566][2874:2879] CHIP:DMG: status = 0x00 (SUCCESS), - [1652340903.035634][2874:2879] CHIP:DMG: }, - [1652340903.035704][2874:2879] CHIP:DMG: - [1652340903.035763][2874:2879] CHIP:DMG: }, - [1652340903.035841][2874:2879] CHIP:DMG: - [1652340903.035898][2874:2879] CHIP:DMG: }, - [1652340903.035965][2874:2879] CHIP:DMG: - [1652340903.036014][2874:2879] CHIP:DMG: ], - [1652340903.036077][2874:2879] CHIP:DMG: - [1652340903.036126][2874:2879] CHIP:DMG: InteractionModelRevision = 1 - [1652340903.036175][2874:2879] CHIP:DMG: }, - [1652340903.036294][2874:2879] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003C Command=0x0000_0001 Status=0x0 - [1652340903.036375][2874:2879] CHIP:DMG: ICR moving to [AwaitingDe] - - The delay timer is given 200 as an example , use whatever works for your product - disabled: true - - - label: "Check DNS-SD subtypes used by DUT" - PICS: - " MCORE.COM.WIFI && MCORE.COM.ETH && MCORE.COM.THR && - MCORE.SC.VENDOR_SUBTYPE && MCORE.SC.DEVTYPE_SUBTYPE && MCORE.SC.VP_KEY - && MCORE.SC.SII_OP_DISCOVERY_KEY && MCORE.SC.SAI_OP_DISCOVERY_KEY && - MCORE.SC.DT_KEY && MCORE.SC.DN_KEY && MCORE.SC.RI_KEY && - MCORE.SC.PH_KEY && MCORE.SC.PI_KEY " + "DUT is put in Commissioning Mode using Open Basic Commissioning + Window command " + cluster: "Administrator Commissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 180 + + - label: "Waiting after opening commissioning window" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: waitAfterCommissioning + + - label: + "Check DNS-SD instance name must be 64-bit randomly selected ID + expressed as a sixteen-char hex string with capital letters" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "instanceName" + saveAs: deviceInstanceNameBeforeReboot + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + + - label: "Service type must be _matterc._udp" verification: | Run the below commands within the mentioned time interval used in open-commissioning-window in step-1. Run the below avahi browse command in the TH terminal @@ -91,17 +103,15 @@ tests: + wlan0 IPv6 5A4E867284D08B13 _matterc._udp local + eth0 IPv6 5A4E867284D08B13 _matterc._udp local = eth0 IPv6 5A4E867284D08B13 _matterc._udp local - hostname = [E45F010F1A010000.local] - address = [fe80::e65f:1ff:fe0f:1a01] - port = [5540] - txt = ["PI=" "PH=36" "CM=1" "D=3840" "T=1" "VP=65521+32769"] + hostname = [E45F010F1A010000.local] + address = [fe80::e65f:1ff:fe0f:1a01] + port = [5540] + txt = ["PI=" "PH=36" "CM=1" "D=3840" "T=1" "VP=65521+32769"] = wlan0 IPv6 5A4E867284D08B13 _matterc._udp local - hostname = [E45F010F1A010000.local] - address = [fe80::e65f:1ff:fe0f:1a01] - port = [5540] - txt = ["PI=" "PH=36" "CM=1" "D=3840" "T=1" "VP=65521+32769"] - - + hostname = [E45F010F1A010000.local] + address = [fe80::e65f:1ff:fe0f:1a01] + port = [5540] + txt = ["PI=" "PH=36" "CM=1" "D=3840" "T=1" "VP=65521+32769"] If we use Thread setup, then the Service Domain will be 422F10CDC290A406.local @@ -114,85 +124,323 @@ tests: +;eth0;IPv6;_S15;_sub._matterc._udp;local +;eth0;IPv6;_L3840;_sub._matterc._udp;local +;eth0;IPv6;_CM;_sub._matterc._udp;local - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_SKIP_SAMPLE_APP + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + #validate the service type and the service domain not implemented in CI - label: - "DUT is rebooted, then put in Commissioning Mode using Open Basic - Commissioning Window command, starting advertising Commissionable Node - Discovery service using DNS-SD" - PICS: CADMIN.S.C01.Rsp + "Check target hostname is derived from the 48bit or 64bit MAC address + expressed as a twelve or sixteen capital letter hex string" + PICS: "( MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 16 + isUpperCase: true + isHexString: true + + - label: + "Check target hostname is derived from the 48bit or 64bit MAC address + expressed as a twelve or sixteen capital letter hex string" + PICS: "(!MCORE.COM.WIFI && !MCORE.COM.WIFI) && MCORE.COM.THR" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 16 + isUpperCase: true + isHexString: true + + #subtype + - label: "Check Long Discriminator _L" + cluster: "DiscoveryCommands" + command: "FindCommissionableByLongDiscriminator" + arguments: + values: + - name: "value" + value: discriminator + + - label: "Check Short Discriminator (_S)" + cluster: "DiscoveryCommands" + command: "FindCommissionableByShortDiscriminator" + arguments: + values: + - name: "value" + value: shortDiscriminator + + - label: + "If (MCORE.SC.VENDOR_SUBTYPE) present, subtype _V is present + must be 16-bit vendor id, encoded as a variable-length decimal number + in ASCII text, omitting any leading zeros" + PICS: MCORE.SC.VENDOR_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByVendorId" + arguments: + values: + - name: "value" + value: vendorId + + - label: + "if (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, + represents device type from Data Model and must be represented + as a variable length decimal number in ASCII without leading zeros" + PICS: MCORE.SC.DEVTYPE_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByDeviceType" + arguments: + values: + - name: "value" + value: deviceType + + - label: "Check Commissioning Mode (_CM) subtype _CM must be present" + cluster: "DiscoveryCommands" + command: "FindCommissionableByCommissioningMode" + + - label: + "key D must be present and represents the discriminator which must be + encoded as a variable-length decimal value with up to 4 digits + omitting any leading zeros" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "longDiscriminator" + value: discriminator + constraints: + minValue: 0 + maxValue: 4096 + + - label: + "If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID + is present" + PICS: MCORE.SC.VP_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "vendorId" + value: vendorId + + - label: + "If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID + is present" + PICS: MCORE.SC.VP_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "productId" + value: productId + + - label: + "If (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key must be an + unsigned integer with units of milliseconds and shall be encoded as a + variable length decimal number in ASCII, omitting leading zeros. Shall + not exceed 3600000" + PICS: MCORE.SC.SII_OP_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalIdle" + constraints: + maxValue: 3600000 + + - label: + "If (MCORE.SC.SAI_OP_DISCOVERY_KEY ) present, SAI key must be an + unsigned integer with units of milliseconds and shall be encoded as a + variable length decimal number in ASCII, omitting leading zeros. Shall + not exceed 3600000." + PICS: MCORE.SC.SAI_OP_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalActive" + constraints: + maxValue: 3600000 + + - label: "TXT key for commissioning mode (CM) CM=1 must be present" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "commissioningMode" + value: 1 + + - label: + "If (MCORE.SC.DT_KEY) present, DT key must contain the device type + identifier from Data Model Device Types and must be encoded as a + variable length decimal ASCII number without leading zeros" + PICS: MCORE.SC.DT_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceType" + value: deviceType + + - label: + "If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string + with a maximum length of 32B" + PICS: MCORE.SC.DN_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceName" + constraints: + maxLength: 32 + + - label: + "If (MCORE.SC.RI_KEY ) present, key RI must include the Rotating + Device Identifier encoded as a uppercase string with a maximum length + of 100 chars" + PICS: MCORE.SC.RI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "rotatingIdLen" + constraints: + maxValue: 100 + + - label: + "If (MCORE.SC.PH_KEY) present, key PH must be encoded as a + variable-length decimal number in ASCII text, omitting any leading + zeros. If present value must be different of 0" + PICS: MCORE.SC.PH_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingHint" + constraints: + notValue: 0 + + - label: + "If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 + string with a maximum length of 128 bytes" + PICS: MCORE.SC.PI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingInstruction" + constraints: + maxLength: 128 + + - label: + "DUT must publish AAAA records for each IPv6 address upon which they + are willing to accept Matter messages." + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "numIPs" + constraints: + minValue: 1 + + ### DUT TurnOff + - label: "Reboot/restart the DUT" + PICS: PICS_SDK_CI_ONLY + cluster: "SystemCommands" + endpoint: 0 + command: "Reboot" + + - label: "Reboot target device(DUT)" verification: | - Reboot the device and commission the DUT again. Open the commissioning window using the below command in the TH (Chip-tool) terminal + Did the DUT successfully reboot? + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_SKIP_SAMPLE_APP + arguments: + values: + - name: "message" + value: "Please reboot the DUT and enter 'y' after DUT starts" + - name: "expectedValue" + value: "y" - ./chip-tool administratorcommissioning open-basic-commissioning-window 200 1 0 --timedInteractionTimeoutMs 1000 + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId - verify success on TH (Chip-tool) logs: + - label: + "DUT put in Commissioning Mode using Open Basic Commissioning Window + command, starting advertising Commissionable Node Discovery service + using DNS-SD" + PICS: CADMIN.S.C01.Rsp + cluster: "Administrator Commissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 180 - [1652341174.803430][2893:2898] CHIP:DMG: InvokeResponseMessage = - [1652341174.803488][2893:2898] CHIP:DMG: { - [1652341174.803560][2893:2898] CHIP:DMG: suppressResponse = false, - [1652341174.803622][2893:2898] CHIP:DMG: InvokeResponseIBs = - [1652341174.803698][2893:2898] CHIP:DMG: [ - [1652341174.803757][2893:2898] CHIP:DMG: InvokeResponseIB = - [1652341174.803835][2893:2898] CHIP:DMG: { - [1652341174.803897][2893:2898] CHIP:DMG: CommandStatusIB = - [1652341174.803975][2893:2898] CHIP:DMG: { - [1652341174.804047][2893:2898] CHIP:DMG: CommandPathIB = - [1652341174.804128][2893:2898] CHIP:DMG: { - [1652341174.804213][2893:2898] CHIP:DMG: EndpointId = 0x0, - [1652341174.804292][2893:2898] CHIP:DMG: ClusterId = 0x3c, - [1652341174.804377][2893:2898] CHIP:DMG: CommandId = 0x1, - [1652341174.804450][2893:2898] CHIP:DMG: }, - [1652341174.804539][2893:2898] CHIP:DMG: - [1652341174.804654][2893:2898] CHIP:DMG: StatusIB = - [1652341174.804738][2893:2898] CHIP:DMG: { - [1652341174.804821][2893:2898] CHIP:DMG: status = 0x00 (SUCCESS), - [1652341174.804911][2893:2898] CHIP:DMG: }, - [1652341174.804993][2893:2898] CHIP:DMG: - [1652341174.805067][2893:2898] CHIP:DMG: }, - [1652341174.805152][2893:2898] CHIP:DMG: - [1652341174.805220][2893:2898] CHIP:DMG: }, - [1652341174.805307][2893:2898] CHIP:DMG: - [1652341174.805365][2893:2898] CHIP:DMG: ], - [1652341174.805439][2893:2898] CHIP:DMG: - [1652341174.805497][2893:2898] CHIP:DMG: InteractionModelRevision = 1 - [1652341174.805555][2893:2898] CHIP:DMG: }, - [1652341174.805690][2893:2898] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003C Command=0x0000_0001 Status=0x0 - [1652341174.805786][2893:2898] CHIP:DMG: ICR moving to [AwaitingDe] - - The delay timer is given 200 as an example , use whatever works for your product - disabled: true - - - label: "Check DNS-SD subtypes used by DUT" - PICS: - " MCORE.COM.WIFI && MCORE.COM.ETH && MCORE.COM.THR && - MCORE.SC.VENDOR_SUBTYPE && MCORE.SC.DEVTYPE_SUBTYPE && MCORE.SC.VP_KEY - && MCORE.SC.SII_OP_DISCOVERY_KEY && MCORE.SC.SAI_OP_DISCOVERY_KEY && - MCORE.SC.DT_KEY && MCORE.SC.DN_KEY && MCORE.SC.RI_KEY && - MCORE.SC.PH_KEY && MCORE.SC.PI_KEY " + - label: "Waiting after opening commissioning window" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: waitAfterCommissioning + + - label: + "Check DNS-SD instance name must be 64-bit randomly selected ID + expressed as a sixteen-char hex string with capital letters and must + be different from the one at step 2" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "instanceName" + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + notValue: deviceInstanceNameBeforeReboot + + - label: "service type must be _matterc._udp" verification: | Run the below avahi browse command in TH terminal - avahi-browse -rt _matterc._udp + avahi-browse -rt _matterc._udp - Verify on the below output in TH terminal Log: + Verify the device is advertising _matterc._udp service like below output in TH terminal Log: (Verify for the DUT's actual values (like vendor ID, PID ..etc) as mentioned in the expected outcome of the test plan, The below log contains the data from the reference raspi accessory) + wlan0 IPv6 F6385CBB29F7CE93 _matterc._udp local + eth0 IPv6 F6385CBB29F7CE93 _matterc._udp local = eth0 IPv6 F6385CBB29F7CE93 _matterc._udp local - hostname = [E45F010F1A010000.local] - address = [fe80::e65f:1ff:fe0f:1a01] - port = [5540] - txt = ["PI=" "PH=36" "CM=1" "D=3840" "T=1" "VP=65521+32769"] + hostname = [E45F010F1A010000.local] + address = [fe80::e65f:1ff:fe0f:1a01] + port = [5540] + txt = ["PI=" "PH=36" "CM=1" "D=3840" "T=1" "VP=65521+32769"] = wlan0 IPv6 F6385CBB29F7CE93 _matterc._udp local - hostname = [E45F010F1A010000.local] - address = [fe80::e65f:1ff:fe0f:1a01] - port = [5540] - txt = ["PI=" "PH=36" "CM=1" "D=3840" "T=1" "VP=65521+32769"] - - - - + hostname = [E45F010F1A010000.local] + address = [fe80::e65f:1ff:fe0f:1a01] + port = [5540] + txt = ["PI=" "PH=36" "CM=1" "D=3840" "T=1" "VP=65521+32769"] Service Domain 422F10CDC290A406.local @@ -205,17 +453,271 @@ tests: +;eth0;IPv6;_S15;_sub._matterc._udp;local +;eth0;IPv6;_L3840;_sub._matterc._udp;local +;eth0;IPv6;_CM;_sub._matterc._udp;local - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_SKIP_SAMPLE_APP + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" - - label: "Wait for OBCW timeout to expire" - verification: | - Wait until open-basic-commissioning-window time to expire. - disabled: true + #validate the service type and the service domain not implemented in CI + - label: + "Check Hostname. If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target + hostname is derived from the 48bit or 64bit MAC address expressed as a + twelve or sixteen capital letter hex string" + PICS: "(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 16 + isUpperCase: true + isHexString: true + + - label: + "Check Hostname. If (MCORE.COM.THR) target hostname is derived from + the 48bit or 64bit MAC address expressed as a twelve or sixteen + capital letter hex string" + PICS: "(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 16 + isUpperCase: true + isHexString: true + + - label: "Check Long Discriminator _L" + cluster: "DiscoveryCommands" + command: "FindCommissionableByLongDiscriminator" + arguments: + values: + - name: "value" + value: discriminator + + - label: "Check Short Discriminator (_S)" + cluster: "DiscoveryCommands" + command: "FindCommissionableByShortDiscriminator" + arguments: + values: + - name: "value" + value: shortDiscriminator + + - label: + "If (MCORE.SC.VENDOR_SUBTYPE ) present, subtype _V is present + must be 16-bit vendor id, encoded as a variable-length decimal number + in ASCII text, omitting any leading zeros" + PICS: MCORE.SC.VENDOR_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByVendorId" + arguments: + values: + - name: "value" + value: vendorId + + - label: + "If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, + represents device type from Data Model and must be represented + as a variable length decimal number in ASCII without leading zeros" + # The device type is not broadcasted by the accessory under CI. + PICS: MCORE.SC.DEVTYPE_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByDeviceType" + arguments: + values: + - name: "value" + value: deviceType + + - label: "Check Commissioning Mode (_CM) subtype _CM is present" + cluster: "DiscoveryCommands" + command: "FindCommissionableByCommissioningMode" + + - label: + "key D must be present and represents the discriminator which must be + encoded as a variable-length decimal value with up to 4 digits + omitting any leading zeros" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "longDiscriminator" + value: discriminator + constraints: + minValue: 0 + maxValue: 4096 + + - label: + "If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID + is present." + PICS: MCORE.SC.VP_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "vendorId" + value: vendorId + + - label: + "If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID + is present." + PICS: MCORE.SC.VP_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "productId" + value: productId + + - label: + "If (MCORE.SC.SII_OP_DISCOVERY_KEY ) present, SII key must be an + unsigned integer with units of milliseconds and shall be encoded as a + variable length decimal number in ASCII, omitting leading zeros. Shall + not exceed 3600000" + PICS: MCORE.SC.SII_OP_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalIdle" + constraints: + maxValue: 3600000 + + - label: + "If (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key must be an + unsigned integer with units of milliseconds and shall be encoded as a + variable length decimal number in ASCII, omitting leading zeros. Shall + not exceed 3600000." + PICS: MCORE.SC.SAI_OP_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalActive" + constraints: + maxValue: 3600000 + + - label: "TXT key for commissioning mode (CM) key CM=1 must be present" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "commissioningMode" + value: 1 + + - label: + "If (MCORE.SC.DT_KEY) present, DT key must contain the device type + identifier from Data Model Device Types and must be encoded as a + variable length decimal ASCII number without leading zeros" + PICS: MCORE.SC.DT_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceType" + value: deviceType + + - label: + "If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string + with a maximum length of 32B" + PICS: MCORE.SC.DN_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceName" + constraints: + maxLength: 32 + + - label: + "If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device + Identifier encoded as a uppercase string with a maximum length of 100 + chars" + PICS: MCORE.SC.RI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "rotatingIdLen" + constraints: + maxValue: 100 + + - label: + "If (MCORE.SC.PH_KEY) present, key PH must be encoded as a + variable-length decimal number in ASCII text, omitting any leading + zeros. If present value must be different of 0" + PICS: MCORE.SC.PH_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingHint" + constraints: + notValue: 0 + - label: + "If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 + string with a maximum length of 128 bytes" + PICS: MCORE.SC.PI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingInstruction" + constraints: + maxLength: 128 + + - label: + "DUT must publish AAAA records for each IPv6 address upon which they + are willing to accept Matter messages." + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "numIPs" + constraints: + minValue: 1 + + - label: "Wait for OpenBasicCommissioningWindow timeout to expire" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 180000 + + - label: + "DUT is Commissioned and instructed to enter in commissioning mode + using Open Commissioning Window command" + cluster: "Administrator Commissioning" + command: "OpenCommissioningWindow" + timedInteractionTimeoutMs: 10000 + PICS: CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY + arguments: + values: + - name: "CommissioningTimeout" + value: 180 + - name: "PAKEPasscodeVerifier" + value: PakeVerifier + - name: "Discriminator" + value: discriminator + - name: "Iterations" + value: 1000 + - name: "Salt" + value: "SPAKE2P Key Salt" + + #Issue https://github.com/project-chip/connectedhomeip/issues/26127 - label: "DUT is Commissioned and instructed to enter in commissioning mode using Open Commissioning Window command" - PICS: CADMIN.S.C00.Rsp verification: | Run the below open-commissioning-window in TH Terminal @@ -254,71 +756,538 @@ tests: [1652341411.385662][2929:2934] CHIP:DMG: }, [1652341411.385794][2929:2934] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003C Command=0x0000_0000 Status=0x0 [1652341411.385860][2929:2934] CHIP:CTL: Successfully opened pairing window on the device - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" - - label: "Check DNS-SD subtypes used by DUT" - PICS: - " MCORE.COM.WIFI && MCORE.COM.ETH && MCORE.COM.THR && - MCORE.SC.VENDOR_SUBTYPE && MCORE.SC.DEVTYPE_SUBTYPE && MCORE.SC.VP_KEY - && MCORE.SC.SII_OP_DISCOVERY_KEY && MCORE.SC.SAI_OP_DISCOVERY_KEY && - MCORE.SC.DT_KEY && MCORE.SC.DN_KEY && MCORE.SC.RI_KEY && - MCORE.SC.PH_KEY && MCORE.SC.PI_KEY " - verification: | - Same verification steps as Step 3, Except Verify CM flag value to be 2 + - label: "Waiting after opening commissioning window" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: waitAfterCommissioning + - label: + "DNS-SD instance name must be 64-bit randomly selected ID expressed as + a sixteen-char hex string with capital letters" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "instanceName" + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true - ubuntu@ubuntu:~$ avahi-browse -rt _matterc._udp + #validate the service type and the service domain not implemented in CI - Verify on the below output in TH terminal Log: + - label: + "Check Hostname.If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target hostname + is derived from the 48bit or 64bit MAC address expressed as a twelve + or sixteen capital letter hex string." + # On macOS the hostname is the device name and because of it this test is disabled for now. + PICS: "(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 16 + isUpperCase: true + isHexString: true + + - label: + "Check Hostname. If (MCORE.COM.THR) target hostname is derived from + the 48bit or 64bit MAC extended address expressed as a twelve or + sixteen capital letter hex string." + # On macOS the hostname is the device name and because of it this test is disabled for now. + PICS: "(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 16 + isUpperCase: true + isHexString: true + - label: "Check Long Discriminator _L" + cluster: "DiscoveryCommands" + command: "FindCommissionableByLongDiscriminator" + arguments: + values: + - name: "value" + value: discriminator + - label: "Check Short Discriminator (_S)" + cluster: "DiscoveryCommands" + command: "FindCommissionableByShortDiscriminator" + arguments: + values: + - name: "value" + value: shortDiscriminator - + wlan0 IPv6 71DED0325CF9AB38 _matterc._udp local - + eth0 IPv6 71DED0325CF9AB38 _matterc._udp local - = eth0 IPv6 71DED0325CF9AB38 _matterc._udp local - hostname = [E45F010F1A010000.local] - address = [fe80::e65f:1ff:fe0f:1a01] - port = [5540] - txt = ["PI=" "PH=36" "CM=2" "D=3840" "T=1" "VP=65521+32769"] - = wlan0 IPv6 71DED0325CF9AB38 _matterc._udp local - hostname = [E45F010F1A010000.local] - address = [fe80::e65f:1ff:fe0f:1a01] - port = [5540] - txt = ["PI=" "PH=36" "CM=2" "D=3840" "T=1" "VP=65521+32769"] - disabled: true + - label: + "If (MCORE.SC.VENDOR_SUBTYPE) present, subtype _V is present + must be 16-bit vendor id, encoded as a variable-length decimal number + in ASCII text, omitting any leading zeros" + PICS: MCORE.SC.VENDOR_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByVendorId" + arguments: + values: + - name: "value" + value: vendorId + + - label: + "If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, + represents device type from Data Model and must be represented + as a variable length decimal number in ASCII without leading zeros" + # The device type is not broadcasted by the accessory under CI. + PICS: MCORE.SC.VENDOR_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByDeviceType" + arguments: + values: + - name: "value" + value: deviceType + + - label: "Check Commissioning Mode (_CM) subtype _CM is present" + cluster: "DiscoveryCommands" + command: "FindCommissionableByCommissioningMode" + + - label: + "If (MCORE.SC.VP_KEY ) present, VP key must contain at least Vendor ID + is present." + PICS: MCORE.SC.VP_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "vendorId" + value: vendorId + + - label: + "If (MCORE.SC.VP_KEY ) present, VP key must contain at least Product + ID is present" + PICS: MCORE.SC.VP_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "productId" + value: productId + + - label: + "Optional TXT key for MRP Retry Interval Idle. if + (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key must be an unsigned + integer with units of milliseconds and shall be encoded as a variable + length decimal number in ASCII, omitting leading zeros. Shall not + exceed 3600000" + PICS: MCORE.SC.SII_OP_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalIdle" + constraints: + maxValue: 3600000 + + - label: + "Optional TXT key for MRP Retry Interval Active. if + (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key must be an unsigned + integer with units of milliseconds and shall be encoded as a variable + length decimal number in ASCII, omitting leading zeros. Shall not + exceed 3600000." + PICS: MCORE.SC.SAI_OP_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalActive" + constraints: + maxValue: 3600000 + + - label: "TXT key for commissioning mode. CM=2 must be present" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "commissioningMode" + value: 2 + + - label: + "If (MCORE.SC.DT_KEY) present, DT key must contain the device type + identifier from Data Model Device Types and must be encoded as a + variable length decimal ASCII number without leading zeros" + PICS: MCORE.SC.DT_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceType" + value: deviceType + + - label: + "If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string + with a maximum length of 32B" + PICS: MCORE.SC.DN_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceName" + constraints: + maxLength: 32 + + - label: + "If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device + Identifier encoded as a uppercase string with a maximum length of 100 + chars" + PICS: MCORE.SC.RI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "rotatingIdLen" + constraints: + maxValue: 100 + + - label: + "If (MCORE.SC.PH_KEY) present, key PH must be encoded as a + variable-length decimal number in ASCII text, omitting any leading + zeros. If present value must be different of 0" + PICS: MCORE.SC.PH_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingHint" + constraints: + notValue: 0 + + - label: + "If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 + string with a maximum length of 128 bytes" + PICS: MCORE.SC.PI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingInstruction" + constraints: + maxLength: 128 + + - label: + "DUT must publish AAAA records for each IPv6 address upon which they + are willing to accept Matter messages" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "numIPs" + constraints: + minValue: 1 - label: "Wait for OCW timeout to expire" - verification: | - Wait until open-commissioning-window time to expire. - disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 180000 - - label: "If (MCORE.SC.EXTENDED_DISCOVERY ) enable Extended Discovery" - PICS: MCORE.SC.EXTENDED_DISCOVERY + - label: + "If (MCORE.SC.EXTENDED_DISCOVERY ) enable Extended Discovery. DUT + should start to send Commissionable Node Discovery DNS-SD + advertisements" verification: | If the device supports Discovery for an extended period of time, the Device should continue to advertise. Use the avahi-browse command and you should see the _matterc._udp advertisement - Reference Raspberrypi device is not supporting extended discovery. - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_SKIP_SAMPLE_APP && MCORE.SC.EXTENDED_DISCOVERY + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" - label: - "If (MCORE.SC.EXTENDED_DISCOVERY ) check DNS-SD subtypes used by DUT" - PICS: - " MCORE.SC.EXTENDED_DISCOVERY && MCORE.COM.WIFI && MCORE.COM.ETH && - MCORE.COM.THR && MCORE.SC.VENDOR_SUBTYPE && MCORE.SC.DEVTYPE_SUBTYPE - && MCORE.SC.VP_KEY && MCORE.SC.SII_OP_DISCOVERY_KEY && - MCORE.SC.SAI_OP_DISCOVERY_KEY && MCORE.SC.DT_KEY && MCORE.SC.DN_KEY && - MCORE.SC.RI_KEY && MCORE.SC.PH_KEY && MCORE.SC.PI_KEY " + "Check DNS-SD instance name must be 64-bit randomly selected ID + expressed as a sixteen-char hex string with capital letters" + PICS: MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "instanceName" + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + + - label: "service type must be _matterc._udp" verification: | Run and Verify on the below output in TH terminal Log: (Below is the sample log , as RPI doesn't support the extended discovery) Verify the CM flag value is 0 avahi-browse -rt _matterc._udp + Verify the device is advertising _matterc._udp service like below output in TH terminal Log: (Verify for the DUT's actual values (like vendor ID, PID ..etc) as mentioned in the expected outcome of the test plan, The below log contains the data from the reference raspi accessory) + wlp0s20f3 IPv6 FD37FE5156C56632 _matterc._udp local = wlp0s20f3 IPv6 FD37FE5156C56632 _matterc._udp local - hostname = [8C1D96786A130000.local] - address = [fe80::e9f6:2c08:2794:357d] - port = [5540] - txt = ["PI=" "PH=36" "CM=2" "D=3840" "T=1" "DT=65535" "VP=65521+32769"] - disabled: true + hostname = [8C1D96786A130000.local] + address = [fe80::e9f6:2c08:2794:357d] + port = [5540] + txt = ["PI=" "PH=36" "CM=2" "D=3840" "T=1" "DT=65535" "VP=65521+32769"] + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_SKIP_SAMPLE_APP && MCORE.SC.EXTENDED_DISCOVERY + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + #validate the service type and the service domain + + - label: + "Check Hostname. If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target + hostname is derived from the 48bit or 64bit MAC address expressed as a + twelve or sixteen capital letter hex string" + # On macOS the hostname is the device name and because of it this test is disabled for now. + PICS: + "(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR && + MCORE.SC.EXTENDED_DISCOVERY" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 16 + isUpperCase: true + isHexString: true + + - label: + "Check Hostname. If (MCORE.COM.THR) target hostname is derived from + the 48bit or 64bit MAC extended address expressed as a twelve or + sixteen capital letter hex string." + # On macOS the hostname is the device name and because of it this test is disabled for now. + PICS: + "(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR && + MCORE.SC.EXTENDED_DISCOVERY" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 16 + isUpperCase: true + isHexString: true + + # Commissioning Subtypes + + - label: "Check Long Discriminator _L" + PICS: MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionableByLongDiscriminator" + arguments: + values: + - name: "value" + value: discriminator + + - label: "Check Short Discriminator (_S)" + PICS: MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionableByShortDiscriminator" + arguments: + values: + - name: "value" + value: shortDiscriminator + + - label: + "If (MCORE.SC.VENDOR_SUBTYPE ) present, subtype _V is present + must be 16-bit vendor id, encoded as a variable-length decimal number + in ASCII text, omitting any leading zeros" + PICS: MCORE.SC.VENDOR_SUBTYPE && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionableByVendorId" + arguments: + values: + - name: "value" + value: vendorId + + - label: + "If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, + represents device type from Data Model and must be represented + as a variable length decimal number in ASCII without leading zeros" + # The device type is not broadcasted by the accessory under CI. + PICS: MCORE.SC.DEVTYPE_SUBTYPE && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionableByDeviceType" + arguments: + values: + - name: "value" + value: deviceType + + - label: "Check Commissioning Mode (_CM)" + PICS: MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionableByCommissioningMode" + + # TXT Records + + - label: "TXT key for discriminator (D)" + PICS: MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "longDiscriminator" + value: discriminator + constraints: + minValue: 0 + maxValue: 4096 + + - label: + "If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID + is present" + PICS: MCORE.SC.VP_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "vendorId" + value: vendorId + + - label: + "If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID + is present" + PICS: MCORE.SC.VP_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "productId" + value: productId + + - label: + "If (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key must be an + unsigned integer with units of milliseconds and shall be encoded as a + variable length decimal number in ASCII, omitting leading zeros. Shall + not exceed 3600000." + PICS: MCORE.SC.SII_OP_DISCOVERY_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalIdle" + constraints: + maxValue: 3600000 + + - label: + "If (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key must be an + unsigned integer with units of milliseconds and shall be encoded as a + variable length decimal number in ASCII, omitting leading zeros. Shall + not exceed 3600000." + PICS: MCORE.SC.SAI_OP_DISCOVERY_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalActive" + constraints: + maxValue: 3600000 + + - label: "TXT key for commissioning mode (CM), CM=0 may be present" + PICS: MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "commissioningMode" + value: 0 + + - label: + "If (MCORE.SC.DT_KEY) present, DT key must contain the device type + identifier from Data Model Device Types and must be encoded as a + variable length decimal ASCII number without leading zeros" + PICS: MCORE.SC.DT_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceType" + value: deviceType + + - label: + "If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string + with a maximum length of 32B" + PICS: MCORE.SC.DN_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceName" + constraints: + maxLength: 32 + + - label: + "If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device + Identifier encoded as a uppercase string with a maximum length of 100 + chars" + PICS: MCORE.SC.RI_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "rotatingIdLen" + constraints: + maxValue: 100 + + - label: + "If (MCORE.SC.PH_KEY) present, key PH must be encoded as a + variable-length decimal number in ASCII text, omitting any leading + zeros. If present value must be different of 0" + PICS: MCORE.SC.PH_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingHint" + constraints: + notValue: 0 + + - label: + "If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 + string with a maximum length of 128 bytes" + PICS: MCORE.SC.PI_KEY && MCORE.SC.EXTENDED_DISCOVERY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingInstruction" + constraints: + maxLength: 128 diff --git a/src/app/tests/suites/certification/Test_TC_TIMESYNC_2_3.yaml b/src/app/tests/suites/certification/Test_TC_TIMESYNC_2_3.yaml new file mode 100644 index 00000000000000..8e4821ddc1b311 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_TIMESYNC_2_3.yaml @@ -0,0 +1,85 @@ +# 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: 142.2.3. [TC-TIMESYNC-2.3] SetTrustedTimeSource command with DUT as Server + +PICS: + - TIMESYNC.S + - TIMESYNC.S.F03 + - TIMESYNC.S.C01.Rsp + - TIMESYNC.S.C00.Rsp + - TIMESYNC.S.A0001 + - TIMESYNC.S.A0000 + +config: + nodeId: 0x12344321 + cluster: "Time Synchronization" + endpoint: 0 + +tests: + - label: "Step 0: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read commissioner nodeID and saves as th_node_id" + cluster: "CommissionerCommands" + command: "GetCommissionerNodeId" + response: + values: + - name: "nodeId" + saveAs: th_node_id + + - label: + "Step 1: TH sends the SetTrustedTimeSource command to the DUT with the + TrustedTimeSource fields set as follows: NodeID: th_node_id, Endpoint: + 0" + command: "SetTrustedTimeSource" + arguments: + values: + - name: "TrustedTimeSource" + value: { NodeID: th_node_id, Endpoint: 0 } + + - label: + "Step 2: TH reads from the DUT the CurrentFabricIndex attribute from + the Node Operational Credentials Cluster and saves as th_fabric_idx" + command: "readAttribute" + attribute: "CurrentFabricIndex" + cluster: "Operational Credentials" + response: + saveAs: th_fabric_idx + + - label: "Step 3: TH reads from the DUT the TrustedTimeSource attribute." + command: "readAttribute" + attribute: "TrustedTimeSource" + response: + value: { FabricIndex: th_fabric_idx, NodeID: th_node_id, Endpoint: 0 } + + - label: + "Step 4: TH sends the SetTrustedTimeSource command to the DUT with the + TrustedTimeSource set to null." + command: "SetTrustedTimeSource" + arguments: + values: + - name: "TrustedTimeSource" + value: null + + - label: "Step 5: TH reads from the DUT the TrustedTimeSource attribute." + command: "readAttribute" + attribute: "TrustedTimeSource" + response: + value: null diff --git a/src/app/tests/suites/certification/Test_TC_TMP_2_1.yaml b/src/app/tests/suites/certification/Test_TC_TMP_2_1.yaml index 6e854e88e0c719..01c6a6b86684f3 100644 --- a/src/app/tests/suites/certification/Test_TC_TMP_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TMP_2_1.yaml @@ -36,21 +36,21 @@ tests: command: "readAttribute" attribute: "MinMeasuredValue" response: - saveAs: MinMeasuredValue + saveAs: CurrentMinMeasured constraints: type: int16s minValue: -27315 - maxValue: 32767 + maxValue: 32766 - label: "Read the mandatory attribute: MaxMeasuredValue" PICS: TMP.S.A0002 command: "readAttribute" attribute: "MaxMeasuredValue" response: - saveAs: MaxMeasuredValue + saveAs: CurrentMaxMeasured constraints: type: int16s - minValue: -27314 + minValue: CurrentMinMeasured maxValue: 32767 - label: "Read the mandatory attribute: MeasuredValue" @@ -60,8 +60,8 @@ tests: response: constraints: type: int16s - minValue: MinMeasuredValue - maxValue: MaxMeasuredValue + minValue: CurrentMinMeasured + maxValue: CurrentMaxMeasured - label: "Read the optional attribute: Tolerance" PICS: TMP.S.A0003 diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 1feac1732e6522..0264ad8fe3be8d 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -1061,9 +1061,9 @@ MCORE.DD.SCAN_NFC=1 MCORE.DD.SCAN_QR_CODE=1 MCORE.COM.WIRELESS=1 MCORE.COM.BLE=1 -MCORE.COM.WIFI=1 +MCORE.COM.WIFI=0 MCORE.COM.ETH=1 -MCORE.COM.THR=1 +MCORE.COM.THR=0 MCORE.DD.TXT_KEY_VP=1 MCORE.DD.TXT_KEY_DT=1 MCORE.DD.DISCOVERY_BLE=1 @@ -1998,7 +1998,7 @@ MCORE.SC.DN_KEY=1 MCORE.SC.RI_KEY=0 MCORE.SC.PH_KEY=1 MCORE.SC.PI_KEY=1 -MCORE.SC.EXTENDED_DISCOVERY=1 +MCORE.SC.EXTENDED_DISCOVERY=0 MCORE.SC.SED=1 MCORE.SC.ADV=1 MCORE.ROLE.COMMISSIONEE=1 @@ -2608,3 +2608,33 @@ FAN.S.A000B=1 #Server commands FAN.S.C00.Rsp=1 + +#ICD Management + +#Server Attribute +ICDM.S.A0000=1 +ICDM.S.A0001=1 +ICDM.S.A0002=1 +ICDM.S.A0003=1 +ICDM.S.A0004=1 +ICDM.S.A0005=1 + +#Features +ICDM.S.F00=1 + +#Commands +ICDM.S.C03.Rsp=1 + +#RVC Clean Mode Select +RVCCLEANMS.S.F00=1 +RVCCLEANMS.S.F01=0 +RVCCLEANMS.S.F02=0 + +#Attributes: +RVCCLEANMS.S.A0004=1 +RVCCLEANMS.S.A0005=1 + +#Commands: +RVCCLEANMS.S.C00.Rsp=1 +RVCCLEANMS.S.C01.Rsp=1 +RVCCLEANMS.S.C03.Tx=1 \ No newline at end of file diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 818a91722600f6..30188793e63fc4 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -71,6 +71,7 @@ ], "GeneralCommissioning": ["Test_TC_CGEN_1_1", "Test_TC_CGEN_2_1"], "GeneralDiagnostics": ["Test_TC_DGGEN_1_1", "Test_TC_DGGEN_2_1"], + "IcdManagement": ["Test_TC_ICDM_1_1", "Test_TC_ICDM_2_1"], "Identify": [ "Test_TC_I_1_1", "Test_TC_I_2_1", @@ -145,7 +146,10 @@ "Test_TC_APBSC_9_1", "Test_TC_CONTENTLAUNCHER_10_1", "Test_TC_WAKEONLAN_4_1", - "Test_TC_ALOGIN_12_1" + "Test_TC_ALOGIN_12_1", + "Test_TC_CONTENTLAUNCHER_10_3", + "Test_TC_CONTENTLAUNCHER_10_5", + "Test_TC_CONTENTLAUNCHER_10_7" ], "ModeSelect": ["Test_TC_MOD_1_1"], "MultipleFabrics": [], @@ -187,7 +191,7 @@ "Test_TC_DGTHREAD_2_3", "Test_TC_DGTHREAD_2_4" ], - "TimeSynchronization": ["Test_TC_TIMESYNC_1_1"], + "TimeSynchronization": ["Test_TC_TIMESYNC_1_1", "Test_TC_TIMESYNC_2_3"], "WiFiNetworkDiagnostics": [ "Test_TC_DGWIFI_1_1", "Test_TC_DGWIFI_2_1", @@ -352,6 +356,7 @@ "FanControl", "GeneralCommissioning", "GeneralDiagnostics", + "IcdManagement", "Identify", "IlluminanceMeasurement", "LevelControl", diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index ab02c78ba99c73..5fd2b511e5caa1 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -145,10 +145,7 @@ "Test_TC_MEDIAPLAYBACK_6_7", "Test_TC_AUDIOOUTPUT_7_3", "Test_TC_AUDIOOUTPUT_7_4", - "Test_TC_CONTENTLAUNCHER_10_3", "Test_TC_CONTENTLAUNCHER_10_4", - "Test_TC_CONTENTLAUNCHER_10_5", - "Test_TC_CONTENTLAUNCHER_10_7", "Test_TC_MC_11_1", "Test_TC_MC_11_2", "Test_TC_ALOGIN_12_2", diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 4b025cfcd7d3fd..c9aeac70f7797e 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -123,6 +123,8 @@ class TestList : public Command printf("Test_TC_CGEN_2_1\n"); printf("Test_TC_DGGEN_1_1\n"); printf("Test_TC_DGGEN_2_1\n"); + printf("Test_TC_ICDM_1_1\n"); + printf("Test_TC_ICDM_2_1\n"); printf("Test_TC_I_1_1\n"); printf("Test_TC_I_2_1\n"); printf("Test_TC_I_2_2\n"); @@ -180,6 +182,9 @@ class TestList : public Command printf("Test_TC_CONTENTLAUNCHER_10_1\n"); printf("Test_TC_WAKEONLAN_4_1\n"); printf("Test_TC_ALOGIN_12_1\n"); + printf("Test_TC_CONTENTLAUNCHER_10_3\n"); + printf("Test_TC_CONTENTLAUNCHER_10_5\n"); + printf("Test_TC_CONTENTLAUNCHER_10_7\n"); printf("Test_TC_MOD_1_1\n"); printf("OTA_SuccessfulTransfer\n"); printf("Test_TC_OCC_1_1\n"); @@ -220,6 +225,7 @@ class TestList : public Command printf("Test_TC_DGTHREAD_2_3\n"); printf("Test_TC_DGTHREAD_2_4\n"); printf("Test_TC_TIMESYNC_1_1\n"); + printf("Test_TC_TIMESYNC_2_3\n"); printf("Test_TC_ULABEL_1_1\n"); printf("Test_TC_ULABEL_2_1\n"); printf("Test_TC_ULABEL_2_2\n"); @@ -472,10 +478,7 @@ class ManualTestList : public Command printf("Test_TC_MEDIAPLAYBACK_6_7\n"); printf("Test_TC_AUDIOOUTPUT_7_3\n"); printf("Test_TC_AUDIOOUTPUT_7_4\n"); - printf("Test_TC_CONTENTLAUNCHER_10_3\n"); printf("Test_TC_CONTENTLAUNCHER_10_4\n"); - printf("Test_TC_CONTENTLAUNCHER_10_5\n"); - printf("Test_TC_CONTENTLAUNCHER_10_7\n"); printf("Test_TC_MC_11_1\n"); printf("Test_TC_MC_11_2\n"); printf("Test_TC_ALOGIN_12_2\n"); @@ -18207,11 +18210,12 @@ class Test_TC_CC_5_3Suite : public TestCommand class Test_TC_CC_6_1Suite : public TestCommand { public: - Test_TC_CC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_1", 21, credsIssuerConfig) + Test_TC_CC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_1", 22, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } @@ -18226,6 +18230,7 @@ class Test_TC_CC_6_1Suite : public TestCommand chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigWait; chip::Optional mTimeout; uint16_t ColorTempPhysicalMinMiredsValue; @@ -18371,6 +18376,10 @@ class Test_TC_CC_6_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 21: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { bool value; @@ -18553,7 +18562,14 @@ class Test_TC_CC_6_1Suite : public TestCommand ); } case 20: { - LogStep(20, "Check on/off attribute value is false after off command"); + LogStep(20, "Wait to turn Off light"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 21: { + LogStep(21, "Check on/off attribute value is false after off command"); VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); } @@ -18565,11 +18581,12 @@ class Test_TC_CC_6_1Suite : public TestCommand class Test_TC_CC_6_2Suite : public TestCommand { public: - Test_TC_CC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_2", 32, credsIssuerConfig) + Test_TC_CC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_2", 33, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } @@ -18584,6 +18601,7 @@ class Test_TC_CC_6_2Suite : public TestCommand chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigWait; chip::Optional mTimeout; uint16_t ColorTempPhysicalMinMiredsValue; @@ -18792,6 +18810,10 @@ class Test_TC_CC_6_2Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 32: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { bool value; @@ -19088,7 +19110,14 @@ class Test_TC_CC_6_2Suite : public TestCommand ); } case 31: { - LogStep(31, "Check on/off attribute value is false after off command"); + LogStep(31, "Wait to turn Off light"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 32: { + LogStep(32, "Check on/off attribute value is false after off command"); VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); } @@ -19100,11 +19129,12 @@ class Test_TC_CC_6_2Suite : public TestCommand class Test_TC_CC_6_3Suite : public TestCommand { public: - Test_TC_CC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_3", 26, credsIssuerConfig) + Test_TC_CC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_3", 27, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } @@ -19119,6 +19149,7 @@ class Test_TC_CC_6_3Suite : public TestCommand chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigWait; chip::Optional mTimeout; uint16_t ColorTempPhysicalMinMiredsValue; @@ -19294,6 +19325,10 @@ class Test_TC_CC_6_3Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 26: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { bool value; @@ -19529,7 +19564,14 @@ class Test_TC_CC_6_3Suite : public TestCommand ); } case 25: { - LogStep(25, "Check on/off attribute value is false after off command"); + LogStep(25, "Wait to turn Off light"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 26: { + LogStep(26, "Check on/off attribute value is false after off command"); VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); } @@ -19541,11 +19583,12 @@ class Test_TC_CC_6_3Suite : public TestCommand class Test_TC_CC_6_5Suite : public TestCommand { public: - Test_TC_CC_6_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_5", 17, credsIssuerConfig) + Test_TC_CC_6_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_5", 20, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } @@ -19560,6 +19603,7 @@ class Test_TC_CC_6_5Suite : public TestCommand chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigWait; chip::Optional mTimeout; chip::app::DataModel::Nullable StartUpColorTemperatureMiredsValue; @@ -19702,6 +19746,21 @@ class Test_TC_CC_6_5Suite : public TestCommand VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); } break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -19845,6 +19904,27 @@ class Test_TC_CC_6_5Suite : public TestCommand return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, true, chip::NullOptional); } + case 17: { + LogStep(17, "Turn Off light that we turned on"); + VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional + + ); + } + case 18: { + LogStep(18, "Wait to turn Off light"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 19: { + LogStep(19, "Check on/off attribute value is false after off command"); + VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } } return CHIP_NO_ERROR; } @@ -35448,6 +35528,9 @@ class Test_TC_FLW_2_1Suite : public TestCommand chip::Optional mEndpoint; chip::Optional mTimeout; + chip::app::DataModel::Nullable MinMeasuredVariable; + chip::app::DataModel::Nullable MaxMeasuredVariable; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // @@ -35472,6 +35555,7 @@ class Test_TC_FLW_2_1Suite : public TestCommand VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); VerifyOrReturn(CheckConstraintMaxValue("value", value, 65533U)); + MinMeasuredVariable = value; } break; case 2: @@ -35480,8 +35564,9 @@ class Test_TC_FLW_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredVariable)); VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); + MaxMeasuredVariable = value; } break; case 3: @@ -35490,8 +35575,8 @@ class Test_TC_FLW_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredVariable)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredVariable)); } break; case 4: @@ -38180,10 +38265,10 @@ class Test_TC_DGGEN_2_1Suite : public TestCommand } }; -class Test_TC_I_1_1Suite : public TestCommand +class Test_TC_ICDM_1_1Suite : public TestCommand { public: - Test_TC_I_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_1_1", 8, credsIssuerConfig) + Test_TC_ICDM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ICDM_1_1", 13, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -38191,7 +38276,7 @@ class Test_TC_I_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_I_1_1Suite() {} + ~Test_TC_ICDM_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -38225,7 +38310,7 @@ class Test_TC_I_1_1Suite : public TestCommand { uint16_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("clusterRevision", value, 4U)); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); } break; @@ -38234,11 +38319,20 @@ class Test_TC_I_1_1Suite : public TestCommand { uint32_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckValue("featureMap", value, 1UL)); VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); } break; case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList value; @@ -38246,6 +38340,7 @@ class Test_TC_I_1_1Suite : public TestCommand VerifyOrReturn(CheckConstraintType("value", "list", "list")); VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); @@ -38254,168 +38349,578 @@ class Test_TC_I_1_1Suite : public TestCommand VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); } break; - case 4: + case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); } break; - case 5: + case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 64UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); } break; - case 6: + case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); { auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); } VerifyOrReturn(CheckConstraintType("value", "list", "list")); } break; - case 7: + case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - CHIP_ERROR DoTestStep(uint16_t testIndex) override - { - using namespace chip::app::Clusters; - switch (testIndex) - { - case 0: { - LogStep(0, "Wait for the commissioned device to be retrieved"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "TH reads the ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "TH reads the FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Read the global attribute: AttributeList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Read the optional command(TriggerEffect) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, - "Read EventList attribute from the DUT. For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_I_2_1Suite : public TestCommand -{ -public: - Test_TC_I_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_2_1", 3, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_I_2_1Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - - // - // Tests methods - // - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } break; - case 1: + case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint16_t value; + chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); } break; - case 2: + case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::Clusters::Identify::IdentifyTypeEnum value; + chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::ClusterRevision::Id, + true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("ICDM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip(" !ICDM.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, + true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the optional attribute(RegisteredClients) in AttributeList"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, + true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the optional attribute(IcdCounter) in AttributeList"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, + true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute(ClientsSupportedPerFabric) in AttributeList"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, + true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: EventList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::EventList::Id, true, + chip::NullOptional); + } + case 9: { + LogStep(9, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, + IcdManagement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the optional command (StayActiveRequest) in AttributeList"); + VerifyOrDo(!ShouldSkip("ICDM.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, + IcdManagement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip(" !ICDM.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, + IcdManagement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("ICDM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, + IcdManagement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ICDM_2_1Suite : public TestCommand +{ +public: + Test_TC_ICDM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ICDM_2_1", 7, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ICDM_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + uint32_t IdleModeIntervalValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 500UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 64800000UL)); + IdleModeIntervalValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 300UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, IdleModeIntervalValue)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 300U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the IdleModeInterval attribute"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::IdleModeInterval::Id, + true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the ActiveModeInterval attribute"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, + IcdManagement::Attributes::ActiveModeInterval::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ActiveModeThreshold attribute"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, + IcdManagement::Attributes::ActiveModeThreshold::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the RegisteredClients attribute"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, + IcdManagement::Attributes::RegisteredClients::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the IcdCounter attribute"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::ICDCounter::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the ClientsSupportedPerFabric attribute"); + VerifyOrDo(!ShouldSkip("ICDM.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, + IcdManagement::Attributes::ClientsSupportedPerFabric::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_I_1_1Suite : public TestCommand +{ +public: + Test_TC_I_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_1_1", 8, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_I_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 4U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 64UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads the ClusterRevision attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::ClusterRevision::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads the FeatureMap attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "Read the optional command(TriggerEffect) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::GeneratedCommandList::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, + "Read EventList attribute from the DUT. For this cluster the list is usually empty but it can contain " + "manufacturer specific event IDs."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_I_2_1Suite : public TestCommand +{ +public: + Test_TC_I_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_2_1", 3, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_I_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Identify::IdentifyTypeEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); } break; default: @@ -49010,7 +49515,11 @@ class Test_TC_MEDIAPLAYBACK_6_4Suite : public TestCommand break; case 14: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("playbackSpeed", value, -1.0f)); + } break; case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -49026,7 +49535,11 @@ class Test_TC_MEDIAPLAYBACK_6_4Suite : public TestCommand break; case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("playbackSpeed", value, -2.0f)); + } break; case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -49195,15 +49708,10 @@ class Test_TC_MEDIAPLAYBACK_6_4Suite : public TestCommand } case 14: { LogStep(14, "Reads the PlaybackSpeed attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp"), + VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Please enter 'y' if PlaybackSpeed value is -1garbage: not in length on purpose", 45); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, + true, chip::NullOptional); } case 15: { LogStep(15, "Sends a Rewind command to the DUT"); @@ -49228,15 +49736,10 @@ class Test_TC_MEDIAPLAYBACK_6_4Suite : public TestCommand } case 17: { LogStep(17, "Reads the PlaybackSpeed attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp"), + VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Please enter 'y' if PlaybackSpeed value is -2garbage: not in length on purpose", 45); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, + true, chip::NullOptional); } case 18: { LogStep(18, "Sends a Play command"); @@ -50217,18 +50720,23 @@ class Test_TC_ALOGIN_12_1Suite : public TestCommand } }; -class Test_TC_MOD_1_1Suite : public TestCommand +class Test_TC_CONTENTLAUNCHER_10_3Suite : public TestCommand { public: - Test_TC_MOD_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_1_1", 10, credsIssuerConfig) + Test_TC_CONTENTLAUNCHER_10_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CONTENTLAUNCHER_10_3", 5, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("data", &mData); + AddArgument("SearchValue", &mSearchValue); + AddArgument("ExternalIdName", &mExternalIdName); + AddArgument("ExternalIdValue", &mExternalIdValue); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MOD_1_1Suite() {} + ~Test_TC_CONTENTLAUNCHER_10_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -50239,6 +50747,10 @@ class Test_TC_MOD_1_1Suite : public TestCommand chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mData; + chip::Optional mSearchValue; + chip::Optional mExternalIdName; + chip::Optional mExternalIdValue; chip::Optional mTimeout; chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } @@ -50260,97 +50772,1293 @@ class Test_TC_MOD_1_1Suite : public TestCommand case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint16_t value; + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), + mData.HasValue() ? mData.Value() : chip::Span("exampleData", 11))); } break; case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("featureMap", value, 1UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - } + shouldContinue = true; break; case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint32_t value; + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("featureMap", value, 0UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), + mData.HasValue() ? mData.Value() : chip::Span("exampleData", 11))); } break; case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep( + 1, + "TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay flag set to false"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(0); + listHolder_1->mList[0].value = + mSearchValue.HasValue() ? mSearchValue.Value() : chip::Span("exampleValue", 12); + listHolder_1->mList[0].externalIDList.Emplace(); + + { + auto * listHolder_4 = + new ListHolder(1); + listFreer.add(listHolder_4); + + listHolder_4->mList[0].name = + mExternalIdName.HasValue() ? mExternalIdName.Value() : chip::Span("name", 4); + listHolder_4->mList[0].value = + mExternalIdValue.HasValue() ? mExternalIdValue.Value() : chip::Span("value", 5); + + listHolder_1->mList[0].externalIDList.Value() = + chip::app::DataModel::List( + listHolder_4->mList, 1); + } + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); } + + value.autoPlay = false; + value.data.Emplace(); + value.data.Value() = mData.HasValue() ? mData.Value() : chip::Span("exampleData", 11); + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 2: { + LogStep(2, "Verify that DUT present via its user interface a list of matches based on the provided search criteria."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' if DUT present via its user interface a list of matches based " + "on the provided search criteria.garbage: not in length on purpose", + 111); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 3: { + LogStep( + 3, "TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay flag set to true"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(0); + listHolder_1->mList[0].value = + mSearchValue.HasValue() ? mSearchValue.Value() : chip::Span("exampleValue", 12); + listHolder_1->mList[0].externalIDList.Emplace(); + + { + auto * listHolder_4 = + new ListHolder(1); + listFreer.add(listHolder_4); + + listHolder_4->mList[0].name = + mExternalIdName.HasValue() ? mExternalIdName.Value() : chip::Span("name", 4); + listHolder_4->mList[0].value = + mExternalIdValue.HasValue() ? mExternalIdValue.Value() : chip::Span("value", 5); + + listHolder_1->mList[0].externalIDList.Value() = + chip::app::DataModel::List( + listHolder_4->mList, 1); + } + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + value.data.Emplace(); + value.data.Value() = mData.HasValue() ? mData.Value() : chip::Span("exampleData", 11); + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 4: { + LogStep(4, "Verify that DUT should also begin playing content that best matched the given search criteria"); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' if DUT begin playing content that best matched the given " + "search criteriagarbage: not in length on purpose", + 89); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CONTENTLAUNCHER_10_5Suite : public TestCommand +{ +public: + Test_TC_CONTENTLAUNCHER_10_5Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CONTENTLAUNCHER_10_5", 9, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("GoodURL", &mGoodURL); + AddArgument("BadURL", &mBadURL); + AddArgument("UnauthorizedURL", &mUnauthorizedURL); + AddArgument("DisplayContent", &mDisplayContent); + AddArgument("providerNameString", &mProviderNameString); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CONTENTLAUNCHER_10_5Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mGoodURL; + chip::Optional mBadURL; + chip::Optional mUnauthorizedURL; + chip::Optional mDisplayContent; + chip::Optional mProviderNameString; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 5: + case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckValue("status", value.status, 0U)); } break; - case 6: + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), + mDisplayContent.HasValue() ? mDisplayContent.Value() + : chip::Span("exampleData", 11))); } break; - case 7: + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckValue("status", value.status, 0U)); } break; - case 8: + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckValue("status", value.status, 1U)); } break; - case 9: + case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckValue("status", value.status, 2U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH sends a LaunchURL command to the DUT with a known good content URL string"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; + value.contentURL = mGoodURL.HasValue() ? mGoodURL.Value() : chip::Span("https://csa-iot.org/", 20); + value.brandingInformation.Emplace(); + + value.brandingInformation.Value().providerName = + mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); + + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, + chip::NullOptional + + ); + } + case 2: { + LogStep(2, "Verify that DUT launched the content at the given URL"); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT launched the content at the given URLgarbage: not in length on purpose", 61); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 3: { + LogStep(3, "TH sends a LaunchURL command to the DUT with a known good content URL string and a display string"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; + value.contentURL = mGoodURL.HasValue() ? mGoodURL.Value() : chip::Span("https://csa-iot.org/", 20); + value.displayString.Emplace(); + value.displayString.Value() = + mDisplayContent.HasValue() ? mDisplayContent.Value() : chip::Span("exampleData", 11); + value.brandingInformation.Emplace(); + + value.brandingInformation.Value().providerName = + mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); + + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, + chip::NullOptional + + ); + } + case 4: { + LogStep(4, + "Verify that DUT launched the content at the given URL with the given display string in the " + "application-specific description area"); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = + chip::Span("Please enter 'y' if DUT launched the content at the given URL with the given display " + "string in the application-specific description areagarbage: not in length on purpose", + 136); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 5: { + LogStep(5, + "TH sends a LaunchURL command to the DUT with a known good content URL string and a brand information object."); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; + value.contentURL = mGoodURL.HasValue() ? mGoodURL.Value() : chip::Span("https://csa-iot.org/", 20); + value.brandingInformation.Emplace(); + + value.brandingInformation.Value().providerName = + mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); + + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, + chip::NullOptional + + ); + } + case 6: { + LogStep(6, + "Verify that DUT launched the content at the given URL with the player interface updated as per the provided " + "branding information"); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = + chip::Span("Please enter 'y' if DUT launched the content at the given URL with the player interface " + "updated as per the provided branding informationgarbage: not in length on purpose", + 136); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 7: { + LogStep(7, "TH sends a LaunchURL command to the DUT with a known unreachable content URL string."); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; + value.contentURL = mBadURL.HasValue() ? mBadURL.Value() : chip::Span("https://badurl", 14); + value.brandingInformation.Emplace(); + + value.brandingInformation.Value().providerName = + mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); + + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, + chip::NullOptional + + ); + } + case 8: { + LogStep(8, "TH sends a LaunchURL command to the DUT with a known un-authorized content URL string."); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; + value.contentURL = + mUnauthorizedURL.HasValue() ? mUnauthorizedURL.Value() : chip::Span("https://csa-iot.org/badauth", 27); + value.brandingInformation.Emplace(); + + value.brandingInformation.Value().providerName = + mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); + + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, + chip::NullOptional + + ); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CONTENTLAUNCHER_10_7Suite : public TestCommand +{ +public: + Test_TC_CONTENTLAUNCHER_10_7Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CONTENTLAUNCHER_10_7", 27, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("PopularityName", &mPopularityName); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CONTENTLAUNCHER_10_7Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mPopularityName; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Actor and Value as An " + "Actor’s name, for example, Gaby sHoffman"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(0); + listHolder_1->mList[0].value = chip::Span("Gaby sHoffmangarbage: not in length on purpose", 13); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 2: { + LogStep(2, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 3: { + LogStep(3, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Channel and Value as " + "Channel Name name, for example, PBS"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(1); + listHolder_1->mList[0].value = chip::Span("PBSgarbage: not in length on purpose", 3); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 4: { + LogStep(4, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 5: { + LogStep(5, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Character and Value " + "as Character’s name,for example,Snow White"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(2); + listHolder_1->mList[0].value = chip::Span("Snow Whitegarbage: not in length on purpose", 10); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = false; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 6: { + LogStep(6, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 7: { + LogStep(7, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Director and Value as " + "Director’s name, for example, Spike Lee"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(3); + listHolder_1->mList[0].value = chip::Span("Spike Leegarbage: not in length on purpose", 9); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 8: { + LogStep(8, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 9: { + LogStep(9, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Event and Value as An " + "Event’s name , for example Football games"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(4); + listHolder_1->mList[0].value = chip::Span("Football gamesgarbage: not in length on purpose", 14); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 10: { + LogStep(10, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 11: { + LogStep(11, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Franchise and Value " + "as Franchise’s name,for example Star Wars"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(5); + listHolder_1->mList[0].value = chip::Span("Star Warsgarbage: not in length on purpose", 9); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 12: { + LogStep(12, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 13: { + LogStep(13, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Genre and Value as " + "Genre’s name, for example Horror"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(6); + listHolder_1->mList[0].value = chip::Span("Horrorgarbage: not in length on purpose", 6); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 14: { + LogStep(14, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 15: { + LogStep(15, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As League and Value as " + "League’s name, for example NCAA"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(7); + listHolder_1->mList[0].value = chip::Span("NCAAgarbage: not in length on purpose", 4); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 16: { + LogStep(16, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 17: { + LogStep(17, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Popularity and Value " + "as Popularity’s name"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(8); + listHolder_1->mList[0].value = + mPopularityName.HasValue() ? mPopularityName.Value() : chip::Span("popular content", 15); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 18: { + LogStep(18, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 19: { + LogStep(19, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Provider and Value as " + "Provider’s name, for example Netflix"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(9); + listHolder_1->mList[0].value = chip::Span("Netflixgarbage: not in length on purpose", 7); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 20: { + LogStep(20, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 21: { + LogStep(21, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Sport and Value as " + "Sport’s name, for example, football"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(10); + listHolder_1->mList[0].value = chip::Span("footballgarbage: not in length on purpose", 8); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 22: { + LogStep(22, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 23: { + LogStep(23, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As SportsTeam and Value " + "as SportTeam’s name , for example Arsenel"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(11); + listHolder_1->mList[0].value = chip::Span("Arsenelgarbage: not in length on purpose", 7); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 24: { + LogStep(24, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 25: { + LogStep(25, + "TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Type and Value as " + "Type’s name, for example TVSeries"); + VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; + + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].type = static_cast(12); + listHolder_1->mList[0].value = chip::Span("TVSeriesgarbage: not in length on purpose", 8); + + value.search.parameterList = + chip::app::DataModel::List( + listHolder_1->mList, 1); + } + + value.autoPlay = true; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value, chip::NullOptional + + ); + } + case 26: { + LogStep(26, "Verify that DUT should play or display the search result."); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_MOD_1_1Suite : public TestCommand +{ +public: + Test_TC_MOD_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_1_1", 10, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MOD_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 1UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); } break; default: @@ -53641,8 +55349,8 @@ class Test_TC_PRS_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); + VerifyOrReturn(CheckConstraintMinValue("value", value, -32767)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); MinMeasuredValue = value; } break; @@ -53652,7 +55360,7 @@ class Test_TC_PRS_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); MaxMeasuredValue = value; } @@ -53683,8 +55391,8 @@ class Test_TC_PRS_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); + VerifyOrReturn(CheckConstraintMinValue("value", value, -32767)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); MinScaledValue = value; } break; @@ -53694,7 +55402,7 @@ class Test_TC_PRS_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinScaledValue)); VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); MaxScaledValue = value; } @@ -56315,6 +58023,9 @@ class Test_TC_RH_2_1Suite : public TestCommand chip::Optional mEndpoint; chip::Optional mTimeout; + chip::app::DataModel::Nullable CurrentMinMeasured; + chip::app::DataModel::Nullable CurrentMaxMeasured; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // @@ -56339,6 +58050,7 @@ class Test_TC_RH_2_1Suite : public TestCommand VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + CurrentMinMeasured = value; } break; case 2: @@ -56347,8 +58059,9 @@ class Test_TC_RH_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMinValue("value", value, CurrentMinMeasured)); VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + CurrentMaxMeasured = value; } break; case 3: @@ -56357,8 +58070,8 @@ class Test_TC_RH_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + VerifyOrReturn(CheckConstraintMinValue("value", value, CurrentMinMeasured)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, CurrentMaxMeasured)); } break; case 4: @@ -58260,8 +59973,8 @@ class Test_TC_TMP_2_1Suite : public TestCommand chip::Optional mEndpoint; chip::Optional mTimeout; - chip::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; + chip::app::DataModel::Nullable CurrentMinMeasured; + chip::app::DataModel::Nullable CurrentMaxMeasured; chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } @@ -58286,8 +59999,8 @@ class Test_TC_TMP_2_1Suite : public TestCommand VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - MinMeasuredValue = value; + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); + CurrentMinMeasured = value; } break; case 2: @@ -58296,9 +60009,9 @@ class Test_TC_TMP_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27314)); + VerifyOrReturn(CheckConstraintMinValue("value", value, CurrentMinMeasured)); VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - MaxMeasuredValue = value; + CurrentMaxMeasured = value; } break; case 3: @@ -58307,8 +60020,8 @@ class Test_TC_TMP_2_1Suite : public TestCommand chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + VerifyOrReturn(CheckConstraintMinValue("value", value, CurrentMinMeasured)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, CurrentMaxMeasured)); } break; case 4: @@ -63183,6 +64896,172 @@ class Test_TC_TIMESYNC_1_1Suite : public TestCommand } }; +class Test_TC_TIMESYNC_2_3Suite : public TestCommand +{ +public: + Test_TC_TIMESYNC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_TIMESYNC_2_3", 7, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TIMESYNC_2_3Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::NodeId th_node_id; + uint8_t th_fabric_idx; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + th_node_id = value.nodeId; + } + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + th_fabric_idx = value; + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable< + chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("trustedTimeSource", value)); + VerifyOrReturn(CheckValue("trustedTimeSource.Value().fabricIndex", value.Value().fabricIndex, th_fabric_idx)); + VerifyOrReturn(CheckValue("trustedTimeSource.Value().nodeID", value.Value().nodeID, th_node_id)); + VerifyOrReturn(CheckValue("trustedTimeSource.Value().endpoint", value.Value().endpoint, 0U)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable< + chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("trustedTimeSource", value)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Step 0: Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read commissioner nodeID and saves as th_node_id"); + ListFreer listFreer; + chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; + return GetCommissionerNodeId(kIdentityAlpha, value); + } + case 2: { + LogStep(2, + "Step 1: TH sends the SetTrustedTimeSource command to the DUT with the TrustedTimeSource fields set as " + "follows: NodeID: th_node_id, Endpoint: 0"); + ListFreer listFreer; + chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Type value; + value.trustedTimeSource.SetNonNull(); + + value.trustedTimeSource.Value().nodeID = th_node_id; + value.trustedTimeSource.Value().endpoint = 0U; + + return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, + TimeSynchronization::Commands::SetTrustedTimeSource::Id, value, chip::NullOptional + + ); + } + case 3: { + LogStep(3, + "Step 2: TH reads from the DUT the CurrentFabricIndex attribute from the Node Operational Credentials Cluster " + "and saves as th_fabric_idx"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Step 3: TH reads from the DUT the TrustedTimeSource attribute."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, + TimeSynchronization::Attributes::TrustedTimeSource::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Step 4: TH sends the SetTrustedTimeSource command to the DUT with the TrustedTimeSource set to null."); + ListFreer listFreer; + chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Type value; + value.trustedTimeSource.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, + TimeSynchronization::Commands::SetTrustedTimeSource::Id, value, chip::NullOptional + + ); + } + case 6: { + LogStep(6, "Step 5: TH reads from the DUT the TrustedTimeSource attribute."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, + TimeSynchronization::Attributes::TrustedTimeSource::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + class Test_TC_ULABEL_1_1Suite : public TestCommand { public: @@ -117916,62 +119795,6 @@ class Test_TC_AUDIOOUTPUT_7_4Suite : public TestCommand } }; -class Test_TC_CONTENTLAUNCHER_10_3Suite : public TestCommand -{ -public: - Test_TC_CONTENTLAUNCHER_10_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_10_3", 0, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CONTENTLAUNCHER_10_3Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - - // - // Tests methods - // - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - CHIP_ERROR DoTestStep(uint16_t testIndex) override - { - using namespace chip::app::Clusters; - switch (testIndex) - {} - return CHIP_NO_ERROR; - } -}; - class Test_TC_CONTENTLAUNCHER_10_4Suite : public TestCommand { public: @@ -118028,11 +119851,10 @@ class Test_TC_CONTENTLAUNCHER_10_4Suite : public TestCommand } }; -class Test_TC_CONTENTLAUNCHER_10_5Suite : public TestCommand +class Test_TC_MC_11_1Suite : public TestCommand { public: - Test_TC_CONTENTLAUNCHER_10_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_10_5", 0, credsIssuerConfig) + Test_TC_MC_11_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_11_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118040,7 +119862,7 @@ class Test_TC_CONTENTLAUNCHER_10_5Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CONTENTLAUNCHER_10_5Suite() {} + ~Test_TC_MC_11_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118084,11 +119906,10 @@ class Test_TC_CONTENTLAUNCHER_10_5Suite : public TestCommand } }; -class Test_TC_CONTENTLAUNCHER_10_7Suite : public TestCommand +class Test_TC_MC_11_2Suite : public TestCommand { public: - Test_TC_CONTENTLAUNCHER_10_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_10_7", 0, credsIssuerConfig) + Test_TC_MC_11_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_11_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118096,7 +119917,7 @@ class Test_TC_CONTENTLAUNCHER_10_7Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CONTENTLAUNCHER_10_7Suite() {} + ~Test_TC_MC_11_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118140,10 +119961,11 @@ class Test_TC_CONTENTLAUNCHER_10_7Suite : public TestCommand } }; -class Test_TC_MC_11_1Suite : public TestCommand +class Test_TC_ALOGIN_12_2Suite : public TestCommand { public: - Test_TC_MC_11_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_11_1", 0, credsIssuerConfig) + Test_TC_ALOGIN_12_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ALOGIN_12_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118151,7 +119973,7 @@ class Test_TC_MC_11_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_11_1Suite() {} + ~Test_TC_ALOGIN_12_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118195,10 +120017,10 @@ class Test_TC_MC_11_1Suite : public TestCommand } }; -class Test_TC_MC_11_2Suite : public TestCommand +class Test_TC_TGTNAV_8_2Suite : public TestCommand { public: - Test_TC_MC_11_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_11_2", 0, credsIssuerConfig) + Test_TC_TGTNAV_8_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TGTNAV_8_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118206,7 +120028,7 @@ class Test_TC_MC_11_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_11_2Suite() {} + ~Test_TC_TGTNAV_8_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118250,11 +120072,10 @@ class Test_TC_MC_11_2Suite : public TestCommand } }; -class Test_TC_ALOGIN_12_2Suite : public TestCommand +class Test_TC_CADMIN_1_1Suite : public TestCommand { public: - Test_TC_ALOGIN_12_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ALOGIN_12_2", 0, credsIssuerConfig) + Test_TC_CADMIN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118262,7 +120083,7 @@ class Test_TC_ALOGIN_12_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_ALOGIN_12_2Suite() {} + ~Test_TC_CADMIN_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118306,10 +120127,10 @@ class Test_TC_ALOGIN_12_2Suite : public TestCommand } }; -class Test_TC_TGTNAV_8_2Suite : public TestCommand +class Test_TC_CADMIN_1_2Suite : public TestCommand { public: - Test_TC_TGTNAV_8_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TGTNAV_8_2", 0, credsIssuerConfig) + Test_TC_CADMIN_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118317,7 +120138,7 @@ class Test_TC_TGTNAV_8_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_TGTNAV_8_2Suite() {} + ~Test_TC_CADMIN_1_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118361,10 +120182,10 @@ class Test_TC_TGTNAV_8_2Suite : public TestCommand } }; -class Test_TC_CADMIN_1_1Suite : public TestCommand +class Test_TC_CADMIN_1_7Suite : public TestCommand { public: - Test_TC_CADMIN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_1", 0, credsIssuerConfig) + Test_TC_CADMIN_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_7", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118372,7 +120193,7 @@ class Test_TC_CADMIN_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CADMIN_1_1Suite() {} + ~Test_TC_CADMIN_1_7Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118416,10 +120237,10 @@ class Test_TC_CADMIN_1_1Suite : public TestCommand } }; -class Test_TC_CADMIN_1_2Suite : public TestCommand +class Test_TC_CADMIN_1_8Suite : public TestCommand { public: - Test_TC_CADMIN_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_2", 0, credsIssuerConfig) + Test_TC_CADMIN_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_8", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118427,117 +120248,7 @@ class Test_TC_CADMIN_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CADMIN_1_2Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - - // - // Tests methods - // - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - CHIP_ERROR DoTestStep(uint16_t testIndex) override - { - using namespace chip::app::Clusters; - switch (testIndex) - {} - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_7Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_7", 0, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CADMIN_1_7Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - - // - // Tests methods - // - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - CHIP_ERROR DoTestStep(uint16_t testIndex) override - { - using namespace chip::app::Clusters; - switch (testIndex) - {} - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_8Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_8", 0, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CADMIN_1_8Suite() {} + ~Test_TC_CADMIN_1_8Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -123660,26 +125371,45 @@ class Test_TC_SC_3_4Suite : public TestCommand class Test_TC_SC_4_1Suite : public TestCommand { public: - Test_TC_SC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_1", 0, credsIssuerConfig) + Test_TC_SC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_1", 95, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("shortDiscriminator", 0, UINT16_MAX, &mShortDiscriminator); + AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); + AddArgument("productId", 0, UINT16_MAX, &mProductId); + AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); + AddArgument("PakeVerifier", &mPakeVerifier); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); } - ~Test_TC_SC_4_1Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override + ~Test_TC_SC_4_1Suite() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + if (deviceInstanceNameBeforeRebootBuffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); + deviceInstanceNameBeforeRebootBuffer = nullptr; + } } + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(900)); } + private: chip::Optional mNodeId; - chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mShortDiscriminator; + chip::Optional mVendorId; + chip::Optional mProductId; + chip::Optional mDeviceType; + chip::Optional mPakeVerifier; chip::Optional mTimeout; + chip::Optional mWaitAfterCommissioning; + + char * deviceInstanceNameBeforeRebootBuffer = nullptr; + chip::CharSpan deviceInstanceNameBeforeReboot; chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } @@ -123693,6 +125423,838 @@ class Test_TC_SC_4_1Suite : public TestCommand switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); + VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); + if (deviceInstanceNameBeforeRebootBuffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); + } + deviceInstanceNameBeforeRebootBuffer = static_cast(chip::Platform::MemoryAlloc(value.instanceName.size())); + memcpy(deviceInstanceNameBeforeRebootBuffer, value.instanceName.data(), value.instanceName.size()); + deviceInstanceNameBeforeReboot = chip::CharSpan(deviceInstanceNameBeforeRebootBuffer, value.instanceName.size()); + } + shouldContinue = true; + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); + VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); + } + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); + VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); + } + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, + mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); + VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); + } + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); + } + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); + } + shouldContinue = true; + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (value.mrpRetryIntervalIdle.HasValue()) + { + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), + 3600000UL)); + } + } + shouldContinue = true; + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (value.mrpRetryIntervalActive.HasValue()) + { + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", + value.mrpRetryIntervalActive.Value(), 3600000UL)); + } + } + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1U)); + } + shouldContinue = true; + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); + } + shouldContinue = true; + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); + } + shouldContinue = true; + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); + } + shouldContinue = true; + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); + } + shouldContinue = true; + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); + } + shouldContinue = true; + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1U)); + } + shouldContinue = true; + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); + VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintNotValue("value.instanceName", value.instanceName, deviceInstanceNameBeforeReboot)); + } + shouldContinue = true; + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); + VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); + } + shouldContinue = true; + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); + VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); + } + shouldContinue = true; + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, + mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); + VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); + } + shouldContinue = true; + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); + } + shouldContinue = true; + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); + } + shouldContinue = true; + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (value.mrpRetryIntervalIdle.HasValue()) + { + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), + 3600000UL)); + } + } + shouldContinue = true; + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (value.mrpRetryIntervalActive.HasValue()) + { + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", + value.mrpRetryIntervalActive.Value(), 3600000UL)); + } + } + shouldContinue = true; + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1U)); + } + shouldContinue = true; + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); + } + shouldContinue = true; + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); + } + shouldContinue = true; + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); + } + shouldContinue = true; + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); + } + shouldContinue = true; + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); + } + shouldContinue = true; + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1U)); + } + shouldContinue = true; + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); + VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); + } + shouldContinue = true; + break; + case 55: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); + VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); + } + shouldContinue = true; + break; + case 56: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); + VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); + } + shouldContinue = true; + break; + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 61: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 62: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); + } + shouldContinue = true; + break; + case 63: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); + } + shouldContinue = true; + break; + case 64: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (value.mrpRetryIntervalIdle.HasValue()) + { + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), + 3600000UL)); + } + } + shouldContinue = true; + break; + case 65: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (value.mrpRetryIntervalActive.HasValue()) + { + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", + value.mrpRetryIntervalActive.Value(), 3600000UL)); + } + } + shouldContinue = true; + break; + case 66: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 2U)); + } + shouldContinue = true; + break; + case 67: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); + } + shouldContinue = true; + break; + case 68: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); + } + shouldContinue = true; + break; + case 69: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); + } + shouldContinue = true; + break; + case 70: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); + } + shouldContinue = true; + break; + case 71: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); + } + shouldContinue = true; + break; + case 72: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1U)); + } + shouldContinue = true; + break; + case 73: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 74: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 75: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); + VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); + } + shouldContinue = true; + break; + case 76: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 77: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); + VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); + } + shouldContinue = true; + break; + case 78: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); + VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); + } + shouldContinue = true; + break; + case 79: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 80: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 81: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 82: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 83: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 84: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, + mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); + VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); + } + shouldContinue = true; + break; + case 85: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); + } + shouldContinue = true; + break; + case 86: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); + } + shouldContinue = true; + break; + case 87: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (value.mrpRetryIntervalIdle.HasValue()) + { + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), + 3600000UL)); + } + } + shouldContinue = true; + break; + case 88: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (value.mrpRetryIntervalActive.HasValue()) + { + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", + value.mrpRetryIntervalActive.Value(), 3600000UL)); + } + } + shouldContinue = true; + break; + case 89: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 0U)); + } + shouldContinue = true; + break; + case 90: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); + } + shouldContinue = true; + break; + case 91: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); + } + shouldContinue = true; + break; + case 92: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); + } + shouldContinue = true; + break; + case 93: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); + } + shouldContinue = true; + break; + case 94: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); + } + shouldContinue = true; + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -123707,7 +126269,844 @@ class Test_TC_SC_4_1Suite : public TestCommand { using namespace chip::app::Clusters; switch (testIndex) - {} + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "DUT is put in Commissioning Mode using Open Basic Commissioning Window command "); + ListFreer listFreer; + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 2: { + LogStep(2, "Waiting after opening commissioning window"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 3: { + LogStep(3, + "Check DNS-SD instance name must be 64-bit randomly selected ID expressed as a sixteen-char hex string with " + "capital letters"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 4: { + LogStep(4, "Service type must be _matterc._udp"); + VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 5: { + LogStep(5, + "Check target hostname is derived from the 48bit or 64bit MAC address expressed as a twelve or sixteen capital " + "letter hex string"); + VerifyOrDo(!ShouldSkip("( MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 6: { + LogStep(6, + "Check target hostname is derived from the 48bit or 64bit MAC address expressed as a twelve or sixteen capital " + "letter hex string"); + VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.WIFI) && MCORE.COM.THR"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 7: { + LogStep(7, "Check Long Discriminator _L"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; + value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; + return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); + } + case 8: { + LogStep(8, "Check Short Discriminator (_S)"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; + value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; + return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); + } + case 9: { + LogStep(9, + "If (MCORE.SC.VENDOR_SUBTYPE) present, subtype _V is present must be 16-bit vendor id, encoded as a " + "variable-length decimal number in ASCII text, omitting any leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; + value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; + return FindCommissionableByVendorId(kIdentityAlpha, value); + } + case 10: { + LogStep(10, + "if (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, represents device type from Data " + "Model and must be represented as a variable length decimal number in ASCII without leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DEVTYPE_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; + value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; + return FindCommissionableByDeviceType(kIdentityAlpha, value); + } + case 11: { + LogStep(11, "Check Commissioning Mode (_CM) subtype _CM must be present"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; + return FindCommissionableByCommissioningMode(kIdentityAlpha, value); + } + case 12: { + LogStep(12, + "key D must be present and represents the discriminator which must be encoded as a variable-length decimal " + "value with up to 4 digits omitting any leading zeros"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 13: { + LogStep(13, "If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID is present"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 14: { + LogStep(14, "If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID is present"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 15: { + LogStep( + 15, + "If (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key must be an unsigned integer with units of milliseconds and " + "shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall not exceed 3600000"); + VerifyOrDo(!ShouldSkip("MCORE.SC.SII_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 16: { + LogStep( + 16, + "If (MCORE.SC.SAI_OP_DISCOVERY_KEY ) present, SAI key must be an unsigned integer with units of milliseconds and " + "shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall not exceed 3600000."); + VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 17: { + LogStep(17, "TXT key for commissioning mode (CM) CM=1 must be present"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 18: { + LogStep(18, + "If (MCORE.SC.DT_KEY) present, DT key must contain the device type identifier from Data Model Device Types and " + "must be encoded as a variable length decimal ASCII number without leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 19: { + LogStep(19, "If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string with a maximum length of 32B"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 20: { + LogStep(20, + "If (MCORE.SC.RI_KEY ) present, key RI must include the Rotating Device Identifier encoded as a uppercase " + "string with a maximum length of 100 chars"); + VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 21: { + LogStep(21, + "If (MCORE.SC.PH_KEY) present, key PH must be encoded as a variable-length decimal number in ASCII text, " + "omitting any leading zeros. If present value must be different of 0"); + VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 22: { + LogStep( + 22, + "If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 string with a maximum length of 128 bytes"); + VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 23: { + LogStep(23, + "DUT must publish AAAA records for each IPv6 address upon which they are willing to accept Matter messages."); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 24: { + LogStep(24, "Reboot/restart the DUT"); + VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; + return Reboot(kIdentityAlpha, value); + } + case 25: { + LogStep(25, "Reboot target device(DUT)"); + VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = + chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 26: { + LogStep(26, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 27: { + LogStep(27, + "DUT put in Commissioning Mode using Open Basic Commissioning Window command, starting advertising " + "Commissionable Node Discovery service using DNS-SD"); + VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 28: { + LogStep(28, "Waiting after opening commissioning window"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 29: { + LogStep(29, + "Check DNS-SD instance name must be 64-bit randomly selected ID expressed as a sixteen-char hex string with " + "capital letters and must be different from the one at step 2"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 30: { + LogStep(30, "service type must be _matterc._udp"); + VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 31: { + LogStep(31, + "Check Hostname. If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target hostname is derived from the 48bit or 64bit MAC " + "address expressed as a twelve or sixteen capital letter hex string"); + VerifyOrDo(!ShouldSkip("(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 32: { + LogStep(32, + "Check Hostname. If (MCORE.COM.THR) target hostname is derived from the 48bit or 64bit MAC address expressed " + "as a twelve or sixteen capital letter hex string"); + VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 33: { + LogStep(33, "Check Long Discriminator _L"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; + value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; + return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); + } + case 34: { + LogStep(34, "Check Short Discriminator (_S)"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; + value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; + return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); + } + case 35: { + LogStep(35, + "If (MCORE.SC.VENDOR_SUBTYPE ) present, subtype _V is present must be 16-bit vendor id, encoded as a " + "variable-length decimal number in ASCII text, omitting any leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; + value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; + return FindCommissionableByVendorId(kIdentityAlpha, value); + } + case 36: { + LogStep(36, + "If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, represents device type from Data " + "Model and must be represented as a variable length decimal number in ASCII without leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DEVTYPE_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; + value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; + return FindCommissionableByDeviceType(kIdentityAlpha, value); + } + case 37: { + LogStep(37, "Check Commissioning Mode (_CM) subtype _CM is present"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; + return FindCommissionableByCommissioningMode(kIdentityAlpha, value); + } + case 38: { + LogStep(38, + "key D must be present and represents the discriminator which must be encoded as a variable-length decimal " + "value with up to 4 digits omitting any leading zeros"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 39: { + LogStep(39, "If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID is present."); + VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 40: { + LogStep(40, "If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID is present."); + VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 41: { + LogStep( + 41, + "If (MCORE.SC.SII_OP_DISCOVERY_KEY ) present, SII key must be an unsigned integer with units of milliseconds and " + "shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall not exceed 3600000"); + VerifyOrDo(!ShouldSkip("MCORE.SC.SII_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 42: { + LogStep( + 42, + "If (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key must be an unsigned integer with units of milliseconds and " + "shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall not exceed 3600000."); + VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 43: { + LogStep(43, "TXT key for commissioning mode (CM) key CM=1 must be present"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 44: { + LogStep(44, + "If (MCORE.SC.DT_KEY) present, DT key must contain the device type identifier from Data Model Device Types and " + "must be encoded as a variable length decimal ASCII number without leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 45: { + LogStep(45, "If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string with a maximum length of 32B"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 46: { + LogStep(46, + "If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device Identifier encoded as a uppercase " + "string with a maximum length of 100 chars"); + VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 47: { + LogStep(47, + "If (MCORE.SC.PH_KEY) present, key PH must be encoded as a variable-length decimal number in ASCII text, " + "omitting any leading zeros. If present value must be different of 0"); + VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 48: { + LogStep( + 48, + "If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 string with a maximum length of 128 bytes"); + VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 49: { + LogStep(49, + "DUT must publish AAAA records for each IPv6 address upon which they are willing to accept Matter messages."); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 50: { + LogStep(50, "Wait for OpenBasicCommissioningWindow timeout to expire"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 180000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 51: { + LogStep(51, + "DUT is Commissioned and instructed to enter in commissioning mode using Open Commissioning Window command"); + VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() + ? mPakeVerifier.Value() + : chip::ByteSpan( + chip::Uint8::from_const_char( + "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" + "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" + "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" + "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), + 97); + value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; + value.iterations = 1000UL; + value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 52: { + LogStep(52, + "DUT is Commissioned and instructed to enter in commissioning mode using Open Commissioning Window command"); + VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 53: { + LogStep(53, "Waiting after opening commissioning window"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 54: { + LogStep(54, + "DNS-SD instance name must be 64-bit randomly selected ID expressed as a sixteen-char hex string with capital " + "letters"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 55: { + LogStep(55, + "Check Hostname.If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target hostname is derived from the 48bit or 64bit MAC " + "address expressed as a twelve or sixteen capital letter hex string."); + VerifyOrDo(!ShouldSkip("(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 56: { + LogStep(56, + "Check Hostname. If (MCORE.COM.THR) target hostname is derived from the 48bit or 64bit MAC extended address " + "expressed as a twelve or sixteen capital letter hex string."); + VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 57: { + LogStep(57, "Check Long Discriminator _L"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; + value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; + return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); + } + case 58: { + LogStep(58, "Check Short Discriminator (_S)"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; + value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; + return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); + } + case 59: { + LogStep(59, + "If (MCORE.SC.VENDOR_SUBTYPE) present, subtype _V is present must be 16-bit vendor id, encoded as a " + "variable-length decimal number in ASCII text, omitting any leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; + value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; + return FindCommissionableByVendorId(kIdentityAlpha, value); + } + case 60: { + LogStep(60, + "If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, represents device type from Data " + "Model and must be represented as a variable length decimal number in ASCII without leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; + value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; + return FindCommissionableByDeviceType(kIdentityAlpha, value); + } + case 61: { + LogStep(61, "Check Commissioning Mode (_CM) subtype _CM is present"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; + return FindCommissionableByCommissioningMode(kIdentityAlpha, value); + } + case 62: { + LogStep(62, "If (MCORE.SC.VP_KEY ) present, VP key must contain at least Vendor ID is present."); + VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 63: { + LogStep(63, "If (MCORE.SC.VP_KEY ) present, VP key must contain at least Product ID is present"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 64: { + LogStep(64, + "Optional TXT key for MRP Retry Interval Idle. if (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key must be an " + "unsigned integer with units of milliseconds and shall be encoded as a variable length decimal number in " + "ASCII, omitting leading zeros. Shall not exceed 3600000"); + VerifyOrDo(!ShouldSkip("MCORE.SC.SII_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 65: { + LogStep(65, + "Optional TXT key for MRP Retry Interval Active. if (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key must be " + "an unsigned integer with units of milliseconds and shall be encoded as a variable length decimal number in " + "ASCII, omitting leading zeros. Shall not exceed 3600000."); + VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 66: { + LogStep(66, "TXT key for commissioning mode. CM=2 must be present"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 67: { + LogStep(67, + "If (MCORE.SC.DT_KEY) present, DT key must contain the device type identifier from Data Model Device Types and " + "must be encoded as a variable length decimal ASCII number without leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 68: { + LogStep(68, "If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string with a maximum length of 32B"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 69: { + LogStep(69, + "If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device Identifier encoded as a uppercase " + "string with a maximum length of 100 chars"); + VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 70: { + LogStep(70, + "If (MCORE.SC.PH_KEY) present, key PH must be encoded as a variable-length decimal number in ASCII text, " + "omitting any leading zeros. If present value must be different of 0"); + VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 71: { + LogStep( + 71, + "If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 string with a maximum length of 128 bytes"); + VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 72: { + LogStep(72, + "DUT must publish AAAA records for each IPv6 address upon which they are willing to accept Matter messages"); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 73: { + LogStep(73, "Wait for OCW timeout to expire"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 180000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 74: { + LogStep(74, + "If (MCORE.SC.EXTENDED_DISCOVERY ) enable Extended Discovery. DUT should start to send Commissionable Node " + "Discovery DNS-SD advertisements"); + VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 75: { + LogStep(75, + "Check DNS-SD instance name must be 64-bit randomly selected ID expressed as a sixteen-char hex string with " + "capital letters"); + VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 76: { + LogStep(76, "service type must be _matterc._udp"); + VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 77: { + LogStep(77, + "Check Hostname. If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target hostname is derived from the 48bit or 64bit MAC " + "address expressed as a twelve or sixteen capital letter hex string"); + VerifyOrDo(!ShouldSkip("(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 78: { + LogStep(78, + "Check Hostname. If (MCORE.COM.THR) target hostname is derived from the 48bit or 64bit MAC extended address " + "expressed as a twelve or sixteen capital letter hex string."); + VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 79: { + LogStep(79, "Check Long Discriminator _L"); + VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; + value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; + return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); + } + case 80: { + LogStep(80, "Check Short Discriminator (_S)"); + VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; + value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; + return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); + } + case 81: { + LogStep(81, + "If (MCORE.SC.VENDOR_SUBTYPE ) present, subtype _V is present must be 16-bit vendor id, encoded as a " + "variable-length decimal number in ASCII text, omitting any leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; + value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; + return FindCommissionableByVendorId(kIdentityAlpha, value); + } + case 82: { + LogStep(82, + "If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, represents device type from Data " + "Model and must be represented as a variable length decimal number in ASCII without leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DEVTYPE_SUBTYPE && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; + value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; + return FindCommissionableByDeviceType(kIdentityAlpha, value); + } + case 83: { + LogStep(83, "Check Commissioning Mode (_CM)"); + VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; + return FindCommissionableByCommissioningMode(kIdentityAlpha, value); + } + case 84: { + LogStep(84, "TXT key for discriminator (D)"); + VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 85: { + LogStep(85, "If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID is present"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 86: { + LogStep(86, "If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID is present"); + VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 87: { + LogStep( + 87, + "If (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key must be an unsigned integer with units of milliseconds and " + "shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall not exceed 3600000."); + VerifyOrDo(!ShouldSkip("MCORE.SC.SII_OP_DISCOVERY_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 88: { + LogStep( + 88, + "If (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key must be an unsigned integer with units of milliseconds and " + "shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall not exceed 3600000."); + VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 89: { + LogStep(89, "TXT key for commissioning mode (CM), CM=0 may be present"); + VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 90: { + LogStep(90, + "If (MCORE.SC.DT_KEY) present, DT key must contain the device type identifier from Data Model Device Types and " + "must be encoded as a variable length decimal ASCII number without leading zeros"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 91: { + LogStep(91, "If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string with a maximum length of 32B"); + VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 92: { + LogStep(92, + "If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device Identifier encoded as a uppercase " + "string with a maximum length of 100 chars"); + VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 93: { + LogStep(93, + "If (MCORE.SC.PH_KEY) present, key PH must be encoded as a variable-length decimal number in ASCII text, " + "omitting any leading zeros. If present value must be different of 0"); + VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + case 94: { + LogStep( + 94, + "If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 string with a maximum length of 128 bytes"); + VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY && MCORE.SC.EXTENDED_DISCOVERY"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; + return FindCommissionable(kIdentityAlpha, value); + } + } return CHIP_NO_ERROR; } }; @@ -135296,6 +138695,8 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -135353,6 +138754,9 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -135393,6 +138797,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -135634,10 +139039,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index dff6c7bd3e7c71..0eefdf94fa9f36 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -142,6 +142,9 @@ class TestList : public Command { printf("Test_TC_CONTENTLAUNCHER_10_1\n"); printf("Test_TC_WAKEONLAN_4_1\n"); printf("Test_TC_ALOGIN_12_1\n"); + printf("Test_TC_CONTENTLAUNCHER_10_3\n"); + printf("Test_TC_CONTENTLAUNCHER_10_5\n"); + printf("Test_TC_CONTENTLAUNCHER_10_7\n"); printf("Test_TC_MOD_1_1\n"); printf("OTA_SuccessfulTransfer\n"); printf("Test_TC_OCC_1_1\n"); @@ -20724,6 +20727,7 @@ class Test_TC_CC_6_1 : public TestCommandBridge { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) @@ -20913,12 +20917,16 @@ class Test_TC_CC_6_1 : public TestCommandBridge { err = TestTurnOffLightThatWeTurnedOn_19(); break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Check on/off attribute value is false after off command\n"); + ChipLogProgress(chipTool, " ***** Test Step 20 : Wait to turn Off light\n"); + err = TestWaitToTurnOffLight_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Check on/off attribute value is false after off command\n"); if (ShouldSkip("OO.S.A0000")) { NextTest(); return; } - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_20(); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_21(); break; } @@ -20994,6 +21002,9 @@ class Test_TC_CC_6_1 : public TestCommandBridge { case 20: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -21007,11 +21018,12 @@ class Test_TC_CC_6_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; + const uint16_t mTestCount = 22; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigWait; chip::Optional mTimeout; CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() @@ -21383,7 +21395,15 @@ class Test_TC_CC_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_20() + CHIP_ERROR TestWaitToTurnOffLight_20() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_21() { MTRBaseDevice * device = GetDevice("alpha"); @@ -21417,6 +21437,7 @@ class Test_TC_CC_6_5 : public TestCommandBridge { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) @@ -21577,6 +21598,26 @@ class Test_TC_CC_6_5 : public TestCommandBridge { } err = TestThReadsEnhancedColorModeAttributeFromDut_16(); break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Turn Off light that we turned on\n"); + if (ShouldSkip("OO.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestTurnOffLightThatWeTurnedOn_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Wait to turn Off light\n"); + err = TestWaitToTurnOffLight_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Check on/off attribute value is false after off command\n"); + if (ShouldSkip("OO.S.A0000")) { + NextTest(); + return; + } + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_19(); + break; } if (CHIP_NO_ERROR != err) { @@ -21639,6 +21680,15 @@ class Test_TC_CC_6_5 : public TestCommandBridge { case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -21652,11 +21702,12 @@ class Test_TC_CC_6_5 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 17; + const uint16_t mTestCount = 20; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigWait; chip::Optional mTimeout; CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() @@ -21977,6 +22028,55 @@ class Test_TC_CC_6_5 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR TestTurnOffLightThatWeTurnedOn_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletion:^(NSError * _Nullable err) { + NSLog(@"Turn Off light that we turned on Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitToTurnOffLight_18() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; class Test_TC_CC_7_3 : public TestCommandBridge { @@ -31773,6 +31873,7 @@ class Test_TC_FLW_2_1 : public TestCommandBridge { value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; return WaitForCommissionee("alpha", value); } + NSNumber * _Nullable MinMeasuredVariable; CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() { @@ -31792,12 +31893,16 @@ class Test_TC_FLW_2_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 0U)); VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 65533U)); } + { + MinMeasuredVariable = value; + } NextTest(); }]; return CHIP_NO_ERROR; } + NSNumber * _Nullable MaxMeasuredVariable; CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() { @@ -31814,9 +31919,13 @@ class Test_TC_FLW_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], 0U)); + VerifyOrReturn( + CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], MinMeasuredVariable)); VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value unsignedShortValue], 65534U)); } + { + MaxMeasuredVariable = value; + } NextTest(); }]; @@ -31839,8 +31948,8 @@ class Test_TC_FLW_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65535U)); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], MinMeasuredVariable)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], MaxMeasuredVariable)); } NextTest(); @@ -54673,7 +54782,7 @@ class Test_TC_MEDIAPLAYBACK_6_4 : public TestCommandBridge { break; case 14: ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the PlaybackSpeed attribute from the DUT\n"); - if (ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp")) { + if (ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp")) { NextTest(); return; } @@ -54698,7 +54807,7 @@ class Test_TC_MEDIAPLAYBACK_6_4 : public TestCommandBridge { break; case 17: ChipLogProgress(chipTool, " ***** Test Step 17 : Reads the PlaybackSpeed attribute from the DUT\n"); - if (ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp")) { + if (ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp")) { NextTest(); return; } @@ -55120,12 +55229,24 @@ class Test_TC_MEDIAPLAYBACK_6_4 : public TestCommandBridge { CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_14() { - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message - = chip::Span("Please enter 'y' if PlaybackSpeed value is -1garbage: not in length on purpose", 45); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePlaybackSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the PlaybackSpeed attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("PlaybackSpeed", actualValue, -1.0f)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } CHIP_ERROR TestSendsARewindCommandToTheDut_15() @@ -55165,12 +55286,24 @@ class Test_TC_MEDIAPLAYBACK_6_4 : public TestCommandBridge { CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_17() { - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message - = chip::Span("Please enter 'y' if PlaybackSpeed value is -2garbage: not in length on purpose", 45); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePlaybackSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the PlaybackSpeed attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("PlaybackSpeed", actualValue, -2.0f)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } CHIP_ERROR TestSendsAPlayCommand_18() @@ -56739,21 +56872,25 @@ class Test_TC_ALOGIN_12_1 : public TestCommandBridge { } }; -class Test_TC_MOD_1_1 : public TestCommandBridge { +class Test_TC_CONTENTLAUNCHER_10_3 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_MOD_1_1() - : TestCommandBridge("Test_TC_MOD_1_1") + Test_TC_CONTENTLAUNCHER_10_3() + : TestCommandBridge("Test_TC_CONTENTLAUNCHER_10_3") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("data", &mData); + AddArgument("SearchValue", &mSearchValue); + AddArgument("ExternalIdName", &mExternalIdName); + AddArgument("ExternalIdValue", &mExternalIdValue); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_MOD_1_1() {} + ~Test_TC_CONTENTLAUNCHER_10_3() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -56761,11 +56898,11 @@ class Test_TC_MOD_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CONTENTLAUNCHER_10_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CONTENTLAUNCHER_10_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -56782,58 +56919,1861 @@ class Test_TC_MOD_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); - err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); + ChipLogProgress(chipTool, + " ***** Test Step 1 : TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay " + "flag set to false\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithASearchParameterAndStringAndAutoPlayFlagSetToFalse_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the FeatureMap attribute from the DUT\n"); - if (ShouldSkip("MOD.S.F00")) { + ChipLogProgress(chipTool, + " ***** Test Step 2 : Verify that DUT present via its user interface a list of matches based on the provided " + "search criteria.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { NextTest(); return; } - err = TestThReadsTheFeatureMapAttributeFromTheDut_2(); + err = TestVerifyThatDutPresentViaItsUserInterfaceAListOfMatchesBasedOnTheProvidedSearchCriteria_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads the FeatureMap attribute from the DUT\n"); - if (ShouldSkip(" !MOD.S.F00 ")) { + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay " + "flag set to true\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { NextTest(); return; } - err = TestThReadsTheFeatureMapAttributeFromTheDut_3(); + err = TestThSendsALaunchContentCommandToTheDutWithASearchParameterAndStringAndAutoPlayFlagSetToTrue_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads the AttributeList attribute from the DUT\n"); - err = TestThReadsTheAttributeListAttributeFromTheDut_4(); + ChipLogProgress(chipTool, + " ***** Test Step 4 : Verify that DUT should also begin playing content that best matched the given search " + "criteria\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldAlsoBeginPlayingContentThatBestMatchedTheGivenSearchCriteria_4(); break; - case 5: + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mData; + chip::Optional mSearchValue; + chip::Optional mExternalIdName; + chip::Optional mExternalIdValue; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThSendsALaunchContentCommandToTheDutWithASearchParameterAndStringAndAutoPlayFlagSetToFalse_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:0U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = mSearchValue.HasValue() + ? [[NSString alloc] initWithBytes:mSearchValue.Value().data() + length:mSearchValue.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleValue"; + { + NSMutableArray * temp_4 = [[NSMutableArray alloc] init]; + temp_4[0] = [[MTRContentLauncherClusterAdditionalInfoStruct alloc] init]; + ((MTRContentLauncherClusterAdditionalInfoStruct *) temp_4[0]).name = mExternalIdName.HasValue() + ? [[NSString alloc] initWithBytes:mExternalIdName.Value().data() + length:mExternalIdName.Value().size() + encoding:NSUTF8StringEncoding] + : @"name"; + ((MTRContentLauncherClusterAdditionalInfoStruct *) temp_4[0]).value = mExternalIdValue.HasValue() + ? [[NSString alloc] initWithBytes:mExternalIdValue.Value().data() + length:mExternalIdValue.Value().size() + encoding:NSUTF8StringEncoding] + : @"value"; + + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).externalIDList = temp_4; + } + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:false]; + params.data = mData.HasValue() + ? [[NSString alloc] initWithBytes:mData.Value().data() length:mData.Value().size() encoding:NSUTF8StringEncoding] + : @"exampleData"; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay " + @"flag set to false Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.data; + VerifyOrReturn(CheckValueAsString("Data", actualValue, + mData.HasValue() ? [[NSString alloc] initWithBytes:mData.Value().data() + length:mData.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleData")); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutPresentViaItsUserInterfaceAListOfMatchesBasedOnTheProvidedSearchCriteria_2() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' if DUT present via its user interface a list of matches based on " + "the provided search criteria.garbage: not in length on purpose", + 111); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestThSendsALaunchContentCommandToTheDutWithASearchParameterAndStringAndAutoPlayFlagSetToTrue_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:0U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = mSearchValue.HasValue() + ? [[NSString alloc] initWithBytes:mSearchValue.Value().data() + length:mSearchValue.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleValue"; + { + NSMutableArray * temp_4 = [[NSMutableArray alloc] init]; + temp_4[0] = [[MTRContentLauncherClusterAdditionalInfoStruct alloc] init]; + ((MTRContentLauncherClusterAdditionalInfoStruct *) temp_4[0]).name = mExternalIdName.HasValue() + ? [[NSString alloc] initWithBytes:mExternalIdName.Value().data() + length:mExternalIdName.Value().size() + encoding:NSUTF8StringEncoding] + : @"name"; + ((MTRContentLauncherClusterAdditionalInfoStruct *) temp_4[0]).value = mExternalIdValue.HasValue() + ? [[NSString alloc] initWithBytes:mExternalIdValue.Value().data() + length:mExternalIdValue.Value().size() + encoding:NSUTF8StringEncoding] + : @"value"; + + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).externalIDList = temp_4; + } + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + params.data = mData.HasValue() + ? [[NSString alloc] initWithBytes:mData.Value().data() length:mData.Value().size() encoding:NSUTF8StringEncoding] + : @"exampleData"; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay " + @"flag set to true Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.data; + VerifyOrReturn(CheckValueAsString("Data", actualValue, + mData.HasValue() ? [[NSString alloc] initWithBytes:mData.Value().data() + length:mData.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleData")); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldAlsoBeginPlayingContentThatBestMatchedTheGivenSearchCriteria_4() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' if DUT begin playing content that best matched the given search " + "criteriagarbage: not in length on purpose", + 89); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } +}; + +class Test_TC_CONTENTLAUNCHER_10_5 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_CONTENTLAUNCHER_10_5() + : TestCommandBridge("Test_TC_CONTENTLAUNCHER_10_5") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("GoodURL", &mGoodURL); + AddArgument("BadURL", &mBadURL); + AddArgument("UnauthorizedURL", &mUnauthorizedURL); + AddArgument("DisplayContent", &mDisplayContent); + AddArgument("providerNameString", &mProviderNameString); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_CONTENTLAUNCHER_10_5() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CONTENTLAUNCHER_10_5\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CONTENTLAUNCHER_10_5\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: ChipLogProgress( - chipTool, " ***** Test Step 5 : TH reads the optional attribute(StartUpMode) in AttributeList from the DUT\n"); - if (ShouldSkip("MOD.S.A0004")) { + chipTool, " ***** Test Step 1 : TH sends a LaunchURL command to the DUT with a known good content URL string\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp")) { NextTest(); return; } - err = TestThReadsTheOptionalAttributeStartUpModeInAttributeListFromTheDut_5(); + err = TestThSendsALaunchURLCommandToTheDutWithAKnownGoodContentUrlString_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Verify that DUT launched the content at the given URL\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutLaunchedTheContentAtTheGivenUrl_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends a LaunchURL command to the DUT with a known good content URL string and a display " + "string\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchURLCommandToTheDutWithAKnownGoodContentUrlStringAndADisplayString_3(); + break; + case 4: + ChipLogProgress(chipTool, + " ***** Test Step 4 : Verify that DUT launched the content at the given URL with the given display string in the " + "application-specific description area\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutLaunchedTheContentAtTheGivenUrlWithTheGivenDisplayStringInTheApplicationSpecificDescriptionArea_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends a LaunchURL command to the DUT with a known good content URL string and a brand " + "information object.\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchURLCommandToTheDutWithAKnownGoodContentUrlStringAndABrandInformationObject_5(); break; case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : TH reads the optional attribute(OnMode) in AttributeList from the DUT\n"); - if (ShouldSkip("MOD.S.A0005")) { + ChipLogProgress(chipTool, + " ***** Test Step 6 : Verify that DUT launched the content at the given URL with the player interface updated as " + "per the provided branding information\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { NextTest(); return; } - err = TestThReadsTheOptionalAttributeOnModeInAttributeListFromTheDut_6(); + err = TestVerifyThatDutLaunchedTheContentAtTheGivenUrlWithThePlayerInterfaceUpdatedAsPerTheProvidedBrandingInformation_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: EventList\n"); - NextTest(); - return; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + ChipLogProgress(chipTool, + " ***** Test Step 7 : TH sends a LaunchURL command to the DUT with a known unreachable content URL string.\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchURLCommandToTheDutWithAKnownUnreachableContentUrlString_7(); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_9(); + case 8: + ChipLogProgress(chipTool, + " ***** Test Step 8 : TH sends a LaunchURL command to the DUT with a known un-authorized content URL string.\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchURLCommandToTheDutWithAKnownUnAuthorizedContentUrlString_8(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 9; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mGoodURL; + chip::Optional mBadURL; + chip::Optional mUnauthorizedURL; + chip::Optional mDisplayContent; + chip::Optional mProviderNameString; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThSendsALaunchURLCommandToTheDutWithAKnownGoodContentUrlString_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchURLParams alloc] init]; + params.contentURL = mGoodURL.HasValue() + ? [[NSString alloc] initWithBytes:mGoodURL.Value().data() length:mGoodURL.Value().size() encoding:NSUTF8StringEncoding] + : @"https://csa-iot.org/"; + params.brandingInformation = [[MTRContentLauncherClusterBrandingInformationStruct alloc] init]; + ((MTRContentLauncherClusterBrandingInformationStruct *) params.brandingInformation).providerName + = mProviderNameString.HasValue() ? [[NSString alloc] initWithBytes:mProviderNameString.Value().data() + length:mProviderNameString.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleName"; + + [cluster + launchURLWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchURL command to the DUT with a known good content URL string Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutLaunchedTheContentAtTheGivenUrl_2() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT launched the content at the given URLgarbage: not in length on purpose", 61); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestThSendsALaunchURLCommandToTheDutWithAKnownGoodContentUrlStringAndADisplayString_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchURLParams alloc] init]; + params.contentURL = mGoodURL.HasValue() + ? [[NSString alloc] initWithBytes:mGoodURL.Value().data() length:mGoodURL.Value().size() encoding:NSUTF8StringEncoding] + : @"https://csa-iot.org/"; + params.displayString = mDisplayContent.HasValue() ? [[NSString alloc] initWithBytes:mDisplayContent.Value().data() + length:mDisplayContent.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleData"; + params.brandingInformation = [[MTRContentLauncherClusterBrandingInformationStruct alloc] init]; + ((MTRContentLauncherClusterBrandingInformationStruct *) params.brandingInformation).providerName + = mProviderNameString.HasValue() ? [[NSString alloc] initWithBytes:mProviderNameString.Value().data() + length:mProviderNameString.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleName"; + + [cluster + launchURLWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchURL command to the DUT with a known good content URL string and a display string " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.data; + VerifyOrReturn(CheckValueAsString("Data", actualValue, + mDisplayContent.HasValue() ? [[NSString alloc] initWithBytes:mDisplayContent.Value().data() + length:mDisplayContent.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleData")); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutLaunchedTheContentAtTheGivenUrlWithTheGivenDisplayStringInTheApplicationSpecificDescriptionArea_4() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message + = chip::Span("Please enter 'y' if DUT launched the content at the given URL with the given display string " + "in the application-specific description areagarbage: not in length on purpose", + 136); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestThSendsALaunchURLCommandToTheDutWithAKnownGoodContentUrlStringAndABrandInformationObject_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchURLParams alloc] init]; + params.contentURL = mGoodURL.HasValue() + ? [[NSString alloc] initWithBytes:mGoodURL.Value().data() length:mGoodURL.Value().size() encoding:NSUTF8StringEncoding] + : @"https://csa-iot.org/"; + params.brandingInformation = [[MTRContentLauncherClusterBrandingInformationStruct alloc] init]; + ((MTRContentLauncherClusterBrandingInformationStruct *) params.brandingInformation).providerName + = mProviderNameString.HasValue() ? [[NSString alloc] initWithBytes:mProviderNameString.Value().data() + length:mProviderNameString.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleName"; + + [cluster + launchURLWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchURL command to the DUT with a known good content URL string and a brand " + @"information object. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutLaunchedTheContentAtTheGivenUrlWithThePlayerInterfaceUpdatedAsPerTheProvidedBrandingInformation_6() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message + = chip::Span("Please enter 'y' if DUT launched the content at the given URL with the player interface " + "updated as per the provided branding informationgarbage: not in length on purpose", + 136); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestThSendsALaunchURLCommandToTheDutWithAKnownUnreachableContentUrlString_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchURLParams alloc] init]; + params.contentURL = mBadURL.HasValue() + ? [[NSString alloc] initWithBytes:mBadURL.Value().data() length:mBadURL.Value().size() encoding:NSUTF8StringEncoding] + : @"https://badurl"; + params.brandingInformation = [[MTRContentLauncherClusterBrandingInformationStruct alloc] init]; + ((MTRContentLauncherClusterBrandingInformationStruct *) params.brandingInformation).providerName + = mProviderNameString.HasValue() ? [[NSString alloc] initWithBytes:mProviderNameString.Value().data() + length:mProviderNameString.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleName"; + + [cluster + launchURLWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchURL command to the DUT with a known unreachable content URL string. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsALaunchURLCommandToTheDutWithAKnownUnAuthorizedContentUrlString_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchURLParams alloc] init]; + params.contentURL = mUnauthorizedURL.HasValue() ? [[NSString alloc] initWithBytes:mUnauthorizedURL.Value().data() + length:mUnauthorizedURL.Value().size() + encoding:NSUTF8StringEncoding] + : @"https://csa-iot.org/badauth"; + params.brandingInformation = [[MTRContentLauncherClusterBrandingInformationStruct alloc] init]; + ((MTRContentLauncherClusterBrandingInformationStruct *) params.brandingInformation).providerName + = mProviderNameString.HasValue() ? [[NSString alloc] initWithBytes:mProviderNameString.Value().data() + length:mProviderNameString.Value().size() + encoding:NSUTF8StringEncoding] + : @"exampleName"; + + [cluster + launchURLWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchURL command to the DUT with a known un-authorized content URL string. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 2U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CONTENTLAUNCHER_10_7 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_CONTENTLAUNCHER_10_7() + : TestCommandBridge("Test_TC_CONTENTLAUNCHER_10_7") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("PopularityName", &mPopularityName); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_CONTENTLAUNCHER_10_7() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CONTENTLAUNCHER_10_7\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CONTENTLAUNCHER_10_7\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Actor and Value as An Actor’s name, for example, Gaby sHoffman\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsActorAndValueAsAnActorsNameForExampleGabySHoffman_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Channel and Value as Channel Name name, for example, PBS\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsChannelAndValueAsChannelNameNameForExamplePbs_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Character and Value as Character’s name,for example,Snow White\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsCharacterAndValueAsCharactersNameforExampleSnowWhite_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Director and Value as Director’s name, for example, Spike Lee\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsDirectorAndValueAsDirectorsNameForExampleSpikeLee_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Event and Value as An Event’s name , for example Football games\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsEventAndValueAsAnEventsNameForExampleFootballGames_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Franchise and Value as Franchise’s name,for example Star Wars\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsFranchiseAndValueAsFranchisesNameforExampleStarWars_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Genre and Value as Genre’s name, for example Horror\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsGenreAndValueAsGenresNameForExampleHorror_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_14(); + break; + case 15: + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "League and Value as League’s name, for example NCAA\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsLeagueAndValueAsLeaguesNameForExampleNcaa_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Popularity and Value as Popularity’s name\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsPopularityAndValueAsPopularitysName_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Provider and Value as Provider’s name, for example Netflix\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsProviderAndValueAsProvidersNameForExampleNetflix_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Sport and Value as Sport’s name, for example, football\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsSportAndValueAsSportsNameForExampleFootball_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_22(); + break; + case 23: + ChipLogProgress(chipTool, + " ***** Test Step 23 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "SportsTeam and Value as SportTeam’s name , for example Arsenel\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsSportsTeamAndValueAsSportTeamsNameForExampleArsenel_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_24(); + break; + case 25: + ChipLogProgress(chipTool, + " ***** Test Step 25 : TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + "Type and Value as Type’s name, for example TVSeries\n"); + if (ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsTypeAndValueAsTypesNameForExampleTVSeries_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Verify that DUT should play or display the search result.\n"); + if (ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_26(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 27; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mPopularityName; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsActorAndValueAsAnActorsNameForExampleGabySHoffman_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:0U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"Gaby sHoffman"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Actor " + @"and Value as An Actor’s name, for example, Gaby sHoffman Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_2() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsChannelAndValueAsChannelNameNameForExamplePbs_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:1U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"PBS"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + @"Channel and Value as Channel Name name, for example, PBS Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_4() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsCharacterAndValueAsCharactersNameforExampleSnowWhite_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:2U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"Snow White"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:false]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + @"Character and Value as Character’s name,for example,Snow White Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_6() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsDirectorAndValueAsDirectorsNameForExampleSpikeLee_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:3U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"Spike Lee"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + @"Director and Value as Director’s name, for example, Spike Lee Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_8() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsEventAndValueAsAnEventsNameForExampleFootballGames_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:4U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"Football games"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Event " + @"and Value as An Event’s name , for example Football games Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_10() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsFranchiseAndValueAsFranchisesNameforExampleStarWars_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:5U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"Star Wars"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + @"Franchise and Value as Franchise’s name,for example Star Wars Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_12() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsGenreAndValueAsGenresNameForExampleHorror_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:6U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"Horror"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Genre " + @"and Value as Genre’s name, for example Horror Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_14() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsLeagueAndValueAsLeaguesNameForExampleNcaa_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:7U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"NCAA"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + @"League and Value as League’s name, for example NCAA Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_16() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsPopularityAndValueAsPopularitysName_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:8U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = mPopularityName.HasValue() + ? [[NSString alloc] initWithBytes:mPopularityName.Value().data() + length:mPopularityName.Value().size() + encoding:NSUTF8StringEncoding] + : @"popular content"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + @"Popularity and Value as Popularity’s name Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_18() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsProviderAndValueAsProvidersNameForExampleNetflix_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:9U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"Netflix"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + @"Provider and Value as Provider’s name, for example Netflix Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_20() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsSportAndValueAsSportsNameForExampleFootball_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:10U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"football"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Sport " + @"and Value as Sport’s name, for example, football Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_22() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsSportsTeamAndValueAsSportTeamsNameForExampleArsenel_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:11U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"Arsenel"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As " + @"SportsTeam and Value as SportTeam’s name , for example Arsenel Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_24() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsALaunchContentCommandToTheDutWithSearchParameterConsistingOfTypeAsTypeAndValueAsTypesNameForExampleTVSeries_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; + params.search = [[MTRContentLauncherClusterContentSearchStruct alloc] init]; + { + NSMutableArray * temp_1 = [[NSMutableArray alloc] init]; + temp_1[0] = [[MTRContentLauncherClusterParameterStruct alloc] init]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).type = [NSNumber numberWithUnsignedChar:12U]; + ((MTRContentLauncherClusterParameterStruct *) temp_1[0]).value = @"TVSeries"; + + ((MTRContentLauncherClusterContentSearchStruct *) params.search).parameterList = temp_1; + } + + params.autoPlay = [NSNumber numberWithBool:true]; + [cluster + launchContentWithParams:params + completion:^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Type " + @"and Value as Type’s name, for example TVSeries Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyThatDutShouldPlayOrDisplayTheSearchResult_26() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span( + "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } +}; + +class Test_TC_MOD_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_MOD_1_1() + : TestCommandBridge("Test_TC_MOD_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_MOD_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); + err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the FeatureMap attribute from the DUT\n"); + if (ShouldSkip("MOD.S.F00")) { + NextTest(); + return; + } + err = TestThReadsTheFeatureMapAttributeFromTheDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads the FeatureMap attribute from the DUT\n"); + if (ShouldSkip(" !MOD.S.F00 ")) { + NextTest(); + return; + } + err = TestThReadsTheFeatureMapAttributeFromTheDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads the AttributeList attribute from the DUT\n"); + err = TestThReadsTheAttributeListAttributeFromTheDut_4(); + break; + case 5: + ChipLogProgress( + chipTool, " ***** Test Step 5 : TH reads the optional attribute(StartUpMode) in AttributeList from the DUT\n"); + if (ShouldSkip("MOD.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsTheOptionalAttributeStartUpModeInAttributeListFromTheDut_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : TH reads the optional attribute(OnMode) in AttributeList from the DUT\n"); + if (ShouldSkip("MOD.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsTheOptionalAttributeOnModeInAttributeListFromTheDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: EventList\n"); + NextTest(); + return; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_9(); break; } @@ -62950,8 +64890,8 @@ class Test_TC_PRS_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -32768)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32767)); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -32767)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32766)); } { MinMeasuredValue = value; @@ -62981,7 +64921,7 @@ class Test_TC_PRS_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], -32768)); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], MinMeasuredValue)); VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value shortValue], 32767)); } { @@ -63063,8 +65003,8 @@ class Test_TC_PRS_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("minScaledValue", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("minScaledValue", [value shortValue], -32768)); - VerifyOrReturn(CheckConstraintMaxValue("minScaledValue", [value shortValue], 32767)); + VerifyOrReturn(CheckConstraintMinValue("minScaledValue", [value shortValue], -32767)); + VerifyOrReturn(CheckConstraintMaxValue("minScaledValue", [value shortValue], 32766)); } { MinScaledValue = value; @@ -63094,7 +65034,7 @@ class Test_TC_PRS_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("maxScaledValue", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("maxScaledValue", [value shortValue], -32768)); + VerifyOrReturn(CheckConstraintMinValue("maxScaledValue", [value shortValue], MinScaledValue)); VerifyOrReturn(CheckConstraintMaxValue("maxScaledValue", [value shortValue], 32767)); } { @@ -67928,6 +69868,7 @@ class Test_TC_RH_2_1 : public TestCommandBridge { value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; return WaitForCommissionee("alpha", value); } + NSNumber * _Nullable CurrentMinMeasured; CHIP_ERROR TestThReadsTheMinMeasuredValueAttributeFromTheDut_1() { @@ -67949,12 +69890,16 @@ class Test_TC_RH_2_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 0U)); VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 9999U)); } + { + CurrentMinMeasured = value; + } NextTest(); }]; return CHIP_NO_ERROR; } + NSNumber * _Nullable CurrentMaxMeasured; CHIP_ERROR TestThReadsTheMaxMeasuredValueAttributeFromTheDut_2() { @@ -67973,9 +69918,13 @@ class Test_TC_RH_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], 1U)); + VerifyOrReturn( + CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], CurrentMinMeasured)); VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value unsignedShortValue], 10000U)); } + { + CurrentMaxMeasured = value; + } NextTest(); }]; @@ -68000,8 +69949,8 @@ class Test_TC_RH_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 10000U)); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], CurrentMinMeasured)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], CurrentMaxMeasured)); } NextTest(); @@ -70096,7 +72045,7 @@ class Test_TC_TMP_2_1 : public TestCommandBridge { value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; return WaitForCommissionee("alpha", value); } - NSNumber * _Nullable MinMeasuredValue; + NSNumber * _Nullable CurrentMinMeasured; CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() { @@ -70116,10 +72065,10 @@ class Test_TC_TMP_2_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16s", "int16s")); VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -27315)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32767)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32766)); } { - MinMeasuredValue = value; + CurrentMinMeasured = value; } NextTest(); @@ -70127,7 +72076,7 @@ class Test_TC_TMP_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - NSNumber * _Nullable MaxMeasuredValue; + NSNumber * _Nullable CurrentMaxMeasured; CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() { @@ -70146,11 +72095,11 @@ class Test_TC_TMP_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], -27314)); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], CurrentMinMeasured)); VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value shortValue], 32767)); } { - MaxMeasuredValue = value; + CurrentMaxMeasured = value; } NextTest(); @@ -70176,8 +72125,8 @@ class Test_TC_TMP_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintType("measuredValue", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value shortValue], MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value shortValue], MaxMeasuredValue)); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value shortValue], CurrentMinMeasured)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value shortValue], CurrentMaxMeasured)); } NextTest(); @@ -147939,6 +149888,9 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), From 6f8d60271f2bb2528d2183c8651cc701c5982ad8 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 11 Jul 2023 16:36:26 -0400 Subject: [PATCH 27/34] Improve chip-tool help for "synthetic" clusters. (#27665) * Improve chip-tool help for "synthetic" clusters. 1. Makes it clear which things are actual clusters and which are command sets. 2. Makes sure all command sets have overall help text that describes what the commands in the set do. 3. Adds some help text to some specific commands. * Address review comment. * Address review comments. --- .../commands/clusters/SubscriptionsCommands.h | 2 +- .../chip-tool/commands/common/Commands.cpp | 88 ++++-- examples/chip-tool/commands/common/Commands.h | 33 ++- examples/chip-tool/commands/delay/Commands.h | 2 +- .../delay/WaitForCommissioneeCommand.h | 4 +- .../chip-tool/commands/discover/Commands.h | 2 +- examples/chip-tool/commands/group/Commands.h | 3 +- .../chip-tool/commands/interactive/Commands.h | 2 +- .../interactive/InteractiveCommands.h | 12 +- .../chip-tool/commands/pairing/Commands.h | 2 +- .../chip-tool/commands/payload/Commands.h | 2 +- .../commands/session-management/Commands.h | 2 +- .../chip-tool/commands/storage/Commands.h | 2 +- examples/chip-tool/templates/commands.zapt | 4 +- .../chip-tool/templates/tests/commands.zapt | 2 +- .../commands/discover/Commands.h | 2 +- .../commands/interactive/Commands.h | 2 +- .../commands/pairing/Commands.h | 2 +- .../commands/payload/Commands.h | 2 +- .../commands/provider/Commands.h | 2 +- .../commands/storage/Commands.h | 3 +- .../templates/commands.zapt | 4 +- .../templates/tests/commands.zapt | 2 +- .../zap-generated/cluster/Commands.h | 269 +++++++++--------- .../chip-tool/zap-generated/test/Commands.h | 2 +- .../zap-generated/cluster/Commands.h | 133 ++++----- .../zap-generated/test/Commands.h | 2 +- 27 files changed, 321 insertions(+), 266 deletions(-) diff --git a/examples/chip-tool/commands/clusters/SubscriptionsCommands.h b/examples/chip-tool/commands/clusters/SubscriptionsCommands.h index 1a95949b48c615..cc0daaf7d83398 100644 --- a/examples/chip-tool/commands/clusters/SubscriptionsCommands.h +++ b/examples/chip-tool/commands/clusters/SubscriptionsCommands.h @@ -104,5 +104,5 @@ void registerCommandsSubscriptions(Commands & commands, CredentialIssuerCommands make_unique(credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands, "Commands for shutting down subscriptions."); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for shutting down subscriptions."); } diff --git a/examples/chip-tool/commands/common/Commands.cpp b/examples/chip-tool/commands/common/Commands.cpp index eef7d8ccb39174..c2f49c236738b5 100644 --- a/examples/chip-tool/commands/common/Commands.cpp +++ b/examples/chip-tool/commands/common/Commands.cpp @@ -119,12 +119,14 @@ static void DetectAndLogMismatchedDoubleQuotes(int argc, char ** argv) } // namespace -void Commands::Register(const char * clusterName, commands_list commandsList, const char * helpText) +void Commands::Register(const char * commandSetName, commands_list commandsList, const char * helpText, bool isCluster) { - mClusters[clusterName].second = helpText; + VerifyOrDieWithMsg(isCluster || helpText != nullptr, chipTool, "Non-cluster command sets must have help text"); + mCommandSets[commandSetName].isCluster = isCluster; + mCommandSets[commandSetName].helpText = helpText; for (auto & command : commandsList) { - mClusters[clusterName].first.push_back(std::move(command)); + mCommandSets[commandSetName].commands.push_back(std::move(command)); } } @@ -192,26 +194,26 @@ CHIP_ERROR Commands::RunCommand(int argc, char ** argv, bool interactive, if (argc <= 1) { - ChipLogError(chipTool, "Missing cluster name"); - ShowClusters(argv[0]); + ChipLogError(chipTool, "Missing cluster or command set name"); + ShowCommandSets(argv[0]); return CHIP_ERROR_INVALID_ARGUMENT; } - auto clusterIter = GetCluster(argv[1]); - if (clusterIter == mClusters.end()) + auto commandSetIter = GetCommandSet(argv[1]); + if (commandSetIter == mCommandSets.end()) { - ChipLogError(chipTool, "Unknown cluster: %s", argv[1]); - ShowClusters(argv[0]); + ChipLogError(chipTool, "Unknown cluster or command set: %s", argv[1]); + ShowCommandSets(argv[0]); return CHIP_ERROR_INVALID_ARGUMENT; } - auto & commandList = clusterIter->second.first; - auto * clusterHelp = clusterIter->second.second; + auto & commandList = commandSetIter->second.commands; + auto * helpText = commandSetIter->second.helpText; if (argc <= 2) { ChipLogError(chipTool, "Missing command name"); - ShowCluster(argv[0], argv[1], commandList, clusterHelp); + ShowCommandSet(argv[0], argv[1], commandList, helpText); return CHIP_ERROR_INVALID_ARGUMENT; } @@ -222,7 +224,7 @@ CHIP_ERROR Commands::RunCommand(int argc, char ** argv, bool interactive, if (command == nullptr) { ChipLogError(chipTool, "Unknown command: %s", argv[2]); - ShowCluster(argv[0], argv[1], commandList, clusterHelp); + ShowCommandSet(argv[0], argv[1], commandList, helpText); return CHIP_ERROR_INVALID_ARGUMENT; } } @@ -293,19 +295,19 @@ CHIP_ERROR Commands::RunCommand(int argc, char ** argv, bool interactive, return command->Run(); } -Commands::ClusterMap::iterator Commands::GetCluster(std::string clusterName) +Commands::CommandSetMap::iterator Commands::GetCommandSet(std::string commandSetName) { - for (auto & cluster : mClusters) + for (auto & commandSet : mCommandSets) { - std::string key(cluster.first); + std::string key(commandSet.first); std::transform(key.begin(), key.end(), key.begin(), ::tolower); - if (key.compare(clusterName) == 0) + if (key.compare(commandSetName) == 0) { - return mClusters.find(cluster.first); + return mCommandSets.find(commandSet.first); } } - return mClusters.end(); + return mCommandSets.end(); } Command * Commands::GetCommand(CommandsVector & commands, std::string commandName) @@ -350,29 +352,53 @@ bool Commands::IsGlobalCommand(std::string commandName) const return IsAttributeCommand(commandName) || IsEventCommand(commandName); } -void Commands::ShowClusters(std::string executable) +void Commands::ShowCommandSetOverview(std::string commandSetName, const CommandSet & commandSet) +{ + std::transform(commandSetName.begin(), commandSetName.end(), commandSetName.begin(), + [](unsigned char c) { return std::tolower(c); }); + fprintf(stderr, " | * %-82s|\n", commandSetName.c_str()); + ShowHelpText(commandSet.helpText); +} + +void Commands::ShowCommandSets(std::string executable) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s cluster_name command_name [param1 param2 ...]\n", executable.c_str()); + fprintf(stderr, "or:\n"); + fprintf(stderr, " %s command_set_name command_name [param1 param2 ...]\n", executable.c_str()); fprintf(stderr, "\n"); + // Table of clusters fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); fprintf(stderr, " | Clusters: |\n"); fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); - for (auto & cluster : mClusters) + for (auto & commandSet : mCommandSets) + { + if (commandSet.second.isCluster) + { + ShowCommandSetOverview(commandSet.first, commandSet.second); + } + } + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + fprintf(stderr, "\n"); + + // Table of command sets + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + fprintf(stderr, " | Command sets: |\n"); + fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); + for (auto & commandSet : mCommandSets) { - std::string clusterName(cluster.first); - std::transform(clusterName.begin(), clusterName.end(), clusterName.begin(), - [](unsigned char c) { return std::tolower(c); }); - fprintf(stderr, " | * %-82s|\n", clusterName.c_str()); - ShowHelpText(cluster.second.second); + if (!commandSet.second.isCluster) + { + ShowCommandSetOverview(commandSet.first, commandSet.second); + } } fprintf(stderr, " +-------------------------------------------------------------------------------------+\n"); } -void Commands::ShowCluster(std::string executable, std::string clusterName, CommandsVector & commands, const char * helpText) +void Commands::ShowCommandSet(std::string executable, std::string commandSetName, CommandsVector & commands, const char * helpText) { fprintf(stderr, "Usage:\n"); - fprintf(stderr, " %s %s command_name [param1 param2 ...]\n", executable.c_str(), clusterName.c_str()); + fprintf(stderr, " %s %s command_name [param1 param2 ...]\n", executable.c_str(), commandSetName.c_str()); if (helpText) { @@ -554,11 +580,11 @@ bool Commands::DecodeArgumentsFromBase64EncodedJson(const char * json, std::vect auto commandName = jsonValue[kJsonCommandKey].asString(); auto arguments = jsonValue[kJsonArgumentsKey].asString(); - auto clusterIter = GetCluster(clusterName); - VerifyOrReturnValue(clusterIter != mClusters.end(), false, + auto clusterIter = GetCommandSet(clusterName); + VerifyOrReturnValue(clusterIter != mCommandSets.end(), false, ChipLogError(chipTool, "Cluster '%s' is not supported.", clusterName.c_str())); - auto & commandList = clusterIter->second.first; + auto & commandList = clusterIter->second.commands; auto command = GetCommand(commandList, commandName); diff --git a/examples/chip-tool/commands/common/Commands.h b/examples/chip-tool/commands/common/Commands.h index f9ba9f739ae140..67c23b401c4147 100644 --- a/examples/chip-tool/commands/common/Commands.h +++ b/examples/chip-tool/commands/common/Commands.h @@ -30,25 +30,44 @@ class Commands public: using CommandsVector = ::std::vector>; - void Register(const char * clusterName, commands_list commandsList, const char * helpText = nullptr); + void RegisterCluster(const char * clusterName, commands_list commandsList) + { + Register(clusterName, commandsList, nullptr, true); + } + // Command sets represent chip-tool functionality that is not actually + // XML-defined clusters. All command sets should have help text explaining + // what sort of commands one should expect to find in the set. + void RegisterCommandSet(const char * commandSetName, commands_list commandsList, const char * helpText) + { + Register(commandSetName, commandsList, helpText, false); + } int Run(int argc, char ** argv); int RunInteractive(const char * command, const chip::Optional & storageDirectory = chip::NullOptional); private: - using ClusterMap = std::map>; + struct CommandSet + { + CommandsVector commands; + bool isCluster = false; + const char * helpText = nullptr; + }; + // The tuple contains the commands, whether it's a synthetic cluster, and + // the help text for the cluster (which may be null). + using CommandSetMap = std::map; CHIP_ERROR RunCommand(int argc, char ** argv, bool interactive = false, const chip::Optional & interactiveStorageDirectory = chip::NullOptional); - ClusterMap::iterator GetCluster(std::string clusterName); + CommandSetMap::iterator GetCommandSet(std::string commandSetName); Command * GetCommand(CommandsVector & commands, std::string commandName); Command * GetGlobalCommand(CommandsVector & commands, std::string commandName, std::string attributeName); bool IsAttributeCommand(std::string commandName) const; bool IsEventCommand(std::string commandName) const; bool IsGlobalCommand(std::string commandName) const; - void ShowClusters(std::string executable); - void ShowCluster(std::string executable, std::string clusterName, CommandsVector & commands, const char * helpText); + void ShowCommandSets(std::string executable); + static void ShowCommandSetOverview(std::string commandSetName, const CommandSet & commandSet); + void ShowCommandSet(std::string executable, std::string commandSetName, CommandsVector & commands, const char * helpText); void ShowClusterAttributes(std::string executable, std::string clusterName, std::string commandName, CommandsVector & commands); void ShowClusterEvents(std::string executable, std::string clusterName, std::string commandName, CommandsVector & commands); void ShowCommand(std::string executable, std::string clusterName, Command * command); @@ -60,7 +79,9 @@ class Commands // helpText may be null, in which case it's not shown. static void ShowHelpText(const char * helpText); - ClusterMap mClusters; + void Register(const char * commandSetName, commands_list commandsList, const char * helpText, bool isCluster); + + CommandSetMap mCommandSets; #ifdef CONFIG_USE_LOCAL_STORAGE PersistentStorage mStorage; #endif // CONFIG_USE_LOCAL_STORAGE diff --git a/examples/chip-tool/commands/delay/Commands.h b/examples/chip-tool/commands/delay/Commands.h index f14b4bd435e72c..4d2dd2941ea259 100644 --- a/examples/chip-tool/commands/delay/Commands.h +++ b/examples/chip-tool/commands/delay/Commands.h @@ -30,5 +30,5 @@ void registerCommandsDelay(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for waiting for something to happen."); } diff --git a/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.h b/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.h index 830a738dcc1ef5..482d996a54a0d9 100644 --- a/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.h +++ b/examples/chip-tool/commands/delay/WaitForCommissioneeCommand.h @@ -26,8 +26,8 @@ class WaitForCommissioneeCommand : public CHIPCommand { public: WaitForCommissioneeCommand(CredentialIssuerCommands * credIssuerCommands) : - CHIPCommand("wait-for-commissionee", credIssuerCommands), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), - mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this) + CHIPCommand("wait-for-commissionee", credIssuerCommands, "Establish a CASE session to the provided node id."), + mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("expire-existing-session", 0, 1, &mExpireExistingSession); diff --git a/examples/chip-tool/commands/discover/Commands.h b/examples/chip-tool/commands/discover/Commands.h index e2a2209d2fc83c..1b3f45ac75168c 100644 --- a/examples/chip-tool/commands/discover/Commands.h +++ b/examples/chip-tool/commands/discover/Commands.h @@ -85,5 +85,5 @@ void registerCommandsDiscover(Commands & commands, CredentialIssuerCommands * cr make_unique(credsIssuerConfig), }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for device discovery."); } diff --git a/examples/chip-tool/commands/group/Commands.h b/examples/chip-tool/commands/group/Commands.h index b66d62dccf5171..b29ff959ede832 100644 --- a/examples/chip-tool/commands/group/Commands.h +++ b/examples/chip-tool/commands/group/Commands.h @@ -358,5 +358,6 @@ void registerCommandsGroup(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, + "Commands for manipulating group keys and memberships for chip-tool itself."); } diff --git a/examples/chip-tool/commands/interactive/Commands.h b/examples/chip-tool/commands/interactive/Commands.h index 747c8aeaa418d9..188f3c0f3df871 100644 --- a/examples/chip-tool/commands/interactive/Commands.h +++ b/examples/chip-tool/commands/interactive/Commands.h @@ -33,5 +33,5 @@ void registerCommandsInteractive(Commands & commands, CredentialIssuerCommands * #endif // CONFIG_USE_INTERACTIVE_MODE }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for starting long-lived interactive modes."); } diff --git a/examples/chip-tool/commands/interactive/InteractiveCommands.h b/examples/chip-tool/commands/interactive/InteractiveCommands.h index 0b4ead9f9cbbf5..85cc53c92b487a 100644 --- a/examples/chip-tool/commands/interactive/InteractiveCommands.h +++ b/examples/chip-tool/commands/interactive/InteractiveCommands.h @@ -29,8 +29,10 @@ class Commands; class InteractiveCommand : public CHIPCommand { public: - InteractiveCommand(const char * name, Commands * commandsHandler, CredentialIssuerCommands * credsIssuerConfig) : - CHIPCommand(name, credsIssuerConfig), mHandler(commandsHandler) + InteractiveCommand(const char * name, Commands * commandsHandler, const char * helpText, + CredentialIssuerCommands * credsIssuerConfig) : + CHIPCommand(name, credsIssuerConfig, helpText), + mHandler(commandsHandler) { AddArgument("advertise-operational", 0, 1, &mAdvertiseOperational, "Advertise operational node over DNS-SD and accept incoming CASE sessions."); @@ -51,7 +53,8 @@ class InteractiveStartCommand : public InteractiveCommand { public: InteractiveStartCommand(Commands * commandsHandler, CredentialIssuerCommands * credsIssuerConfig) : - InteractiveCommand("start", commandsHandler, credsIssuerConfig) + InteractiveCommand("start", commandsHandler, "Start an interactive shell that can then run other commands.", + credsIssuerConfig) {} /////////// CHIPCommand Interface ///////// @@ -62,7 +65,8 @@ class InteractiveServerCommand : public InteractiveCommand, public WebSocketServ { public: InteractiveServerCommand(Commands * commandsHandler, CredentialIssuerCommands * credsIssuerConfig) : - InteractiveCommand("server", commandsHandler, credsIssuerConfig) + InteractiveCommand("server", commandsHandler, "Start a websocket server that can receive commands sent by another process.", + credsIssuerConfig) { AddArgument("port", 0, UINT16_MAX, &mPort, "Port the websocket will listen to. Defaults to 9002."); } diff --git a/examples/chip-tool/commands/pairing/Commands.h b/examples/chip-tool/commands/pairing/Commands.h index 6d02253c13de92..388dc4741ffe30 100644 --- a/examples/chip-tool/commands/pairing/Commands.h +++ b/examples/chip-tool/commands/pairing/Commands.h @@ -255,5 +255,5 @@ void registerCommandsPairing(Commands & commands, CredentialIssuerCommands * cre make_unique(credsIssuerConfig), }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for commissioning devices."); } diff --git a/examples/chip-tool/commands/payload/Commands.h b/examples/chip-tool/commands/payload/Commands.h index 0cc5cae0a0879c..7f10e831b2ac9e 100644 --- a/examples/chip-tool/commands/payload/Commands.h +++ b/examples/chip-tool/commands/payload/Commands.h @@ -36,5 +36,5 @@ void registerCommandsPayload(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for parsing and generating setup payloads."); } diff --git a/examples/chip-tool/commands/session-management/Commands.h b/examples/chip-tool/commands/session-management/Commands.h index 7c75be2065f13d..97223a6354748c 100644 --- a/examples/chip-tool/commands/session-management/Commands.h +++ b/examples/chip-tool/commands/session-management/Commands.h @@ -30,5 +30,5 @@ void registerCommandsSessionManagement(Commands & commands, CredentialIssuerComm make_unique(credsIssuerConfig), }; - commands.Register(clusterName, clusterCommands, "Commands for managing CASE and PASE session state"); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for managing CASE and PASE session state."); } diff --git a/examples/chip-tool/commands/storage/Commands.h b/examples/chip-tool/commands/storage/Commands.h index c53b324481a1ae..7e2ca063e1f42b 100644 --- a/examples/chip-tool/commands/storage/Commands.h +++ b/examples/chip-tool/commands/storage/Commands.h @@ -27,5 +27,5 @@ void registerCommandsStorage(Commands & commands) commands_list clusterCommands = { make_unique() }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for managing persistent data stored by chip-tool."); } diff --git a/examples/chip-tool/templates/commands.zapt b/examples/chip-tool/templates/commands.zapt index 8f47277816f30f..60d327821b05d5 100644 --- a/examples/chip-tool/templates/commands.zapt +++ b/examples/chip-tool/templates/commands.zapt @@ -117,7 +117,7 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands, CredentialIss {{/zcl_events}} }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } {{/zcl_clusters}} @@ -136,7 +136,7 @@ void registerClusterAny(Commands & commands, CredentialIssuerCommands * credsIss make_unique(credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for sending IM messages based on cluster id, not cluster name."); } void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) diff --git a/examples/chip-tool/templates/tests/commands.zapt b/examples/chip-tool/templates/tests/commands.zapt index 060539a66ba090..34e80ddfb44843 100644 --- a/examples/chip-tool/templates/tests/commands.zapt +++ b/examples/chip-tool/templates/tests/commands.zapt @@ -58,5 +58,5 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds #endif // CONFIG_ENABLE_YAML_TESTS }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for running YAML tests."); } diff --git a/examples/darwin-framework-tool/commands/discover/Commands.h b/examples/darwin-framework-tool/commands/discover/Commands.h index d1d54eac255ddb..b20b93e07b189b 100644 --- a/examples/darwin-framework-tool/commands/discover/Commands.h +++ b/examples/darwin-framework-tool/commands/discover/Commands.h @@ -32,5 +32,5 @@ void registerCommandsDiscover(Commands & commands) make_unique(), }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for device discovery."); } diff --git a/examples/darwin-framework-tool/commands/interactive/Commands.h b/examples/darwin-framework-tool/commands/interactive/Commands.h index 722feb8ae2069a..fdc92f45579725 100644 --- a/examples/darwin-framework-tool/commands/interactive/Commands.h +++ b/examples/darwin-framework-tool/commands/interactive/Commands.h @@ -35,5 +35,5 @@ void registerCommandsInteractive(Commands & commands) #endif // CONFIG_USE_INTERACTIVE_MODE }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for starting long-lived interactive modes."); } diff --git a/examples/darwin-framework-tool/commands/pairing/Commands.h b/examples/darwin-framework-tool/commands/pairing/Commands.h index f15524833a0e31..bc1bccdfd0ce43 100644 --- a/examples/darwin-framework-tool/commands/pairing/Commands.h +++ b/examples/darwin-framework-tool/commands/pairing/Commands.h @@ -102,5 +102,5 @@ void registerCommandsPairing(Commands & commands) make_unique(), }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for commissioning devices."); } diff --git a/examples/darwin-framework-tool/commands/payload/Commands.h b/examples/darwin-framework-tool/commands/payload/Commands.h index 67615bcd2c3a7d..3e0015f472b5c5 100644 --- a/examples/darwin-framework-tool/commands/payload/Commands.h +++ b/examples/darwin-framework-tool/commands/payload/Commands.h @@ -27,5 +27,5 @@ void registerCommandsPayload(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for parsing and generating setup payloads."); } diff --git a/examples/darwin-framework-tool/commands/provider/Commands.h b/examples/darwin-framework-tool/commands/provider/Commands.h index 15f2750a528b5d..0083ade9cdd5e5 100644 --- a/examples/darwin-framework-tool/commands/provider/Commands.h +++ b/examples/darwin-framework-tool/commands/provider/Commands.h @@ -10,5 +10,5 @@ void registerClusterOtaSoftwareUpdateProviderInteractive(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Command for configuring darwin-framework-tool as an OTA provider."); } diff --git a/examples/darwin-framework-tool/commands/storage/Commands.h b/examples/darwin-framework-tool/commands/storage/Commands.h index c53b324481a1ae..65534272b81ca5 100644 --- a/examples/darwin-framework-tool/commands/storage/Commands.h +++ b/examples/darwin-framework-tool/commands/storage/Commands.h @@ -27,5 +27,6 @@ void registerCommandsStorage(Commands & commands) commands_list clusterCommands = { make_unique() }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, + "Commands for managing persistent data stored by darwin-framework-tool."); } diff --git a/examples/darwin-framework-tool/templates/commands.zapt b/examples/darwin-framework-tool/templates/commands.zapt index ae0c239dbf9e57..f549b3bd16b641 100644 --- a/examples/darwin-framework-tool/templates/commands.zapt +++ b/examples/darwin-framework-tool/templates/commands.zapt @@ -304,7 +304,7 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{/zcl_events}} }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } {{/if}} {{/zcl_clusters}} @@ -323,7 +323,7 @@ void registerClusterAny(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for sending IM messages based on cluster id, not cluster name."); } void registerClusters(Commands & commands) diff --git a/examples/darwin-framework-tool/templates/tests/commands.zapt b/examples/darwin-framework-tool/templates/tests/commands.zapt index ce44db1f69f82a..526e33f5edd497 100644 --- a/examples/darwin-framework-tool/templates/tests/commands.zapt +++ b/examples/darwin-framework-tool/templates/tests/commands.zapt @@ -59,5 +59,5 @@ void registerCommandsTests(Commands & commands) #endif // CONFIG_ENABLE_YAML_TESTS }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for running YAML tests."); } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 44312157dea3be..0935bdb0e54c3f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -11168,7 +11168,7 @@ void registerClusterIdentify(Commands & commands, CredentialIssuerCommands * cre make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGroups(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11229,7 +11229,7 @@ void registerClusterGroups(Commands & commands, CredentialIssuerCommands * creds make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterScenes(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11323,7 +11323,7 @@ void registerClusterScenes(Commands & commands, CredentialIssuerCommands * creds make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOnOff(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11400,7 +11400,7 @@ void registerClusterOnOff(Commands & commands, CredentialIssuerCommands * credsI make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOnOffSwitchConfiguration(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11459,7 +11459,7 @@ void registerClusterOnOffSwitchConfiguration(Commands & commands, CredentialIssu make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLevelControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11578,7 +11578,7 @@ void registerClusterLevelControl(Commands & commands, CredentialIssuerCommands * make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBinaryInputBasic(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11665,7 +11665,7 @@ void registerClusterBinaryInputBasic(Commands & commands, CredentialIssuerComman make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPulseWidthModulation(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11716,7 +11716,7 @@ void registerClusterPulseWidthModulation(Commands & commands, CredentialIssuerCo make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDescriptor(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11784,7 +11784,7 @@ void registerClusterDescriptor(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBinding(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11840,7 +11840,7 @@ void registerClusterBinding(Commands & commands, CredentialIssuerCommands * cred make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAccessControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -11929,7 +11929,7 @@ void registerClusterAccessControl(Commands & commands, CredentialIssuerCommands credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterActions(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12010,7 +12010,7 @@ void registerClusterActions(Commands & commands, CredentialIssuerCommands * cred make_unique(Id, "action-failed", Events::ActionFailed::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBasicInformation(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12154,7 +12154,7 @@ void registerClusterBasicInformation(Commands & commands, CredentialIssuerComman make_unique(Id, "reachable-changed", Events::ReachableChanged::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOtaSoftwareUpdateProvider(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12208,7 +12208,7 @@ void registerClusterOtaSoftwareUpdateProvider(Commands & commands, CredentialIss make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOtaSoftwareUpdateRequestor(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12284,7 +12284,7 @@ void registerClusterOtaSoftwareUpdateRequestor(Commands & commands, CredentialIs make_unique(Id, "download-error", Events::DownloadError::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLocalizationConfiguration(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12343,7 +12343,7 @@ void registerClusterLocalizationConfiguration(Commands & commands, CredentialIss make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTimeFormatLocalization(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12410,7 +12410,7 @@ void registerClusterTimeFormatLocalization(Commands & commands, CredentialIssuer make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUnitLocalization(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12465,7 +12465,7 @@ void registerClusterUnitLocalization(Commands & commands, CredentialIssuerComman make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPowerSourceConfiguration(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12520,7 +12520,7 @@ void registerClusterPowerSourceConfiguration(Commands & commands, CredentialIssu make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPowerSource(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12725,7 +12725,7 @@ void registerClusterPowerSource(Commands & commands, CredentialIssuerCommands * make_unique(Id, "bat-charge-fault-change", Events::BatChargeFaultChange::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGeneralCommissioning(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12805,7 +12805,7 @@ void registerClusterGeneralCommissioning(Commands & commands, CredentialIssuerCo make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterNetworkCommissioning(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12900,7 +12900,7 @@ void registerClusterNetworkCommissioning(Commands & commands, CredentialIssuerCo make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDiagnosticLogs(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -12952,7 +12952,7 @@ void registerClusterDiagnosticLogs(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGeneralDiagnostics(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -13055,7 +13055,7 @@ void registerClusterGeneralDiagnostics(Commands & commands, CredentialIssuerComm make_unique(Id, "boot-reason", Events::BootReason::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSoftwareDiagnostics(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -13129,7 +13129,7 @@ void registerClusterSoftwareDiagnostics(Commands & commands, CredentialIssuerCom make_unique(Id, "software-fault", Events::SoftwareFault::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThreadNetworkDiagnostics(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -13476,7 +13476,7 @@ void registerClusterThreadNetworkDiagnostics(Commands & commands, CredentialIssu make_unique(Id, "network-fault-change", Events::NetworkFaultChange::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWiFiNetworkDiagnostics(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -13596,7 +13596,7 @@ void registerClusterWiFiNetworkDiagnostics(Commands & commands, CredentialIssuer make_unique(Id, "connection-status", Events::ConnectionStatus::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterEthernetNetworkDiagnostics(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -13684,7 +13684,7 @@ void registerClusterEthernetNetworkDiagnostics(Commands & commands, CredentialIs make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTimeSynchronization(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -13806,7 +13806,7 @@ void registerClusterTimeSynchronization(Commands & commands, CredentialIssuerCom make_unique(Id, "missing-trusted-time-source", Events::MissingTrustedTimeSource::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBridgedDeviceBasicInformation(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -13930,7 +13930,7 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands, Credentia make_unique(Id, "reachable-changed", Events::ReachableChanged::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSwitch(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14007,7 +14007,7 @@ void registerClusterSwitch(Commands & commands, CredentialIssuerCommands * creds make_unique(Id, "multi-press-complete", Events::MultiPressComplete::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAdministratorCommissioning(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14075,7 +14075,7 @@ void registerClusterAdministratorCommissioning(Commands & commands, CredentialIs make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOperationalCredentials(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14162,7 +14162,7 @@ void registerClusterOperationalCredentials(Commands & commands, CredentialIssuer make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGroupKeyManagement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14236,7 +14236,7 @@ void registerClusterGroupKeyManagement(Commands & commands, CredentialIssuerComm make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFixedLabel(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14292,7 +14292,7 @@ void registerClusterFixedLabel(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUserLabel(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14348,7 +14348,7 @@ void registerClusterUserLabel(Commands & commands, CredentialIssuerCommands * cr make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterProxyConfiguration(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14399,7 +14399,7 @@ void registerClusterProxyConfiguration(Commands & commands, CredentialIssuerComm make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterProxyDiscovery(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14450,7 +14450,7 @@ void registerClusterProxyDiscovery(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterProxyValid(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14501,7 +14501,7 @@ void registerClusterProxyValid(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBooleanState(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14558,7 +14558,7 @@ void registerClusterBooleanState(Commands & commands, CredentialIssuerCommands * make_unique(Id, "state-change", Events::StateChange::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterIcdManagement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14640,7 +14640,7 @@ void registerClusterIcdManagement(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterModeSelect(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14718,7 +14718,7 @@ void registerClusterModeSelect(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLaundryWasherMode(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14787,7 +14787,7 @@ void registerClusterLaundryWasherMode(Commands & commands, CredentialIssuerComma make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRefrigeratorAndTemperatureControlledCabinetMode(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) @@ -14857,7 +14857,7 @@ void registerClusterRefrigeratorAndTemperatureControlledCabinetMode(Commands & c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLaundryWasherControls(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14926,7 +14926,7 @@ void registerClusterLaundryWasherControls(Commands & commands, CredentialIssuerC make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRvcRunMode(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -14995,7 +14995,7 @@ void registerClusterRvcRunMode(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRvcCleanMode(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15064,7 +15064,7 @@ void registerClusterRvcCleanMode(Commands & commands, CredentialIssuerCommands * make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTemperatureControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15146,7 +15146,7 @@ void registerClusterTemperatureControl(Commands & commands, CredentialIssuerComm make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRefrigeratorAlarm(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15211,7 +15211,7 @@ void registerClusterRefrigeratorAlarm(Commands & commands, CredentialIssuerComma make_unique(Id, "notify", Events::Notify::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDishwasherMode(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15280,7 +15280,7 @@ void registerClusterDishwasherMode(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAirQuality(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15335,7 +15335,7 @@ void registerClusterAirQuality(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSmokeCoAlarm(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15468,7 +15468,7 @@ void registerClusterSmokeCoAlarm(Commands & commands, CredentialIssuerCommands * make_unique(Id, "all-clear", Events::AllClear::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDishwasherAlarm(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15539,7 +15539,7 @@ void registerClusterDishwasherAlarm(Commands & commands, CredentialIssuerCommand make_unique(Id, "notify", Events::Notify::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOperationalState(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15625,7 +15625,7 @@ void registerClusterOperationalState(Commands & commands, CredentialIssuerComman make_unique(Id, "operation-completion", Events::OperationCompletion::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRvcOperationalState(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15711,7 +15711,7 @@ void registerClusterRvcOperationalState(Commands & commands, CredentialIssuerCom make_unique(Id, "operation-completion", Events::OperationCompletion::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterHepaFilterMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15786,7 +15786,7 @@ void registerClusterHepaFilterMonitoring(Commands & commands, CredentialIssuerCo make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterActivatedCarbonFilterMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15861,7 +15861,7 @@ void registerClusterActivatedCarbonFilterMonitoring(Commands & commands, Credent make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterCeramicFilterMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -15936,7 +15936,7 @@ void registerClusterCeramicFilterMonitoring(Commands & commands, CredentialIssue make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterElectrostaticFilterMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16011,7 +16011,7 @@ void registerClusterElectrostaticFilterMonitoring(Commands & commands, Credentia make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUvFilterMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16086,7 +16086,7 @@ void registerClusterUvFilterMonitoring(Commands & commands, CredentialIssuerComm make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterIonizingFilterMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16161,7 +16161,7 @@ void registerClusterIonizingFilterMonitoring(Commands & commands, CredentialIssu make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterZeoliteFilterMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16236,7 +16236,7 @@ void registerClusterZeoliteFilterMonitoring(Commands & commands, CredentialIssue make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOzoneFilterMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16311,7 +16311,7 @@ void registerClusterOzoneFilterMonitoring(Commands & commands, CredentialIssuerC make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWaterTankMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16386,7 +16386,7 @@ void registerClusterWaterTankMonitoring(Commands & commands, CredentialIssuerCom make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFuelTankMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16461,7 +16461,7 @@ void registerClusterFuelTankMonitoring(Commands & commands, CredentialIssuerComm make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterInkCartridgeMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16536,7 +16536,7 @@ void registerClusterInkCartridgeMonitoring(Commands & commands, CredentialIssuer make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTonerCartridgeMonitoring(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16611,7 +16611,7 @@ void registerClusterTonerCartridgeMonitoring(Commands & commands, CredentialIssu make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDoorLock(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -16875,7 +16875,7 @@ void registerClusterDoorLock(Commands & commands, CredentialIssuerCommands * cre make_unique(Id, "lock-user-change", Events::LockUserChange::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWindowCovering(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -17061,7 +17061,7 @@ void registerClusterWindowCovering(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBarrierControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -17160,7 +17160,7 @@ void registerClusterBarrierControl(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPumpConfigurationAndControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -17353,7 +17353,7 @@ void registerClusterPumpConfigurationAndControl(Commands & commands, CredentialI make_unique(Id, "turbine-operation", Events::TurbineOperation::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -17661,7 +17661,7 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFanControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -17762,7 +17762,7 @@ void registerClusterFanControl(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThermostatUserInterfaceConfiguration(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -17829,7 +17829,7 @@ void registerClusterThermostatUserInterfaceConfiguration(Commands & commands, Cr make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterColorControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18136,7 +18136,7 @@ void registerClusterColorControl(Commands & commands, CredentialIssuerCommands * make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBallastConfiguration(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18249,7 +18249,7 @@ void registerClusterBallastConfiguration(Commands & commands, CredentialIssuerCo make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterIlluminanceMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18325,7 +18325,7 @@ void registerClusterIlluminanceMeasurement(Commands & commands, CredentialIssuer make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTemperatureMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18395,7 +18395,7 @@ void registerClusterTemperatureMeasurement(Commands & commands, CredentialIssuer make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPressureMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18488,7 +18488,7 @@ void registerClusterPressureMeasurement(Commands & commands, CredentialIssuerCom make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFlowMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18558,7 +18558,7 @@ void registerClusterFlowMeasurement(Commands & commands, CredentialIssuerCommand make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRelativeHumidityMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18628,7 +18628,7 @@ void registerClusterRelativeHumidityMeasurement(Commands & commands, CredentialI make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOccupancySensing(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18758,7 +18758,7 @@ void registerClusterOccupancySensing(Commands & commands, CredentialIssuerComman make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterCarbonMonoxideConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18866,7 +18866,7 @@ void registerClusterCarbonMonoxideConcentrationMeasurement(Commands & commands, make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterCarbonDioxideConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -18974,7 +18974,7 @@ void registerClusterCarbonDioxideConcentrationMeasurement(Commands & commands, C make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterEthyleneConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19082,7 +19082,7 @@ void registerClusterEthyleneConcentrationMeasurement(Commands & commands, Creden make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterEthyleneOxideConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19190,7 +19190,7 @@ void registerClusterEthyleneOxideConcentrationMeasurement(Commands & commands, C make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterHydrogenConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19298,7 +19298,7 @@ void registerClusterHydrogenConcentrationMeasurement(Commands & commands, Creden make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterHydrogenSulfideConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19406,7 +19406,7 @@ void registerClusterHydrogenSulfideConcentrationMeasurement(Commands & commands, make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterNitricOxideConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19514,7 +19514,7 @@ void registerClusterNitricOxideConcentrationMeasurement(Commands & commands, Cre make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterNitrogenDioxideConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19622,7 +19622,7 @@ void registerClusterNitrogenDioxideConcentrationMeasurement(Commands & commands, make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOxygenConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19730,7 +19730,7 @@ void registerClusterOxygenConcentrationMeasurement(Commands & commands, Credenti make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOzoneConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19838,7 +19838,7 @@ void registerClusterOzoneConcentrationMeasurement(Commands & commands, Credentia make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSulfurDioxideConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -19946,7 +19946,7 @@ void registerClusterSulfurDioxideConcentrationMeasurement(Commands & commands, C make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDissolvedOxygenConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20054,7 +20054,7 @@ void registerClusterDissolvedOxygenConcentrationMeasurement(Commands & commands, make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBromateConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20162,7 +20162,7 @@ void registerClusterBromateConcentrationMeasurement(Commands & commands, Credent make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterChloraminesConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20270,7 +20270,7 @@ void registerClusterChloraminesConcentrationMeasurement(Commands & commands, Cre make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterChlorineConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20378,7 +20378,7 @@ void registerClusterChlorineConcentrationMeasurement(Commands & commands, Creden make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFecalColiformEColiConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20486,7 +20486,7 @@ void registerClusterFecalColiformEColiConcentrationMeasurement(Commands & comman make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFluorideConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20594,7 +20594,7 @@ void registerClusterFluorideConcentrationMeasurement(Commands & commands, Creden make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterHaloaceticAcidsConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20702,7 +20702,7 @@ void registerClusterHaloaceticAcidsConcentrationMeasurement(Commands & commands, make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTotalTrihalomethanesConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20810,7 +20810,7 @@ void registerClusterTotalTrihalomethanesConcentrationMeasurement(Commands & comm make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTotalColiformBacteriaConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -20918,7 +20918,7 @@ void registerClusterTotalColiformBacteriaConcentrationMeasurement(Commands & com make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTurbidityConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21026,7 +21026,7 @@ void registerClusterTurbidityConcentrationMeasurement(Commands & commands, Crede make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterCopperConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21134,7 +21134,7 @@ void registerClusterCopperConcentrationMeasurement(Commands & commands, Credenti make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLeadConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21242,7 +21242,7 @@ void registerClusterLeadConcentrationMeasurement(Commands & commands, Credential make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterManganeseConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21350,7 +21350,7 @@ void registerClusterManganeseConcentrationMeasurement(Commands & commands, Crede make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSulfateConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21458,7 +21458,7 @@ void registerClusterSulfateConcentrationMeasurement(Commands & commands, Credent make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBromodichloromethaneConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21566,7 +21566,7 @@ void registerClusterBromodichloromethaneConcentrationMeasurement(Commands & comm make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBromoformConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21674,7 +21674,7 @@ void registerClusterBromoformConcentrationMeasurement(Commands & commands, Crede make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterChlorodibromomethaneConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21782,7 +21782,7 @@ void registerClusterChlorodibromomethaneConcentrationMeasurement(Commands & comm make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterChloroformConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21890,7 +21890,7 @@ void registerClusterChloroformConcentrationMeasurement(Commands & commands, Cred make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSodiumConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -21998,7 +21998,7 @@ void registerClusterSodiumConcentrationMeasurement(Commands & commands, Credenti make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPm25ConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22106,7 +22106,7 @@ void registerClusterPm25ConcentrationMeasurement(Commands & commands, Credential make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFormaldehydeConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22214,7 +22214,7 @@ void registerClusterFormaldehydeConcentrationMeasurement(Commands & commands, Cr make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPm1ConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22322,7 +22322,7 @@ void registerClusterPm1ConcentrationMeasurement(Commands & commands, CredentialI make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPm10ConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22430,7 +22430,7 @@ void registerClusterPm10ConcentrationMeasurement(Commands & commands, Credential make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTotalVolatileOrganicCompoundsConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) @@ -22541,7 +22541,7 @@ void registerClusterTotalVolatileOrganicCompoundsConcentrationMeasurement(Comman make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRadonConcentrationMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22649,7 +22649,7 @@ void registerClusterRadonConcentrationMeasurement(Commands & commands, Credentia make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWakeOnLan(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22704,7 +22704,7 @@ void registerClusterWakeOnLan(Commands & commands, CredentialIssuerCommands * cr make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterChannel(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22773,7 +22773,7 @@ void registerClusterChannel(Commands & commands, CredentialIssuerCommands * cred make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTargetNavigator(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22834,7 +22834,7 @@ void registerClusterTargetNavigator(Commands & commands, CredentialIssuerCommand make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterMediaPlayback(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22927,7 +22927,7 @@ void registerClusterMediaPlayback(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterMediaInput(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -22991,7 +22991,7 @@ void registerClusterMediaInput(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLowPower(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -23043,7 +23043,7 @@ void registerClusterLowPower(Commands & commands, CredentialIssuerCommands * cre make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterKeypadInput(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -23095,7 +23095,7 @@ void registerClusterKeypadInput(Commands & commands, CredentialIssuerCommands * make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterContentLauncher(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -23159,7 +23159,7 @@ void registerClusterContentLauncher(Commands & commands, CredentialIssuerCommand make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAudioOutput(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -23221,7 +23221,7 @@ void registerClusterAudioOutput(Commands & commands, CredentialIssuerCommands * make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterApplicationLauncher(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -23284,7 +23284,7 @@ void registerClusterApplicationLauncher(Commands & commands, CredentialIssuerCom make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterApplicationBasic(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -23367,7 +23367,7 @@ void registerClusterApplicationBasic(Commands & commands, CredentialIssuerComman make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAccountLogin(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -23421,7 +23421,7 @@ void registerClusterAccountLogin(Commands & commands, CredentialIssuerCommands * make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterElectricalMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -24117,7 +24117,7 @@ void registerClusterElectricalMeasurement(Commands & commands, CredentialIssuerC make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -24562,7 +24562,7 @@ void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * make_unique(Id, "test-fabric-scoped-event", Events::TestFabricScopedEvent::Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFaultInjection(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { @@ -24615,7 +24615,7 @@ void registerClusterFaultInjection(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAny(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) @@ -24633,7 +24633,8 @@ void registerClusterAny(Commands & commands, CredentialIssuerCommands * credsIss make_unique(credsIssuerConfig), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, + "Commands for sending IM messages based on cluster id, not cluster name."); } void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index c9aeac70f7797e..cf357feadac2c1 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -139164,5 +139164,5 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds #endif // CONFIG_ENABLE_YAML_TESTS }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for running YAML tests."); } 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 71dcb80bf18e38..db186770fca25d 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -97730,7 +97730,7 @@ void registerClusterIdentify(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGroups(Commands & commands) { @@ -97763,7 +97763,7 @@ void registerClusterGroups(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterScenes(Commands & commands) { @@ -97810,7 +97810,7 @@ void registerClusterScenes(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOnOff(Commands & commands) { @@ -97854,7 +97854,7 @@ void registerClusterOnOff(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOnOffSwitchConfiguration(Commands & commands) { @@ -97884,7 +97884,7 @@ void registerClusterOnOffSwitchConfiguration(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLevelControl(Commands & commands) { @@ -97953,7 +97953,7 @@ void registerClusterLevelControl(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBinaryInputBasic(Commands & commands) { @@ -98002,7 +98002,7 @@ void registerClusterBinaryInputBasic(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDescriptor(Commands & commands) { @@ -98035,7 +98035,7 @@ void registerClusterDescriptor(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBinding(Commands & commands) { @@ -98063,7 +98063,7 @@ void registerClusterBinding(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAccessControl(Commands & commands) { @@ -98102,7 +98102,7 @@ void registerClusterAccessControl(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterActions(Commands & commands) { @@ -98147,7 +98147,7 @@ void registerClusterActions(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBasicInformation(Commands & commands) { @@ -98219,7 +98219,7 @@ void registerClusterBasicInformation(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOtaSoftwareUpdateProvider(Commands & commands) { @@ -98247,7 +98247,7 @@ void registerClusterOtaSoftwareUpdateProvider(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOtaSoftwareUpdateRequestor(Commands & commands) { @@ -98284,7 +98284,7 @@ void registerClusterOtaSoftwareUpdateRequestor(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLocalizationConfiguration(Commands & commands) { @@ -98314,7 +98314,7 @@ void registerClusterLocalizationConfiguration(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTimeFormatLocalization(Commands & commands) { @@ -98347,7 +98347,7 @@ void registerClusterTimeFormatLocalization(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUnitLocalization(Commands & commands) { @@ -98375,7 +98375,7 @@ void registerClusterUnitLocalization(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPowerSourceConfiguration(Commands & commands) { @@ -98402,7 +98402,7 @@ void registerClusterPowerSourceConfiguration(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPowerSource(Commands & commands) { @@ -98491,7 +98491,7 @@ void registerClusterPowerSource(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGeneralCommissioning(Commands & commands) { @@ -98530,7 +98530,7 @@ void registerClusterGeneralCommissioning(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterNetworkCommissioning(Commands & commands) { @@ -98578,7 +98578,7 @@ void registerClusterNetworkCommissioning(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDiagnosticLogs(Commands & commands) { @@ -98604,7 +98604,7 @@ void registerClusterDiagnosticLogs(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGeneralDiagnostics(Commands & commands) { @@ -98650,7 +98650,7 @@ void registerClusterGeneralDiagnostics(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSoftwareDiagnostics(Commands & commands) { @@ -98686,7 +98686,7 @@ void registerClusterSoftwareDiagnostics(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThreadNetworkDiagnostics(Commands & commands) { @@ -98840,7 +98840,7 @@ void registerClusterThreadNetworkDiagnostics(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWiFiNetworkDiagnostics(Commands & commands) { @@ -98894,7 +98894,7 @@ void registerClusterWiFiNetworkDiagnostics(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterEthernetNetworkDiagnostics(Commands & commands) { @@ -98938,7 +98938,7 @@ void registerClusterEthernetNetworkDiagnostics(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBridgedDeviceBasicInformation(Commands & commands) { @@ -98998,7 +98998,7 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSwitch(Commands & commands) { @@ -99031,7 +99031,7 @@ void registerClusterSwitch(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAdministratorCommissioning(Commands & commands) { @@ -99065,7 +99065,7 @@ void registerClusterAdministratorCommissioning(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOperationalCredentials(Commands & commands) { @@ -99110,7 +99110,7 @@ void registerClusterOperationalCredentials(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGroupKeyManagement(Commands & commands) { @@ -99148,7 +99148,7 @@ void registerClusterGroupKeyManagement(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFixedLabel(Commands & commands) { @@ -99175,7 +99175,7 @@ void registerClusterFixedLabel(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUserLabel(Commands & commands) { @@ -99203,7 +99203,7 @@ void registerClusterUserLabel(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBooleanState(Commands & commands) { @@ -99232,7 +99232,7 @@ void registerClusterBooleanState(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterModeSelect(Commands & commands) { @@ -99272,7 +99272,7 @@ void registerClusterModeSelect(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDoorLock(Commands & commands) { @@ -99407,7 +99407,7 @@ void registerClusterDoorLock(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWindowCovering(Commands & commands) { @@ -99484,7 +99484,7 @@ void registerClusterWindowCovering(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBarrierControl(Commands & commands) { @@ -99537,7 +99537,7 @@ void registerClusterBarrierControl(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPumpConfigurationAndControl(Commands & commands) { @@ -99614,7 +99614,7 @@ void registerClusterPumpConfigurationAndControl(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThermostat(Commands & commands) { @@ -99768,7 +99768,7 @@ void registerClusterThermostat(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFanControl(Commands & commands) { @@ -99821,7 +99821,7 @@ void registerClusterFanControl(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThermostatUserInterfaceConfiguration(Commands & commands) { @@ -99855,7 +99855,7 @@ void registerClusterThermostatUserInterfaceConfiguration(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterColorControl(Commands & commands) { @@ -100016,7 +100016,7 @@ void registerClusterColorControl(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBallastConfiguration(Commands & commands) { @@ -100079,7 +100079,7 @@ void registerClusterBallastConfiguration(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterIlluminanceMeasurement(Commands & commands) { @@ -100114,7 +100114,7 @@ void registerClusterIlluminanceMeasurement(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTemperatureMeasurement(Commands & commands) { @@ -100147,7 +100147,7 @@ void registerClusterTemperatureMeasurement(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPressureMeasurement(Commands & commands) { @@ -100190,7 +100190,7 @@ void registerClusterPressureMeasurement(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFlowMeasurement(Commands & commands) { @@ -100223,7 +100223,7 @@ void registerClusterFlowMeasurement(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRelativeHumidityMeasurement(Commands & commands) { @@ -100256,7 +100256,7 @@ void registerClusterRelativeHumidityMeasurement(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOccupancySensing(Commands & commands) { @@ -100314,7 +100314,7 @@ void registerClusterOccupancySensing(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWakeOnLan(Commands & commands) { @@ -100341,7 +100341,7 @@ void registerClusterWakeOnLan(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterChannel(Commands & commands) { @@ -100375,7 +100375,7 @@ void registerClusterChannel(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTargetNavigator(Commands & commands) { @@ -100405,7 +100405,7 @@ void registerClusterTargetNavigator(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterMediaPlayback(Commands & commands) { @@ -100455,7 +100455,7 @@ void registerClusterMediaPlayback(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterMediaInput(Commands & commands) { @@ -100488,7 +100488,7 @@ void registerClusterMediaInput(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLowPower(Commands & commands) { @@ -100514,7 +100514,7 @@ void registerClusterLowPower(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterKeypadInput(Commands & commands) { @@ -100540,7 +100540,7 @@ void registerClusterKeypadInput(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterContentLauncher(Commands & commands) { @@ -100572,7 +100572,7 @@ void registerClusterContentLauncher(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAudioOutput(Commands & commands) { @@ -100603,7 +100603,7 @@ void registerClusterAudioOutput(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterApplicationLauncher(Commands & commands) { @@ -100636,7 +100636,7 @@ void registerClusterApplicationLauncher(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterApplicationBasic(Commands & commands) { @@ -100677,7 +100677,7 @@ void registerClusterApplicationBasic(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAccountLogin(Commands & commands) { @@ -100705,7 +100705,7 @@ void registerClusterAccountLogin(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterElectricalMeasurement(Commands & commands) { @@ -100996,7 +100996,7 @@ void registerClusterElectricalMeasurement(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUnitTesting(Commands & commands) { @@ -101291,7 +101291,7 @@ void registerClusterUnitTesting(Commands & commands) make_unique(Id), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAny(Commands & commands) @@ -101308,7 +101308,8 @@ void registerClusterAny(Commands & commands) make_unique(), // }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet( + clusterName, clusterCommands, "Commands for sending IM messages based on cluster id, not cluster name."); } void registerClusters(Commands & commands) diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 0eefdf94fa9f36..7e47aa29ac6c57 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -150004,5 +150004,5 @@ void registerCommandsTests(Commands & commands) #endif // CONFIG_ENABLE_YAML_TESTS }; - commands.Register(clusterName, clusterCommands); + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for running YAML tests."); } From cdca12fb320c071de902f406ae2459369e4c5d4c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:37:03 +0000 Subject: [PATCH 28/34] Bump actions/setup-java from 2 to 3 (#27849) Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2 to 3. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/kotlin-style.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kotlin-style.yaml b/.github/workflows/kotlin-style.yaml index 535f4cd8c30426..921e89528d7ee5 100644 --- a/.github/workflows/kotlin-style.yaml +++ b/.github/workflows/kotlin-style.yaml @@ -35,7 +35,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: 'adopt' java-version: '17' From a7ec82b3bb93e1235ff2a66cf018dbe49786daa5 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Tue, 11 Jul 2023 16:46:55 -0400 Subject: [PATCH 29/34] TC-TIMESYNC-2.1 (#26400) * TC-TIMESYNC-2.1 NOTE: not yet added to the CI since the SDK impl hasn't landed yet. * Appease the linter * Restyled by isort * zap regen. * zap regen --------- Co-authored-by: Restyled.io --- src/python_testing/TC_TIMESYNC_2_1.py | 192 ++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 src/python_testing/TC_TIMESYNC_2_1.py diff --git a/src/python_testing/TC_TIMESYNC_2_1.py b/src/python_testing/TC_TIMESYNC_2_1.py new file mode 100644 index 00000000000000..9413f5ee41b008 --- /dev/null +++ b/src/python_testing/TC_TIMESYNC_2_1.py @@ -0,0 +1,192 @@ +# +# Copyright (c) 2023 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 ipaddress +from datetime import timedelta + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, utc_time_in_matter_epoch +from mobly import asserts + + +class TC_TIMESYNC_2_1(MatterBaseTest): + async def read_ts_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.TimeSynchronization + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + @async_test_body + async def test_TC_TIMESYNC_2_1(self): + + endpoint = self.user_params.get("endpoint", 0) + + self.print_step(1, "Commissioning, already done") + attributes = Clusters.TimeSynchronization.Attributes + + self.print_step(2, "Read Granularity attribute") + if self.check_pics("TIMESYNC.S.A0001"): + granularity_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.Granularity) + asserts.assert_less(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kUnknownEnumValue, + "Granularity is not in valid range") + else: + asserts.assert_true(False, "Granularity is a mandatory attribute and must be present in the PICS file") + + self.print_step(3, "Read TimeSource") + if self.check_pics("TIMESYNC.S.A0002"): + time_source = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeSource) + asserts.assert_less(time_source, Clusters.TimeSynchronization.Enums.TimeSourceEnum.kUnknownEnumValue, + "TimeSource is not in valid range") + else: + asserts.assert_true(False, "TimeSource is a mandatory attribute and must be present in the PICS file") + + self.print_step(4, "Read TrustedTimeSource") + if self.check_pics("TIMESYNC.S.A0003"): + trusted_time_source = await self.read_ts_attribute_expect_success(endpoint=endpoint, + attribute=attributes.TrustedTimeSource) + if trusted_time_source is not NullValue: + asserts.assert_less_equal(trusted_time_source.fabricIndex, 0xFE, + "FabricIndex for the TrustedTimeSource is out of range") + asserts.assert_greater_equal(trusted_time_source.fabricIndex, 1, + "FabricIndex for the TrustedTimeSource is out of range") + elif self.check_pics("TIMESYNC.S.F03"): + asserts.assert_true(False, "TrustedTimeSource is mandatory if the TSC feature (TIMESYNC.S.F03) is supported") + + self.print_step(5, "Read DefaultNTP") + if self.check_pics("TIMESYNC.S.A0004"): + default_ntp = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.DefaultNTP) + if default_ntp is not NullValue: + asserts.assert_less_equal(len(default_ntp), 128, "DefaultNTP length must be less than 128") + # Assume this is a valid web address if it has at least one . in the name + is_web_addr = default_ntp.find('.') != -1 + try: + ipaddress.IPv6Address(default_ntp) + is_ip_addr = True + except ipaddress.AddressValueError: + is_ip_addr = False + pass + asserts.assert_true(is_web_addr or is_ip_addr, "Returned DefaultNTP value is not a IP address or web address") + elif self.check_pics("TIMESYNC.S.F01"): + asserts.assert_true(False, "DefaultNTP is mandatory if the NTPC (TIMESYNC.S.F01) feature is supported") + + self.print_step(6, "Read TimeZone") + if self.check_pics("TIMESYNC.S.A0005"): + tz_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeZone) + asserts.assert_greater_equal(len(tz_dut), 1, "TimeZone must have at least one entry in the list") + asserts.assert_less_equal(len(tz_dut), 2, "TimeZone may have a maximum of two entries in the list") + for entry in tz_dut: + asserts.assert_greater_equal(entry.offset, -43200, "TimeZone offset is out of range") + asserts.assert_less_equal(entry.offset, 50400, "TimeZone offset is out of range") + if entry.name: + asserts.assert_less_equal(len(entry.name), 64, "TimeZone name is too long") + + asserts.assert_equal(tz_dut[0].validAt, 0, "TimeZone list first entry must have a 0 ValidAt time") + if len(tz_dut) > 1: + asserts.assert_not_equal(tz_dut[1].validAt, 0, "TimeZone list second entry must have a non-zero ValidAt time") + elif self.check_pics("TIMESYNC.S.F00"): + asserts.assert_true(False, "TimeZone is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") + + self.print_step(7, "Read DSTOffset") + if self.check_pics("TIMESYNC.S.A0006"): + dst_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.DSTOffset) + last_valid_until = -1 + last_valid_starting = -1 + for dst in dst_dut: + asserts.assert_greater(dst.validStarting, last_valid_starting, + "DSTOffset list must be sorted by ValidStarting time") + last_valid_starting = dst.validStarting + asserts.assert_greater_equal(dst.validStarting, last_valid_until, + "DSTOffset list must have every ValidStarting > ValidUntil of the previous entry") + last_valid_until = dst.validUntil + if dst.validUntil is NullValue or dst.validUntil is None: + asserts.assert_equal(dst, dst_dut[-1], "DSTOffset list must have Null ValidUntil at the end") + elif self.check_pics("TIMESYNC.S.F00"): + asserts.assert_true(False, "DSTOffset is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") + + self.print_step(8, "Read UTCTime") + if self.check_pics("TIMESYNC.S.A0000"): + utc_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.UTCTime) + if utc_dut is NullValue: + asserts.assert_equal(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kNoTimeGranularity) + else: + asserts.assert_not_equal(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kNoTimeGranularity) + if granularity_dut is Clusters.TimeSynchronization.Enums.GranularityEnum.kMinutesGranularity: + toleranace = timedelta(minutes=10) + else: + toleranace = timedelta(minutes=1) + delta_us = abs(utc_dut - utc_time_in_matter_epoch()) + delta = timedelta(microseconds=delta_us) + asserts.assert_less_equal(delta, toleranace, "UTC time is not within tolerance of TH") + else: + asserts.assert_true(False, "UTCTime is a mandatory attribute and must be present in the PICS file") + + self.print_step(9, "Read LocalTime") + if self.check_pics("TIMESYNC.S.A0007"): + utc_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.UTCTime) + local_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.LocalTime) + if utc_dut is NullValue: + asserts.assert_true(local_dut is NullValue, "LocalTime must be Null if UTC time is Null") + elif len(dst_dut) == 0: + asserts.assert_true(local_dut is NullValue, "LocalTime must be Null if the DST table is empty") + else: + local_calculated = utc_dut + dst_dut[0].offset + tz_dut[0].offset + delta_us = abs(local_dut, local_calculated) + delta = timedelta(microseconds=delta_us) + toleranace = timedelta(minutes=1) + asserts.assert_less_equal(delta, toleranace, "Local time caluclation is not within tolerance of calculated value") + elif self.check_pics("TIMESYNC.S.F00"): + asserts.assert_true(False, "LocalTime is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") + + self.print_step(10, "Read TimeZoneDatabase") + if self.check_pics("TIMESYNC.S.A0008"): + tz_db_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeZoneDatabase) + asserts.assert_less(tz_db_dut, Clusters.TimeSynchronization.Enums.TimeZoneDatabaseEnum.kUnknownEnumValue, + "TimeZoneDatabase is not in valid range") + elif self.check_pics("TIMESYNC.S.F00"): + asserts.assert_true(False, "TimeZoneDatabase is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") + + self.print_step(11, "Read NTPServerAvailable") + if self.check_pics("TIMESYNC.S.A0009"): + # bool typechecking happens in the test read functions, so all we need to do here is do the read + await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.NTPServerAvailable) + elif self.check_pics("TIMESYNC.S.F02"): + asserts.assert_true(False, "NTPServerAvailable is mandatory if the NTPS (TIMESYNC.S.F02) feature is supported") + + self.print_step(12, "Read TimeZoneListMaxSize") + if self.check_pics("TIMESYNC.S.A000A"): + size = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeZoneListMaxSize) + asserts.assert_greater_equal(size, 1, "TimeZoneListMaxSize must be at least 1") + asserts.assert_less_equal(size, 2, "TimeZoneListMaxSize must be max 2") + elif self.check_pics("TIMESYNC.S.F00"): + asserts.assert_true(False, "TimeZoneListMaxSize is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") + + self.print_step(13, "Read DSTOffsetListMaxSize") + if self.check_pics("TIMESYNC.S.A000B"): + size = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.DSTOffsetListMaxSize) + asserts.assert_greater_equal(size, 1, "DSTOffsetListMaxSize must be at least 1") + elif self.check_pics("TIMESYNC.S.F00"): + asserts.assert_true(False, "DSTOffsetListMaxSize is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") + + self.print_step(14, "Read SupportsDNSResolve") + if self.check_pics("TIMESYNC.S.A0004"): + # bool typechecking happens in the test read functions, so all we need to do here is do the read + await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.SupportsDNSResolve) + elif self.check_pics("TIMESYNC.S.F01"): + asserts.assert_true(False, "SupportsDNSResolve is mandatory if the NTPC (TIMESYNC.S.F01) feature is supported") + + +if __name__ == "__main__": + default_matter_test_main() From 5834985e13c02c6e554e351b46a4f6597595d881 Mon Sep 17 00:00:00 2001 From: Thomas Hartwig Date: Tue, 11 Jul 2023 22:49:04 +0200 Subject: [PATCH 30/34] Add Air Purifier and Air Quality Sensor Device Types (#27888) * Use Spaces Instead of Tabs * Add Air Purifier and Air Quality Sensor Device Types --- .../zcl/data-model/chip/matter-devices.xml | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) 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 f284a4aecafa90..4b7998671595f6 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 @@ -1181,8 +1181,8 @@ limitations under the License. PARTS_LIST - STATE_VALUE - + STATE_VALUE + @@ -1618,7 +1618,7 @@ limitations under the License. AddGroupIfIdentifying - + @@ -1899,6 +1899,51 @@ limitations under the License. + + MA-air-purifier + CHIP + Matter Air Purifier + 0x0103 + 0x002D + + + IDENTIFY_TIME + IDENTIFY_TYPE + Identify + + + + + + + + + MA-air-quality-sensor + CHIP + Matter Air Quality Sensor + 0x0103 + 0x002C + + + IDENTIFY_TIME + IDENTIFY_TYPE + Identify + + + + + + + + + + + + + + + + MA-all-clusters-app CHIP From 5f0f5c37d0b02132f76403e1fd35c417b09965d0 Mon Sep 17 00:00:00 2001 From: Hare <53897436+umbraHare@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:52:55 +0800 Subject: [PATCH 31/34] Fix decoding of TLV payload data (#27839) --- .../matter_idl/generators/cpp/tlvmeta/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/py_matter_idl/matter_idl/generators/cpp/tlvmeta/__init__.py b/scripts/py_matter_idl/matter_idl/generators/cpp/tlvmeta/__init__.py index 23e7e39f57ac08..c93d55c32de081 100644 --- a/scripts/py_matter_idl/matter_idl/generators/cpp/tlvmeta/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/cpp/tlvmeta/__init__.py @@ -96,7 +96,8 @@ def ComputeKnownTypes(self): # Events are structures for e in self.cluster.events: - self.known_types.add("%s_%s" % (self.cluster.name, e.name)) + if e.fields: + self.known_types.add("%s_%s" % (self.cluster.name, e.name)) for e in self.cluster.enums: self.known_types.add("%s_%s" % (self.cluster.name, e.name)) @@ -155,7 +156,7 @@ def GenerateTables(self) -> Generator[Table, None, None]: reference="%s_%s" % (self.cluster.name, e.name), real_type='%s::%s' % (self.cluster.name, e.name) ) - for e in self.cluster.events + for e in self.cluster.events if e.fields ]) cluster_entries.extend( [entry for entry in self.CommandEntries()] @@ -173,10 +174,11 @@ def GenerateTables(self) -> Generator[Table, None, None]: ) for e in self.cluster.events: - yield Table( - full_name="%s_%s" % (self.cluster.name, e.name), - entries=[self.FieldEntry(field) for field in e.fields] - ) + if e.fields: + yield Table( + full_name="%s_%s" % (self.cluster.name, e.name), + entries=[self.FieldEntry(field) for field in e.fields] + ) # some items have lists, create an intermediate item for those for name in self.list_types: From 6e33196186fccf02272a050cec5ccfa9928a9f5d Mon Sep 17 00:00:00 2001 From: Artur Tynecki <77382963+ATmobica@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:53:56 +0200 Subject: [PATCH 32/34] [OIS] Add tv-app Matter example (#27838) * [OIS] Add CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS Add a new item of Matter build settings that pass extra include dirs for project configurations. It's used in common GN arguments function. Signed-off-by: ATmobica * [OIS] Add tv-app Matter example Add tv-app implementation for OIS. Create tv-app integration tests. Extend build script, Vscode tasks, CI with tv-app. Signed-off-by: ATmobica --------- Signed-off-by: ATmobica --- .github/workflows/examples-openiotsdk.yaml | 21 +- config/openiotsdk/CMakeLists.txt | 1 + config/openiotsdk/cmake/chip.cmake | 1 + docs/guides/openiotsdk_examples.md | 1 + .../openiotsdk/supported_examples.txt | 1 + examples/tv-app/openiotsdk/.gitignore | 1 + examples/tv-app/openiotsdk/CMakeLists.txt | 79 +++ examples/tv-app/openiotsdk/README.md | 163 +++++ .../openiotsdk/cmsis-config/RTE_Components.h | 22 + .../freertos-config/FreeRTOSConfig.h | 257 ++++++++ .../main/include/CHIPProjectConfig.h | 32 + examples/tv-app/openiotsdk/main/main_ns.cpp | 97 +++ .../openiotsdk/tf-m-config/TfmProjectConfig.h | 165 +++++ .../integration-tests/tv-app/__init__.py | 0 .../integration-tests/tv-app/test_app.py | 569 ++++++++++++++++++ 15 files changed, 1409 insertions(+), 1 deletion(-) create mode 100644 examples/tv-app/openiotsdk/.gitignore create mode 100644 examples/tv-app/openiotsdk/CMakeLists.txt create mode 100644 examples/tv-app/openiotsdk/README.md create mode 100644 examples/tv-app/openiotsdk/cmsis-config/RTE_Components.h create mode 100644 examples/tv-app/openiotsdk/freertos-config/FreeRTOSConfig.h create mode 100644 examples/tv-app/openiotsdk/main/include/CHIPProjectConfig.h create mode 100644 examples/tv-app/openiotsdk/main/main_ns.cpp create mode 100644 examples/tv-app/openiotsdk/tf-m-config/TfmProjectConfig.h create mode 100644 src/test_driver/openiotsdk/integration-tests/tv-app/__init__.py create mode 100644 src/test_driver/openiotsdk/integration-tests/tv-app/test_app.py diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 15bfa0b5bab8df..2b46e34e7d8310 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -26,7 +26,7 @@ concurrency: env: CHIP_NO_LOG_TIMESTAMPS: true - + jobs: openiotsdk: name: Open IoT SDK examples building @@ -81,6 +81,16 @@ jobs: examples/lock-app/openiotsdk/build/chip-openiotsdk-lock-app-example.elf \ /tmp/bloat_reports/ + - name: Build tv-app example + id: build_tv_app + timeout-minutes: 10 + run: | + scripts/examples/openiotsdk_example.sh tv-app + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + openiotsdk release tv-app \ + examples/tv-app/openiotsdk/build/chip-openiotsdk-tv-app-example.elf \ + /tmp/bloat_reports/ + - name: Build unit tests (mbedtls) id: build_unit_tests_mbedtls run: | @@ -100,6 +110,15 @@ jobs: 'scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh --no-activate -C test -n ${TEST_NETWORK_NAME}tap lock-app' scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME down + - name: "Test: tv-app example" + if: steps.build_tv_app.outcome == 'success' + timeout-minutes: 10 + run: | + scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME up + scripts/run_in_python_env.sh out/venv \ + 'scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh --no-activate -C test -n ${TEST_NETWORK_NAME}tap tv-app' + scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME down + - name: "Test: unit-tests (mbedtls)" if: steps.build_unit_tests_mbedtls.outcome == 'success' run: | diff --git a/config/openiotsdk/CMakeLists.txt b/config/openiotsdk/CMakeLists.txt index 70bb737b217563..eca153e3f59505 100644 --- a/config/openiotsdk/CMakeLists.txt +++ b/config/openiotsdk/CMakeLists.txt @@ -50,6 +50,7 @@ matter_common_gn_args( LIB_SHELL CONFIG_CHIP_LIB_SHELL LIB_TESTS CONFIG_CHIP_LIB_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} + PROJECT_CONFIG_INC_DIR ${CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS} ) matter_add_gn_arg_string("target_cpu" "${CMAKE_SYSTEM_PROCESSOR}") matter_add_gn_arg_string("openiotsdk_ar" ${CMAKE_AR}) diff --git a/config/openiotsdk/cmake/chip.cmake b/config/openiotsdk/cmake/chip.cmake index 5875d10dd88a4f..7b5d77fddf0fdb 100644 --- a/config/openiotsdk/cmake/chip.cmake +++ b/config/openiotsdk/cmake/chip.cmake @@ -23,6 +23,7 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) # Default CHIP build configuration set(CONFIG_CHIP_PROJECT_CONFIG "main/include/CHIPProjectConfig.h" CACHE STRING "") +set(CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS "" CACHE STRING "") set(CONFIG_CHIP_LIB_TESTS NO CACHE BOOL "") set(CONFIG_CHIP_LIB_SHELL NO CACHE BOOL "") diff --git a/docs/guides/openiotsdk_examples.md b/docs/guides/openiotsdk_examples.md index 289fa33aace366..b5cdd0fc026287 100644 --- a/docs/guides/openiotsdk_examples.md +++ b/docs/guides/openiotsdk_examples.md @@ -10,6 +10,7 @@ The list of currently supported Matter examples: ``` shell lock-app +tv-app ``` You can use these examples as a reference for creating your own applications. diff --git a/examples/platform/openiotsdk/supported_examples.txt b/examples/platform/openiotsdk/supported_examples.txt index 18e91e2080c38c..bbe7b8f70550f2 100644 --- a/examples/platform/openiotsdk/supported_examples.txt +++ b/examples/platform/openiotsdk/supported_examples.txt @@ -1,2 +1,3 @@ shell lock-app +tv-app diff --git a/examples/tv-app/openiotsdk/.gitignore b/examples/tv-app/openiotsdk/.gitignore new file mode 100644 index 00000000000000..567609b1234a9b --- /dev/null +++ b/examples/tv-app/openiotsdk/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/examples/tv-app/openiotsdk/CMakeLists.txt b/examples/tv-app/openiotsdk/CMakeLists.txt new file mode 100644 index 00000000000000..25756d070b8573 --- /dev/null +++ b/examples/tv-app/openiotsdk/CMakeLists.txt @@ -0,0 +1,79 @@ +# +# Copyright (c) 2022-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. +# + +cmake_minimum_required(VERSION 3.21) + +get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH) +get_filename_component(OPEN_IOT_SDK_CONFIG ${CHIP_ROOT}/config/openiotsdk REALPATH) +get_filename_component(OPEN_IOT_SDK_EXAMPLE_COMMON ${CHIP_ROOT}/examples/platform/openiotsdk REALPATH) +get_filename_component(TV_APP_COMMON ${CHIP_ROOT}/examples/tv-app/tv-common REALPATH) + +list(APPEND CMAKE_MODULE_PATH ${OPEN_IOT_SDK_CONFIG}/cmake) +list(APPEND CMAKE_MODULE_PATH ${TV_APP_COMMON}) + +set(APP_TARGET chip-openiotsdk-tv-app-example_ns) + +set(TFM_PROJECT_CONFIG_HEADER_FILE "${CMAKE_CURRENT_SOURCE_DIR}/tf-m-config/TfmProjectConfig.h") + +# Toolchain files need to exist before first call to project +include(toolchain) + +project(${APP_TARGET} LANGUAGES C CXX ASM) + +include(sdk) + +add_executable(${APP_TARGET}) + +# Application CHIP build configuration +set(CONFIG_CHIP_LIB_SHELL YES) +set(CONFIG_CHIP_PROJECT_CONFIG "../tv-common/include/CHIPProjectAppConfig.h") +set(CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS "\"${CMAKE_CURRENT_SOURCE_DIR}/main/include\"" ) +include(chip) + +add_subdirectory(${OPEN_IOT_SDK_EXAMPLE_COMMON}/app ./app_build) +target_include_directories(openiotsdk-app + PRIVATE + main/include +) + +chip_add_data_model(openiotsdk-app PUBLIC tv) + +# Add common lock-app sources +include(tv-app) +chip_add_tv_app_common(openiotsdk-app + SCOPE PUBLIC + SHELL_CMD CONFIG_CHIP_LIB_SHELL +) + +target_include_directories(${APP_TARGET} + PRIVATE + main/include +) + +target_sources(${APP_TARGET} + PRIVATE + main/main_ns.cpp +) + +target_link_libraries(${APP_TARGET} + openiotsdk-startup + openiotsdk-app +) + +include(linker) +set_target_link(${APP_TARGET}) + +sdk_post_build(${APP_TARGET}) diff --git a/examples/tv-app/openiotsdk/README.md b/examples/tv-app/openiotsdk/README.md new file mode 100644 index 00000000000000..8702f294e1ea43 --- /dev/null +++ b/examples/tv-app/openiotsdk/README.md @@ -0,0 +1,163 @@ +# Matter Open IoT SDK TV-App Example Application + +The Open IoT SDK TV Example is an example implementation of the Casting Video +Player device (refer to Video Player Architecture in the Matter Device Library +Specification document). It supports basic and content launching features. The +example includes a dummy application platform with a few hardcoded apps which +use the pre-defined settings to work. + +The TV example also functions as a commissionable node, device that can be +paired into an existing Matter network and can be controlled by it. + +> 💡 **Notes**: The Open IoT SDK platform implementation does not yet support +> the commissioner role, which means that some of its features are unavailable +> for this example. Therefore, it does not work properly with the Casting Video +> Client node like +> [CHIP TV Casting App Example](../../tv-casting-app/linux/README.md). + +## Build-run-test-debug + +For information on how to build, run, test and debug this example and further +information about the platform it is run on see +[Open IoT SDK examples](../../../docs/guides/openiotsdk_examples.md). + +The example name to use in the scripts is `tv-app`. + +## Example output + +When the example runs, these lines should be visible: + +``` +[INF] [-] Open IoT SDK tv-app example application start +... +[INF] [-] Open IoT SDK tv-app example application run +``` + +This means the `tv-app` application launched correctly and you can follow traces +in the terminal. + +## Shell commands + +The application supports Matter shell commands that allow managing the +application platform (see `examples/tv-app/tv-common/src/AppTvShellCommands.cpp` +implementation). Pass commands to the terminal and wait for the response. + +Example: + +``` +> app add 1 +[INF] [DL] GetLoadContentAppByVendorId() - vendorId 1, productId 0 +[INF] [DL] ContentAppFactoryImpl: LoadContentAppByAppId catalogVendorId=65521 applicationId=1 +[INF] [DL] Looking next=1 +[INF] [DL] Adding ContentApp with appid 1 +[INF] [ZCL] TV Linux App: ApplicationBasic::SetDefaultDelegate +[INF] [ZCL] TV Linux App: KeypadInput::SetDefaultDelegate +[INF] [ZCL] TV Linux App: ApplicationLauncher::SetDefaultDelegate +[INF] [ZCL] TV Linux App: AccountLogin::SetDefaultDelegate +[INF] [ZCL] TV Linux App: ContentLauncher::SetDefaultDelegate +[INF] [ZCL] TV Linux App: MediaPlayback::SetDefaultDelegate +[INF] [ZCL] TV Linux App: TargetNavigator::SetDefaultDelegate +[INF] [ZCL] TV Linux App: Channel::SetDefaultDelegate +[INF] [DL] Added ContentApp 1 to dynamic endpoint 4 (index=0) +[INF] [DL] added app +Done +``` + +Run the `app help` command to get all supported commands and their usage. + +## Commissioning + +Read the +[Open IoT SDK commissioning guide](../../../docs/guides/openiotsdk_commissioning.md) +to see how to use the Matter controller to commission and control the +application. + +### ApplicationBasic cluster usage + +One of the fully supported clusters by this example is `ApplicationBasic` +cluster. Use cluster commands to trigger actions on the device. You can issue +commands through the same Matter controller you used to perform the +commissioning step above. + +Before using the cluster commands, you need to add the application to the +platform using shell commands: + +``` +> app add 1 +``` + +Example command: + +``` +chip-tool applicationbasic read vendor-name 123 4 +``` + +The numeric arguments are: device node ID and device endpoint ID, respectively. + +The endpoint ID argument is the dynamically assigned endpoint that is associated +with the added application. You can refer to the output logs after completing +the application adding step to find this value, for example: + +``` +[INF] [DL] Added ContentApp 1 to dynamic endpoint 4 (index=0) +``` + +The device send a response with its vendor name and you should see this line in +the controller output: + +``` +CHIP:TOO: VendorName: Vendor1 +``` + +The `Vendor1` is the hardcoded value for this example. + +### ApplicationLauncher cluster usage + +The `Application Launcher` is the next example of the supported cluster. Use its +commands to trigger actions on the device. You can issue commands through the +same Matter controller you used to perform the commissioning step above. + +Before using the cluster commands, you need to add the application to the +platform using shell commands: + +``` +> app add 1 +``` + +Example command: + +``` +chip-tool applicationlauncher launch-app '{"catalogVendorID": 1, "applicationID": "1"}' 123 4 +``` + +The numeric arguments are: device node ID and device endpoint ID, respectively. + +The endpoint ID argument is the dynamically assigned endpoint that is associated +with the added application. You can refer to the output logs after completing +the application adding step to find this value, for example: + +``` +[INF] [DL] Added ContentApp 1 to dynamic endpoint 4 (index=0) +``` + +`catalogVendorID` and `applicationID` parameters are also printed after +completing the application adding step, for example: + +``` +[INF] [DL] ContentAppFactoryImpl: LoadContentAppByAppId catalogVendorId=65521 applicationId=1 +``` + +The device send a response that is printed to the controller output: + +``` +CHIP:TOO: LauncherResponse: { +CHIP:TOO: status: 0 +CHIP:TOO: data: 64617461 +CHIP:TOO: } +``` + +The example application confirms handling the command with the log: + +``` +[INF] [ZCL] ApplicationLauncherManager::HandleLaunchApp +``` diff --git a/examples/tv-app/openiotsdk/cmsis-config/RTE_Components.h b/examples/tv-app/openiotsdk/cmsis-config/RTE_Components.h new file mode 100644 index 00000000000000..e86df2b4e44e06 --- /dev/null +++ b/examples/tv-app/openiotsdk/cmsis-config/RTE_Components.h @@ -0,0 +1,22 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef RTE_COMPONENTS_H +#define RTE_COMPONENTS_H + +#endif // RTE_COMPONENTS_H diff --git a/examples/tv-app/openiotsdk/freertos-config/FreeRTOSConfig.h b/examples/tv-app/openiotsdk/freertos-config/FreeRTOSConfig.h new file mode 100644 index 00000000000000..9efedc9f133712 --- /dev/null +++ b/examples/tv-app/openiotsdk/freertos-config/FreeRTOSConfig.h @@ -0,0 +1,257 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html + *----------------------------------------------------------*/ + +#if (defined(__ARMCC_VERSION) || defined(__GNUC__) || defined(__ICCARM__)) +#include + +extern uint32_t SystemCoreClock; +#endif + +// Minimal stack size [words] <0-65535> +// Stack for idle task and default task stack in words. +// Default: 4kB +#define configMINIMAL_STACK_SIZE ((uint16_t)(4 * 1024)) + +// Total heap size [bytes] <0-0xFFFFFFFF> +// Heap memory size in bytes. +// Default: 32kB +#define configTOTAL_HEAP_SIZE ((size_t)(32 * 1024)) + +// Kernel tick frequency [Hz] <0-0xFFFFFFFF> +// Kernel tick rate in Hz. +// Default: 1000 +#define configTICK_RATE_HZ ((TickType_t) 1000) + +// Timer task stack depth [words] <0-65535> +// Stack for timer task in words. +// Default: 80 +#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE + +// Timer task priority <0-56> +// Timer task priority. +// Default: 40 (High) +#define configTIMER_TASK_PRIORITY 40 + +// Timer queue length <0-1024> +// Timer command queue length. +// Default: 5 +#define configTIMER_QUEUE_LENGTH 5 + +// Preemption interrupt priority +// Maximum priority of interrupts that are safe to call FreeRTOS API. +// Default: 16 +#define configMAX_SYSCALL_INTERRUPT_PRIORITY (5 << (8 - configPRIO_BITS)) + +// Use time slicing +// Enable setting to use timeslicing. +// Default: 1 +#define configUSE_TIME_SLICING 1 + +// Idle should yield +// Control Yield behaviour of the idle task. +// Default: 1 +#define configIDLE_SHOULD_YIELD 1 + +// Check for stack overflow +// <0=>Disable <1=>Method one <2=>Method two +// Enable or disable stack overflow checking. +// Callback function vApplicationStackOverflowHook implementation is required when stack checking is enabled. +// Default: 0 +#define configCHECK_FOR_STACK_OVERFLOW 2 + +// Use idle hook +// Enable callback function call on each idle task iteration. +// Callback function vApplicationIdleHook implementation is required when idle hook is enabled. +// Default: 0 +#define configUSE_IDLE_HOOK 0 + +// Use tick hook +// Enable callback function call during each tick interrupt. +// Callback function vApplicationTickHook implementation is required when tick hook is enabled. +// Default: 0 +#define configUSE_TICK_HOOK 0 + +// Use deamon task startup hook +// Enable callback function call when timer service starts. +// Callback function vApplicationDaemonTaskStartupHook implementation is required when deamon task startup hook is +// enabled. Default: 0 +#define configUSE_DAEMON_TASK_STARTUP_HOOK 0 + +// Use malloc failed hook +// Enable callback function call when out of dynamic memory. +// Callback function vApplicationMallocFailedHook implementation is required when malloc failed hook is enabled. +// Default: 0 +#define configUSE_MALLOC_FAILED_HOOK 0 + +// Queue registry size +// Define maximum number of queue objects registered for debug purposes. +// The queue registry is used by kernel aware debuggers to locate queue and semaphore structures and display +// associated text names. Default: 0 +#define configQUEUE_REGISTRY_SIZE 0 + +// Event Recorder configuration +// Initialize and setup Event Recorder level filtering. +// Settings have no effect when Event Recorder is not present. + +// Initialize Event Recorder +// Initialize Event Recorder before FreeRTOS kernel start. +// Default: 1 +#define configEVR_INITIALIZE 1 + +// Setup recording level filter +// Enable configuration of FreeRTOS events recording level +// Default: 1 +#define configEVR_SETUP_LEVEL 1 + +// Tasks functions +// Define event recording level bitmask for events generated from Tasks functions. +// Default: 0x05 +// <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All +#define configEVR_LEVEL_TASKS 0x05 + +// Queue functions +// Define event recording level bitmask for events generated from Queue functions. +// Default: 0x05 +// <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All +#define configEVR_LEVEL_QUEUE 0x05 + +// Timer functions +// Define event recording level bitmask for events generated from Timer functions. +// Default: 0x05 +// <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All +#define configEVR_LEVEL_TIMERS 0x05 + +// Event Groups functions +// Define event recording level bitmask for events generated from Event Groups functions. +// Default: 0x05 +// <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All +#define configEVR_LEVEL_EVENTGROUPS 0x05 + +// Heap functions +// Define event recording level bitmask for events generated from Heap functions. +// Default: 0x05 +// <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All +#define configEVR_LEVEL_HEAP 0x05 + +// Stream Buffer functions +// Define event recording level bitmask for events generated from Stream Buffer functions. +// Default: 0x05 +// <0x00=>Off <0x01=>Errors <0x05=>Errors + Operation <0x0F=>All +#define configEVR_LEVEL_STREAMBUFFER 0x05 +// +// + +// Port Specific Features +// Enable and configure port specific features. +// Check FreeRTOS documentation for definitions that apply for the used port. + +// Use Floating Point Unit +// Using Floating Point Unit (FPU) affects context handling. +// Enable FPU when application uses floating point operations. +// Default: 1 +#define configENABLE_FPU 1 + +// Use Memory Protection Unit +// Using Memory Protection Unit (MPU) requires detailed memory map definition. +// This setting is only releavant for MPU enabled ports. +// Default: 0 +#define configENABLE_MPU 0 + +// Use TrustZone Secure Side Only +// This settings prevents FreeRTOS contex switch to Non-Secure side. +// Enable this setting when FreeRTOS runs on the Secure side only. +#define configRUN_FREERTOS_SECURE_ONLY 0 + +// Use TrustZone Security Extension +// Using TrustZone affects context handling. +// Enable TrustZone when FreeRTOS runs on the Non-Secure side and calls functions from the Secure side. +// Default: 1 +#define configENABLE_TRUSTZONE 0 + +// Minimal secure stack size [words] <0-65535> +// Stack for idle task Secure side context in words. +// This setting is only relevant when TrustZone extension is enabled. +// Default: 128 +#define configMINIMAL_SECURE_STACK_SIZE ((uint32_t) 128) +// + +#ifdef __NVIC_PRIO_BITS +#define configPRIO_BITS __NVIC_PRIO_BITS +#else +#define configPRIO_BITS 4 +#endif + +//------------- <<< end of configuration section >>> --------------------------- + +/* Defines needed by FreeRTOS to implement CMSIS RTOS2 API. Do not change! */ +#define configCPU_CLOCK_HZ (SystemCoreClock) +#define configSUPPORT_STATIC_ALLOCATION 1 +#define configSUPPORT_DYNAMIC_ALLOCATION 1 +#define configUSE_PREEMPTION 1 +#define configUSE_TIMERS 1 +#define configUSE_MUTEXES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_TASK_NOTIFICATIONS 1 +#define configUSE_TRACE_FACILITY 1 +#define configUSE_16_BIT_TICKS 0 +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 +#define configMAX_PRIORITIES 56 +#define configKERNEL_INTERRUPT_PRIORITY (0x07 << (8 - configPRIO_BITS)) + +/* Defines that include FreeRTOS functions which implement CMSIS RTOS2 API. Do not change! */ +#define INCLUDE_xEventGroupSetBitsFromISR 1 +#define INCLUDE_xSemaphoreGetMutexHolder 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskDelayUntil 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_xTimerPendFunctionCall 1 + +/* Map the FreeRTOS port interrupt handlers to their CMSIS standard names. */ +#define xPortPendSVHandler PendSV_Handler +#define vPortSVCHandler SVC_Handler + +/* Ensure Cortex-M port compatibility. */ +#define SysTick_Handler xPortSysTickHandler + +#include "RTE_Components.h" +#include CMSIS_device_header + +#endif /* FREERTOS_CONFIG_H */ diff --git a/examples/tv-app/openiotsdk/main/include/CHIPProjectConfig.h b/examples/tv-app/openiotsdk/main/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..a85391b1a01cfd --- /dev/null +++ b/examples/tv-app/openiotsdk/main/include/CHIPProjectConfig.h @@ -0,0 +1,32 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0 +#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 + +#define CHIP_SHELL_PROMPT "Enter command:\r\n" + +// Commissioner role not supported +#undef CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY +#undef CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE diff --git a/examples/tv-app/openiotsdk/main/main_ns.cpp b/examples/tv-app/openiotsdk/main/main_ns.cpp new file mode 100644 index 00000000000000..f99b4199cc8179 --- /dev/null +++ b/examples/tv-app/openiotsdk/main/main_ns.cpp @@ -0,0 +1,97 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include + +#include "openiotsdk_platform.h" + +#include "AppTv.h" + +#ifdef CHIP_TV_APP_SHELL_CMD_ENABLE +#include "AppTvShellCommands.h" +#include +using namespace ::chip::Shell; +#endif // CHIP_TV_APP_SHELL_CMD_ENABLE + +using namespace ::chip; + +int main() +{ + if (openiotsdk_platform_init()) + { + ChipLogError(NotSpecified, "Open IoT SDK platform initialization failed"); + return EXIT_FAILURE; + } + + if (openiotsdk_chip_init()) + { + ChipLogError(NotSpecified, "Open IoT SDK CHIP stack initialization failed"); + return EXIT_FAILURE; + } + + ChipLogProgress(NotSpecified, "Open IoT SDK tv-app example application start"); + + if (openiotsdk_network_init(true)) + { + ChipLogError(NotSpecified, "Network initialization failed"); + return EXIT_FAILURE; + } + + if (openiotsdk_chip_run()) + { + ChipLogError(NotSpecified, "CHIP stack run failed"); + return EXIT_FAILURE; + } + +#ifdef CHIP_TV_APP_SHELL_CMD_ENABLE + // Initialize the default streamer that was linked. + int ret = Engine::Root().Init(); + if (ret) + { + ChipLogError(Shell, "Streamer initialization failed [%d]", ret); + return EXIT_FAILURE; + } + + RegisterAppTvCommands(); +#endif // CHIP_TV_APP_SHELL_CMD_ENABLE + + CHIP_ERROR err = AppTvInit(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "App TV initialization failed: %s", err.AsString()); + return EXIT_FAILURE; + } + + ChipLogProgress(NotSpecified, "Open IoT SDK tv-app example application run"); + +#ifdef CHIP_TV_APP_SHELL_CMD_ENABLE + Engine::Root().RunMainLoop(); +#else + while (true) + { + // Add forever delay to ensure proper workload for this thread + osDelay(osWaitForever); + } +#endif // CHIP_TV_APP_SHELL_CMD_ENABLE + + openiotsdk_chip_shutdown(); + + return EXIT_SUCCESS; +} diff --git a/examples/tv-app/openiotsdk/tf-m-config/TfmProjectConfig.h b/examples/tv-app/openiotsdk/tf-m-config/TfmProjectConfig.h new file mode 100644 index 00000000000000..a792f400bd2660 --- /dev/null +++ b/examples/tv-app/openiotsdk/tf-m-config/TfmProjectConfig.h @@ -0,0 +1,165 @@ +/* + * + * Copyright (c) 2023 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. + */ + +#ifndef TFM_PROJECT_CONFIG_H +#define TFM_PROJECT_CONFIG_H + +/* Platform Partition Configs */ + +/* Size of input buffer in platform service */ +#define PLATFORM_SERVICE_INPUT_BUFFER_SIZE 64 + +/* Size of output buffer in platform service */ +#define PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE 64 + +/* The stack size of the Platform Secure Partition */ +#define PLATFORM_SP_STACK_SIZE 0x500 + +/* Disable Non-volatile counter module */ +#define PLATFORM_NV_COUNTER_MODULE_DISABLED 0 + +/* Crypto Partition Configs */ + +/* + * Heap size for the crypto backend + * CRYPTO_ENGINE_BUF_SIZE needs to be >8KB for EC signing by attest module. + */ +#define CRYPTO_ENGINE_BUF_SIZE 0x2080 + +/* The max number of concurrent operations that can be active (allocated) at any time in Crypto */ +#define CRYPTO_CONC_OPER_NUM 8 + +/* Enable PSA Crypto random number generator module */ +#define CRYPTO_RNG_MODULE_ENABLED 1 + +/* Enable PSA Crypto Key module */ +#define CRYPTO_KEY_MODULE_ENABLED 1 + +/* Enable PSA Crypto AEAD module */ +#define CRYPTO_AEAD_MODULE_ENABLED 1 + +/* Enable PSA Crypto MAC module */ +#define CRYPTO_MAC_MODULE_ENABLED 1 + +/* Enable PSA Crypto Hash module */ +#define CRYPTO_HASH_MODULE_ENABLED 1 + +/* Enable PSA Crypto Cipher module */ +#define CRYPTO_CIPHER_MODULE_ENABLED 1 + +/* Enable PSA Crypto asymmetric key signature module */ +#define CRYPTO_ASYM_SIGN_MODULE_ENABLED 1 + +/* Enable PSA Crypto asymmetric key encryption module */ +#define CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED 0 + +/* Enable PSA Crypto key derivation module */ +#define CRYPTO_KEY_DERIVATION_MODULE_ENABLED 1 + +/* Default size of the internal scratch buffer used for PSA FF IOVec allocations */ +#define CRYPTO_IOVEC_BUFFER_SIZE 5120 + +/* Use stored NV seed to provide entropy */ +#define CRYPTO_NV_SEED 1 + +/* + * Only enable multi-part operations in Hash, MAC, AEAD and symmetric ciphers, + * to optimize memory footprint in resource-constrained devices. + */ +#define CRYPTO_SINGLE_PART_FUNCS_DISABLED 0 + +/* The stack size of the Crypto Secure Partition */ +#define CRYPTO_STACK_SIZE 0x1B00 + +/* FWU Partition Configs */ + +/* Size of the FWU internal data transfer buffer */ +#define TFM_FWU_BUF_SIZE PSA_FWU_MAX_WRITE_SIZE + +/* The stack size of the Firmware Update Secure Partition */ +#define FWU_STACK_SIZE 0x600 + +/* Attest Partition Configs */ + +/* Include optional claims in initial attestation token */ +#define ATTEST_INCLUDE_OPTIONAL_CLAIMS 1 + +/* Include COSE key-id in initial attestation token */ +#define ATTEST_INCLUDE_COSE_KEY_ID 0 + +/* The stack size of the Initial Attestation Secure Partition */ +#define ATTEST_STACK_SIZE 0x700 + +/* Set the initial attestation token profile */ +#define ATTEST_TOKEN_PROFILE_PSA_IOT_1 1 + +/* ITS Partition Configs */ + +/* Create flash FS if it doesn't exist for Internal Trusted Storage partition */ +#define ITS_CREATE_FLASH_LAYOUT 1 + +/* Enable emulated RAM FS for platforms that don't have flash for Internal Trusted Storage partition */ +#define ITS_RAM_FS 0 + +/* Validate filesystem metadata every time it is read from flash */ +#define ITS_VALIDATE_METADATA_FROM_FLASH 1 + +/* The maximum asset size to be stored in the Internal Trusted Storage */ +#define ITS_MAX_ASSET_SIZE 512 + +/* Size of the ITS internal data transfer buffer */ +#define ITS_BUF_SIZE 32 + +/* The maximum number of assets to be stored in the Internal Trusted Storage */ +#define ITS_NUM_ASSETS 10 + +/* The stack size of the Internal Trusted Storage Secure Partition */ +#define ITS_STACK_SIZE 0x720 + +/* PS Partition Configs */ + +/* Create flash FS if it doesn't exist for Protected Storage partition */ +#define PS_CREATE_FLASH_LAYOUT 1 + +/* Enable emulated RAM FS for platforms that don't have flash for Protected Storage partition */ +#define PS_RAM_FS 0 + +/* Enable rollback protection for Protected Storage partition */ +#define PS_ROLLBACK_PROTECTION 1 + +/* Validate filesystem metadata every time it is read from flash */ +#define PS_VALIDATE_METADATA_FROM_FLASH 1 + +/* The maximum asset size to be stored in the Protected Storage */ +#define PS_MAX_ASSET_SIZE 2048 + +/* The maximum number of assets to be stored in the Protected Storage */ +#define PS_NUM_ASSETS 30 + +/* The stack size of the Protected Storage Secure Partition */ +#define PS_STACK_SIZE 0x700 + +/* SPM Partition Configs */ + +/* The maximal number of secure services that are connected or requested at the same time */ +#define CONFIG_TFM_CONN_HANDLE_MAX_NUM 8 + +/* Enable the doorbell APIs */ +#define CONFIG_TFM_DOORBELL_API 1 + +#endif /* TFM_PROJECT_CONFIG_H */ diff --git a/src/test_driver/openiotsdk/integration-tests/tv-app/__init__.py b/src/test_driver/openiotsdk/integration-tests/tv-app/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/src/test_driver/openiotsdk/integration-tests/tv-app/test_app.py b/src/test_driver/openiotsdk/integration-tests/tv-app/test_app.py new file mode 100644 index 00000000000000..32e5674af59f1b --- /dev/null +++ b/src/test_driver/openiotsdk/integration-tests/tv-app/test_app.py @@ -0,0 +1,569 @@ +# +# Copyright (c) 2023 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 logging +import os +import re + +import chip.native +import pytest +from chip import exceptions +from chip.clusters.Objects import ApplicationLauncher, Channel, ContentLauncher, KeypadInput, MediaPlayback, TargetNavigator +from common.utils import (connect_device, disconnect_device, discover_device, get_log_messages_from_response, get_setup_payload, + get_shell_commands_from_help_response, read_zcl_attribute, send_zcl_command) + +cecKeyCode = KeypadInput.Enums.CecKeyCode +log = logging.getLogger(__name__) + + +@pytest.fixture(scope="session") +def binaryPath(request, rootDir): + if request.config.getoption('binaryPath'): + return request.config.getoption('binaryPath') + else: + return os.path.join(rootDir, 'examples/tv-app/openiotsdk/build/chip-openiotsdk-tv-app-example.elf') + + +@pytest.fixture(scope="session") +def controllerConfig(request): + config = { + 'vendorId': 0xFFF1, + 'fabricId': 1, + 'persistentStoragePath': '/tmp/openiotsdk-test-storage.json' + } + return config + + +@pytest.mark.smoketest +def test_smoke_test(device): + ret = device.wait_for_output("Open IoT SDK tv-app example application start") + assert ret is not None and len(ret) > 0 + ret = device.wait_for_output("Open IoT SDK tv-app example application run") + assert ret is not None and len(ret) > 0 + + +@pytest.mark.commissioningtest +def test_commissioning(device, controller): + assert controller is not None + devCtrl = controller + + ret = device.wait_for_output("Open IoT SDK tv-app example application start") + assert ret is not None and len(ret) > 0 + + setupPayload = get_setup_payload(device) + assert setupPayload is not None + + commissionable_device = discover_device(devCtrl, setupPayload) + assert commissionable_device is not None + + assert commissionable_device.vendorId == int(setupPayload.attributes['VendorID']) + assert commissionable_device.productId == int(setupPayload.attributes['ProductID']) + assert commissionable_device.addresses[0] is not None + + nodeId = connect_device(devCtrl, setupPayload, commissionable_device) + assert nodeId is not None + log.info("Device {} connected".format(commissionable_device.addresses[0])) + + ret = device.wait_for_output("Commissioning completed successfully") + assert ret is not None and len(ret) > 0 + + assert disconnect_device(devCtrl, nodeId) + + +SHELL_MAIN_COMMANDS_NAME = ["base64", "exit", "help", "version", + "config", "device", "onboardingcodes", "dns", + "app"] + +SHELL_APP_COMMANDS_NAME = ["help", "add", "remove", "setpin", + "add-admin-vendor"] + +TV_CTRL_TEST_APP_PID = 1 +TV_CTRL_TEST_APP_PIN_CODE = "34567890" +TV_CTRL_TEST_APP_ADMIN_VENDOR_ID = 65521 + + +@pytest.mark.ctrltest +def test_command_check(device): + try: + chip.native.Init() + except exceptions.ChipStackException as ex: + log.error("CHIP initialization failed {}".format(ex)) + assert False + except Exception: + log.error("CHIP initialization failed") + assert False + + ret = device.wait_for_output("Open IoT SDK tv-app example application start") + assert ret is not None and len(ret) > 0 + ret = device.wait_for_output("Open IoT SDK tv-app example application run") + assert ret is not None and len(ret) > 0 + + # Wait for printing prompt + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + + # Help + ret = device.send(command="help", expected_output="Done") + assert ret is not None and len(ret) > 1 + main_commands = get_shell_commands_from_help_response(ret[1:-1]) + assert set(SHELL_MAIN_COMMANDS_NAME) == set(main_commands) + + # App help + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + ret = device.send(command="app help", expected_output="Done") + assert ret is not None and len(ret) > 1 + app_commands = get_shell_commands_from_help_response(ret[1:-2]) + assert set(SHELL_APP_COMMANDS_NAME) == set(app_commands) + + # App add + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + ret = device.send(command="app add {}".format(TV_CTRL_TEST_APP_PID), expected_output="Done") + assert ret is not None and len(ret) > 1 + log_messages = get_log_messages_from_response(ret[1:-1]) + assert log_messages[-1] == "added app" + result = re.findall(r'\d+', log_messages[-2]) + application_id = int(result[0]) + endpoint = int(result[1]) + index = int(result[2]) + assert application_id == TV_CTRL_TEST_APP_PID + + # App set pin + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + ret = device.send(command="app setpin {} {}".format(endpoint, TV_CTRL_TEST_APP_PIN_CODE), expected_output="Done") + assert ret is not None and len(ret) > 1 + log_messages = get_log_messages_from_response(ret[1:-1]) + assert log_messages[-1] == "set pin success" + + # App remove + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + ret = device.send(command="app remove {}".format(endpoint), expected_output="Done") + assert ret is not None and len(ret) > 1 + log_messages = get_log_messages_from_response(ret[1:-1]) + assert log_messages[-2] == "Removed device {} from dynamic endpoint {} (index={})".format(application_id, endpoint, index) + assert log_messages[-1] == "removed app" + + # App add admin vendor + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + ret = device.send(command="app add-admin-vendor {}".format(TV_CTRL_TEST_APP_ADMIN_VENDOR_ID), expected_output="Done") + assert ret is not None and len(ret) > 1 + log_messages = "added admin-vendor" + + +TV_CTRL_TEST_APP_ENDPOINT_ID = 1 +TV_CTRL_TEST_APP_VENDOR_NAME = "Vendor1" +TV_CTRL_TEST_APP_NAME = "exampleid" +TV_CTRL_TEST_APP_PRODUCT_ID = 11 +TV_CTRL_TEST_APP_VERSION = "Version1" +TV_CTRL_TEST_APP_TMP_ACCOUNT_ID = "tempAccountId" +TV_CTRL_TEST_APP_CATALOG_LIST = [123, 456] +TV_CTRL_TEST_CONTENT_PARAMETER_TYPE_1 = ContentLauncher.Enums.ParameterEnum.kActor +TV_CTRL_TEST_CONTENT_PARAMETER_VALUE_1 = "Gaby sHoffman" +TV_CTRL_TEST_CONTENT_PARAMETER_TYPE_2 = ContentLauncher.Enums.ParameterEnum.kEvent +TV_CTRL_TEST_CONTENT_PARAMETER_VALUE_2 = "Football games" +TV_CTRL_TEST_CONTENT_URL = "https://testurl" +TV_CTRL_TEST_CONTENT_DISPLAY_STRING = "Test string" +TV_CTRL_TEST_CONTENT_PROVIDER_NAME = "Test provider name" +TV_CTRL_TEST_KEY_PAD_SUPPORTED_KEY_LIST = [cecKeyCode.kUp, cecKeyCode.kDown, cecKeyCode.kLeft, cecKeyCode.kRight, + cecKeyCode.kSelect, cecKeyCode.kBackward, cecKeyCode.kExit, cecKeyCode.kRootMenu, cecKeyCode.kSetupMenu] +TV_CTRL_TEST_KEY_PAD_UNSUPPORTED_KEY = cecKeyCode.kDisplayInformation +TV_CTRL_TEST_NAME = "Test name" + + +@pytest.mark.ctrltest +def test_tv_ctrl(device, controller): + assert controller is not None + devCtrl = controller + + ret = device.wait_for_output("Open IoT SDK tv-app example application start") + assert ret is not None and len(ret) > 0 + + setupPayload = get_setup_payload(device) + assert setupPayload is not None + + # App add + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + ret = device.send(command="app add {}".format(TV_CTRL_TEST_APP_PID), expected_output="Done") + assert ret is not None and len(ret) > 1 + log_messages = get_log_messages_from_response(ret[1:-1]) + assert log_messages[-1] == "added app" + result = re.findall(r'\d+', log_messages[-2]) + application_id = int(result[0]) + endpoint = int(result[1]) + + # App set pin + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + ret = device.send(command="app setpin {} {}".format(endpoint, TV_CTRL_TEST_APP_PIN_CODE), expected_output="Done") + assert ret is not None and len(ret) > 1 + log_messages = get_log_messages_from_response(ret[1:-1]) + assert log_messages[-1] == "set pin success" + + # App add admin vendor + ret = device.wait_for_output("Enter command") + assert ret is not None and len(ret) > 0 + ret = device.send(command="app add-admin-vendor {}".format(TV_CTRL_TEST_APP_ADMIN_VENDOR_ID), expected_output="Done") + assert ret is not None and len(ret) > 1 + log_messages = "added admin-vendor" + + commissionable_device = discover_device(devCtrl, setupPayload) + assert commissionable_device is not None + + nodeId = connect_device(devCtrl, setupPayload, commissionable_device) + assert nodeId is not None + + ret = device.wait_for_output("Commissioning completed successfully") + assert ret is not None and len(ret) > 0 + + # ApplicationBasic + err, res = read_zcl_attribute(devCtrl, "ApplicationBasic", "VendorName", nodeId, endpoint) + assert err == 0 + assert res.value == TV_CTRL_TEST_APP_VENDOR_NAME + + err, res = read_zcl_attribute(devCtrl, "ApplicationBasic", "VendorID", nodeId, endpoint) + assert err == 0 + assert res.value == TV_CTRL_TEST_APP_PID + + err, res = read_zcl_attribute(devCtrl, "ApplicationBasic", "ApplicationName", nodeId, endpoint) + assert err == 0 + assert res.value == TV_CTRL_TEST_APP_NAME + + err, res = read_zcl_attribute(devCtrl, "ApplicationBasic", "ProductID", nodeId, endpoint) + assert err == 0 + assert res.value == TV_CTRL_TEST_APP_PRODUCT_ID + + err, res = read_zcl_attribute(devCtrl, "ApplicationBasic", "ApplicationVersion", nodeId, endpoint) + assert err == 0 + assert res.value == TV_CTRL_TEST_APP_VERSION + + # AccountLogin + err, res = send_zcl_command(devCtrl, "AccountLogin", "GetSetupPIN", nodeId, endpoint, + dict(tempAccountIdentifier=TV_CTRL_TEST_APP_TMP_ACCOUNT_ID), + requestTimeoutMs=1000) + assert err == 0 + assert res.setupPIN == TV_CTRL_TEST_APP_PIN_CODE + + err, res = send_zcl_command(devCtrl, "AccountLogin", "Login", nodeId, endpoint, + dict(tempAccountIdentifier=TV_CTRL_TEST_APP_TMP_ACCOUNT_ID, setupPIN=TV_CTRL_TEST_APP_PIN_CODE), + requestTimeoutMs=1000) + assert err == 0 + ret = device.wait_for_output("AccountLoginManager::HandleLogin success") + assert ret is not None and len(ret) > 0 + + err, res = send_zcl_command(devCtrl, "AccountLogin", "Logout", nodeId, endpoint, + None, + requestTimeoutMs=1000) + assert err == 0 + ret = device.wait_for_output("AccountLoginManager::HandleLogout success") + assert ret is not None and len(ret) > 0 + + # ApplicationLauncher + err, res = send_zcl_command(devCtrl, "ApplicationLauncher", "LaunchApp", nodeId, endpoint, + dict(application=ApplicationLauncher.Structs.ApplicationStruct( + catalogVendorID=TV_CTRL_TEST_APP_ADMIN_VENDOR_ID, applicationID=application_id)), + requestTimeoutMs=1000) + assert err == 0 + assert res.status == ApplicationLauncher.Enums.ApplicationLauncherStatusEnum.kSuccess + ret = device.wait_for_output("ApplicationLauncherManager::HandleLaunchApp") + assert ret is not None and len(ret) > 0 + + err, res = send_zcl_command(devCtrl, "ApplicationLauncher", "StopApp", nodeId, endpoint, + dict(application=ApplicationLauncher.Structs.ApplicationStruct( + catalogVendorID=TV_CTRL_TEST_APP_ADMIN_VENDOR_ID, applicationID=application_id)), + requestTimeoutMs=1000) + assert err == 0 + assert res.status == ApplicationLauncher.Enums.ApplicationLauncherStatusEnum.kSuccess + ret = device.wait_for_output("ApplicationLauncherManager::HandleStopApp") + assert ret is not None and len(ret) > 0 + + err, res = send_zcl_command(devCtrl, "ApplicationLauncher", "HideApp", nodeId, endpoint, + dict(application=ApplicationLauncher.Structs.ApplicationStruct( + catalogVendorID=TV_CTRL_TEST_APP_ADMIN_VENDOR_ID, applicationID=application_id)), + requestTimeoutMs=1000) + assert err == 0 + assert res.status == ApplicationLauncher.Enums.ApplicationLauncherStatusEnum.kSuccess + ret = device.wait_for_output("ApplicationLauncherManager::HandleHideApp") + assert ret is not None and len(ret) > 0 + + err, res = read_zcl_attribute(devCtrl, "ApplicationLauncher", "CatalogList", nodeId, endpoint) + assert err == 0 + assert res.value == TV_CTRL_TEST_APP_CATALOG_LIST + + # Channel + err, res = read_zcl_attribute(devCtrl, "Channel", "ChannelList", nodeId, endpoint) + assert err == 0 + assert res.status == 0 + channels = res.value + + err, res = read_zcl_attribute(devCtrl, "Channel", "Lineup", nodeId, endpoint) + assert err == 0 + assert res.value.lineupInfoType == Channel.Enums.LineupInfoTypeEnum.kMso + + err, res = read_zcl_attribute(devCtrl, "Channel", "CurrentChannel", nodeId, endpoint) + assert err == 0 + assert res.value == channels[0] + + err, res = send_zcl_command(devCtrl, "Channel", "ChangeChannel", nodeId, endpoint, + dict(match=channels[1].name), + requestTimeoutMs=1000) + assert err == 0 + assert res.status == Channel.Enums.ChannelStatusEnum.kSuccess + + err, res = read_zcl_attribute(devCtrl, "Channel", "CurrentChannel", nodeId, endpoint) + assert err == 0 + assert res.value == channels[1] + + err, res = send_zcl_command(devCtrl, "Channel", "ChangeChannelByNumber", nodeId, endpoint, + dict(majorNumber=channels[0].majorNumber, minorNumber=channels[0].minorNumber), + requestTimeoutMs=1000) + assert err == 0 + + err, res = read_zcl_attribute(devCtrl, "Channel", "CurrentChannel", nodeId, endpoint) + assert err == 0 + assert res.value == channels[0] + + err, res = send_zcl_command(devCtrl, "Channel", "SkipChannel", nodeId, endpoint, + dict(count=1), + requestTimeoutMs=1000) + assert err == 0 + + err, res = read_zcl_attribute(devCtrl, "Channel", "CurrentChannel", nodeId, endpoint) + assert err == 0 + assert res.value == channels[1] + + # ContentLauncher + err, res = read_zcl_attribute(devCtrl, "ContentLauncher", "AcceptHeader", nodeId, endpoint) + assert err == 0 + assert res.status == 0 + ret = device.wait_for_output("ContentLauncherManager::HandleGetAcceptHeaderList") + assert ret is not None and len(ret) > 0 + + err, res = read_zcl_attribute(devCtrl, "ContentLauncher", "SupportedStreamingProtocols", nodeId, endpoint) + assert err == 0 + assert res.value == ContentLauncher.Bitmaps.SupportedStreamingProtocol.kDash | ContentLauncher.Bitmaps.SupportedStreamingProtocol.kHls + + err, res = send_zcl_command(devCtrl, "ContentLauncher", "LaunchContent", nodeId, endpoint, + dict(search=ContentLauncher.Structs.ContentSearchStruct(parameterList=[ + ContentLauncher.Structs.ParameterStruct( + type=TV_CTRL_TEST_CONTENT_PARAMETER_TYPE_1, + value=TV_CTRL_TEST_CONTENT_PARAMETER_VALUE_1), + ContentLauncher.Structs.ParameterStruct( + type=TV_CTRL_TEST_CONTENT_PARAMETER_TYPE_2, + value=TV_CTRL_TEST_CONTENT_PARAMETER_VALUE_2) + ]), + autoPlay=True, data=None), + requestTimeoutMs=1000) + assert err == 0 + assert res.status == ContentLauncher.Enums.ContentLaunchStatusEnum.kSuccess + ret = device.wait_for_output("ContentLauncherManager::HandleLaunchContent") + assert ret is not None and len(ret) > 0 + ret = device.wait_for_output("TEST CASE found match=TV Show Example type={}".format(TV_CTRL_TEST_CONTENT_PARAMETER_TYPE_1)) + assert ret is not None and len(ret) > 0 + ret = device.wait_for_output("TEST CASE found match=Sports Example type={}".format(TV_CTRL_TEST_CONTENT_PARAMETER_TYPE_2)) + assert ret is not None and len(ret) > 0 + + err, res = send_zcl_command(devCtrl, "ContentLauncher", "LaunchURL", nodeId, endpoint, + dict(contentURL=TV_CTRL_TEST_CONTENT_URL, + displayString=TV_CTRL_TEST_CONTENT_DISPLAY_STRING, + brandingInformation=ContentLauncher.Structs.BrandingInformationStruct( + providerName=TV_CTRL_TEST_CONTENT_PROVIDER_NAME, + background=None, + logo=None, + progressBar=None, + splash=None, + waterMark=None + )), + requestTimeoutMs=1000) + assert err == 0 + assert res.status == ContentLauncher.Enums.ContentLaunchStatusEnum.kSuccess + ret = device.wait_for_output("ContentLauncherManager::HandleLaunchUrl") + assert ret is not None and len(ret) > 0 + ret = device.wait_for_output("ContentLauncherManager::HandleLaunchUrl TEST CASE ContentURL={} DisplayString={} BrandingInformation.ProviderName={}".format( + TV_CTRL_TEST_CONTENT_URL, + TV_CTRL_TEST_CONTENT_DISPLAY_STRING, + TV_CTRL_TEST_CONTENT_PROVIDER_NAME)) + assert ret is not None and len(ret) > 0 + + # KeypadInput + for keyCode in TV_CTRL_TEST_KEY_PAD_SUPPORTED_KEY_LIST: + err, res = send_zcl_command(devCtrl, "KeypadInput", "SendKey", nodeId, endpoint, + dict(keyCode=keyCode), requestTimeoutMs=1000) + assert err == 0 + assert res.status == KeypadInput.Enums.KeypadInputStatusEnum.kSuccess + + err, res = send_zcl_command(devCtrl, "KeypadInput", "SendKey", nodeId, endpoint, + dict(keyCode=TV_CTRL_TEST_KEY_PAD_UNSUPPORTED_KEY), + requestTimeoutMs=1000) + assert err == 0 + assert res.status == KeypadInput.Enums.KeypadInputStatusEnum.kUnsupportedKey + + # TargetNavigator + err, res = read_zcl_attribute(devCtrl, "TargetNavigator", "TargetList", nodeId, endpoint) + assert err == 0 + assert res.status == 0 + + err, res = read_zcl_attribute(devCtrl, "TargetNavigator", "CurrentTarget", nodeId, endpoint) + assert err == 0 + assert res.status == 0 + current_target_id = res.value + + current_target_id += 1 + err, res = send_zcl_command(devCtrl, "TargetNavigator", "NavigateTarget", nodeId, endpoint, + dict(target=current_target_id, data=None), + requestTimeoutMs=1000) + assert err == 0 + assert res.status == TargetNavigator.Enums.TargetNavigatorStatusEnum.kSuccess + + err, res = read_zcl_attribute(devCtrl, "TargetNavigator", "CurrentTarget", nodeId, endpoint) + assert err == 0 + assert res.status == 0 + assert res.value == current_target_id + + # AudioOutput + err, res = read_zcl_attribute(devCtrl, "AudioOutput", "OutputList", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.status == 0 + + err, res = read_zcl_attribute(devCtrl, "AudioOutput", "CurrentOutput", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + current_audio_output = res.value + + current_audio_output += 1 + err, res = send_zcl_command(devCtrl, "AudioOutput", "SelectOutput", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + dict(index=current_audio_output), + requestTimeoutMs=1000) + assert err == 0 + + err, res = read_zcl_attribute(devCtrl, "AudioOutput", "CurrentOutput", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.value == current_audio_output + + err, res = send_zcl_command(devCtrl, "AudioOutput", "RenameOutput", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + dict(index=current_audio_output, name=TV_CTRL_TEST_NAME), + requestTimeoutMs=1000) + assert err == 0 + + err, res = read_zcl_attribute(devCtrl, "AudioOutput", "OutputList", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.status == 0 + audio_output = next(item for item in res.value if item.index == current_audio_output) + assert audio_output.name == TV_CTRL_TEST_NAME + + # MediaInput + err, res = read_zcl_attribute(devCtrl, "MediaInput", "InputList", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.status == 0 + media_inputs = res.value + + err, res = read_zcl_attribute(devCtrl, "MediaInput", "CurrentInput", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + current_media_input = res.value + + current_media_input += 1 + err, res = send_zcl_command(devCtrl, "MediaInput", "SelectInput", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + dict(index=current_media_input), + requestTimeoutMs=1000) + assert err == 0 + + err, res = read_zcl_attribute(devCtrl, "MediaInput", "CurrentInput", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.value == current_media_input + + err, res = send_zcl_command(devCtrl, "MediaInput", "ShowInputStatus", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + None, + requestTimeoutMs=1000) + assert err == 0 + ret = device.wait_for_output("MediaInputManager::HandleShowInputStatus") + assert ret is not None and len(ret) > 0 + for media_input in media_inputs: + ret = device.wait_for_output("[{}] type={} selected={} name={} desc={}".format( + media_input.index, + media_input.inputType, + 1 if media_input.index == current_media_input else 0, + media_input.name, + media_input.description + )) + assert ret is not None and len(ret) > 0 + + err, res = send_zcl_command(devCtrl, "MediaInput", "HideInputStatus", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + None, + requestTimeoutMs=1000) + assert err == 0 + ret = device.wait_for_output("MediaInputManager::HandleHideInputStatus") + assert ret is not None and len(ret) > 0 + + err, res = send_zcl_command(devCtrl, "MediaInput", "RenameInput", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + dict(index=current_media_input, name=TV_CTRL_TEST_NAME), + requestTimeoutMs=1000) + assert err == 0 + + err, res = read_zcl_attribute(devCtrl, "MediaInput", "InputList", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.status == 0 + media_input = next(item for item in res.value if item.index == current_media_input) + assert media_input.name == TV_CTRL_TEST_NAME + + # MediaPlayback + err, res = send_zcl_command(devCtrl, "MediaPlayback", "Pause", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + None, + requestTimeoutMs=1000) + assert err == 0 + assert res.status == MediaPlayback.Enums.MediaPlaybackStatusEnum.kSuccess + + err, res = read_zcl_attribute(devCtrl, "MediaPlayback", "CurrentState", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.value == MediaPlayback.Enums.PlaybackStateEnum.kPaused + + err, res = send_zcl_command(devCtrl, "MediaPlayback", "Stop", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + None, + requestTimeoutMs=1000) + assert err == 0 + assert res.status == MediaPlayback.Enums.MediaPlaybackStatusEnum.kSuccess + + err, res = read_zcl_attribute(devCtrl, "MediaPlayback", "CurrentState", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.value == MediaPlayback.Enums.PlaybackStateEnum.kNotPlaying + + err, res = send_zcl_command(devCtrl, "MediaPlayback", "Play", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + None, + requestTimeoutMs=1000) + assert err == 0 + assert res.status == MediaPlayback.Enums.MediaPlaybackStatusEnum.kSuccess + + err, res = read_zcl_attribute(devCtrl, "MediaPlayback", "CurrentState", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.value == MediaPlayback.Enums.PlaybackStateEnum.kPlaying + + # LowPower + err, res = send_zcl_command(devCtrl, "LowPower", "Sleep", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID, + None, + requestTimeoutMs=1000) + assert err == 0 + ret = device.wait_for_output("LowPowerManager::HandleSleep") + assert ret is not None and len(ret) > 0 + + # WakeOnLan + err, res = read_zcl_attribute(devCtrl, "WakeOnLan", "MACAddress", nodeId, TV_CTRL_TEST_APP_ENDPOINT_ID) + assert err == 0 + assert res.value == "0000000000" + + assert disconnect_device(devCtrl, nodeId) From 77b8d9f826775900164d5fdf0c8ad43ce96b3352 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Tue, 11 Jul 2023 16:54:52 -0400 Subject: [PATCH 33/34] Fix thread network scan list encode when no netowrk was found (#27896) --- .../network-commissioning.cpp | 91 ++++++++++--------- 1 file changed, 48 insertions(+), 43 deletions(-) diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index dcce1ab81683c2..1026105160ffbb 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -542,62 +542,67 @@ void Instance::OnFinished(Status status, CharSpan debugText, ThreadScanResponseI SuccessOrExit(err = writer->StartContainer(TLV::ContextTag(Commands::ScanNetworksResponse::Fields::kThreadScanResults), TLV::TLVType::kTLVType_Array, listContainerType)); - VerifyOrExit(scanResponseArray.Alloc(chip::min(networks->Count(), kMaxNetworksInScanResponse)), err = CHIP_ERROR_NO_MEMORY); - for (; networks != nullptr && networks->Next(scanResponse);) + // If no network was found, we encode an empty list, don't call a zero-sized alloc. + if (networks->Count() > 0) { - if ((scanResponseArrayLength == kMaxNetworksInScanResponse) && - (scanResponseArray[scanResponseArrayLength - 1].rssi > scanResponse.rssi)) + VerifyOrExit(scanResponseArray.Alloc(chip::min(networks->Count(), kMaxNetworksInScanResponse)), err = CHIP_ERROR_NO_MEMORY); + for (; networks != nullptr && networks->Next(scanResponse);) { - continue; - } + if ((scanResponseArrayLength == kMaxNetworksInScanResponse) && + (scanResponseArray[scanResponseArrayLength - 1].rssi > scanResponse.rssi)) + { + continue; + } - bool isDuplicated = false; + bool isDuplicated = false; - for (size_t i = 0; i < scanResponseArrayLength; i++) - { - if ((scanResponseArray[i].panId == scanResponse.panId) && - (scanResponseArray[i].extendedPanId == scanResponse.extendedPanId)) + for (size_t i = 0; i < scanResponseArrayLength; i++) { - if (scanResponseArray[i].rssi < scanResponse.rssi) + if ((scanResponseArray[i].panId == scanResponse.panId) && + (scanResponseArray[i].extendedPanId == scanResponse.extendedPanId)) { - scanResponseArray[i] = scanResponseArray[--scanResponseArrayLength]; + if (scanResponseArray[i].rssi < scanResponse.rssi) + { + scanResponseArray[i] = scanResponseArray[--scanResponseArrayLength]; + } + else + { + isDuplicated = true; + } + break; } - else - { - isDuplicated = true; - } - break; } - } - if (isDuplicated) - { - continue; + 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; }); } - if (scanResponseArrayLength < kMaxNetworksInScanResponse) + for (size_t i = 0; i < scanResponseArrayLength; i++) { - scanResponseArrayLength++; + 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)); } - 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)); From 7fc3ccba35d4df7d2d3ba8603ff72d218af0b1a7 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 11 Jul 2023 17:31:26 -0400 Subject: [PATCH 34/34] Make tracedecoder not stateful and ensure both sent and received messages are logged (#27860) * Make TraceDecoder not stateful, log inbound/outbount * Restyle * Ensure sending message data has destination peer address * Restyle * Add missing comma * Restyle * Remove unused constants * Restyled by clang-format * Apply code review comments * Restyled by clang-format * Code review fix * Avoid unused variable errors * Restyle --------- Co-authored-by: Restyled.io Co-authored-by: Andrei Litvin --- examples/common/tracing/TraceDecoder.cpp | 137 ++++++++-------------- examples/common/tracing/TraceDecoder.h | 9 +- examples/common/tracing/TraceHandlers.cpp | 6 +- src/transport/Session.h | 1 - src/transport/SessionManager.cpp | 13 +- src/transport/TraceMessage.h | 9 +- 6 files changed, 75 insertions(+), 100 deletions(-) diff --git a/examples/common/tracing/TraceDecoder.cpp b/examples/common/tracing/TraceDecoder.cpp index 2bb3c5ee213ce0..7aecfa2bacb08e 100644 --- a/examples/common/tracing/TraceDecoder.cpp +++ b/examples/common/tracing/TraceDecoder.cpp @@ -30,31 +30,43 @@ constexpr uint16_t kMaxLineLen = 4096; constexpr const char * jsonPrefix = " json\t"; -// Json keys -constexpr const char * kProtocolIdKey = "protocol_id"; -constexpr const char * kProtocolCodeKey = "protocol_opcode"; -constexpr const char * kSessionIdKey = "session_id"; -constexpr const char * kExchangeIdKey = "exchange_id"; -constexpr const char * kMessageCounterKey = "msg_counter"; -constexpr const char * kSecurityFlagsKey = "security_flags"; -constexpr const char * kMessageFlagsKey = "msg_flags"; -constexpr const char * kSourceNodeIdKey = "source_node_id"; -constexpr const char * kDestinationNodeIdKey = "dest_node_id"; -constexpr const char * kDestinationGroupIdKey = "group_id"; -constexpr const char * kExchangeFlagsKey = "exchange_flags"; -constexpr const char * kIsInitiatorKey = "is_initiator"; -constexpr const char * kNeedsAckKey = "is_ack_requested"; -constexpr const char * kAckMsgKey = "acknowledged_msg_counter"; -constexpr const char * kPayloadDataKey = "payload_hex"; -constexpr const char * kPayloadSizeKey = "payload_size"; -constexpr const char * kPayloadEncryptedDataKey = "payload_hex_encrypted"; -constexpr const char * kPayloadEncryptedSizeKey = "payload_size_encrypted"; -constexpr const char * kPayloadEncryptedBufferPtrKey = "buffer_ptr"; -constexpr const char * kSourceKey = "source"; -constexpr const char * kDestinationKey = "destination"; - namespace chip { namespace trace { +namespace { + +// Json keys +constexpr const char * kProtocolIdKey = "protocol_id"; +constexpr const char * kProtocolCodeKey = "protocol_opcode"; +constexpr const char * kSessionIdKey = "session_id"; +constexpr const char * kExchangeIdKey = "exchange_id"; +constexpr const char * kMessageCounterKey = "msg_counter"; +constexpr const char * kSecurityFlagsKey = "security_flags"; +constexpr const char * kMessageFlagsKey = "msg_flags"; +constexpr const char * kSourceNodeIdKey = "source_node_id"; +constexpr const char * kDestinationNodeIdKey = "dest_node_id"; +constexpr const char * kDestinationGroupIdKey = "group_id"; +constexpr const char * kExchangeFlagsKey = "exchange_flags"; +constexpr const char * kIsInitiatorKey = "is_initiator"; +constexpr const char * kNeedsAckKey = "is_ack_requested"; +constexpr const char * kAckMsgKey = "acknowledged_msg_counter"; +constexpr const char * kPayloadDataKey = "payload_hex"; +constexpr const char * kPayloadSizeKey = "payload_size"; +constexpr const char * kDirectionKey = "direction"; +constexpr const char * kPeerAddress = "peer_address"; + +bool IsOutbound(const Json::Value & json) +{ + VerifyOrReturnValue(json.isMember(kDirectionKey), false); + return strcmp(json[kDirectionKey].asCString(), "outbound") == 0; +} + +bool IsInbound(const Json::Value & json) +{ + VerifyOrReturnValue(json.isMember(kDirectionKey), false); + return strcmp(json[kDirectionKey].asCString(), "inbound") == 0; +} + +} // namespace using namespace logging; @@ -83,45 +95,8 @@ CHIP_ERROR TraceDecoder::ReadString(const char * str) str += strlen(jsonPrefix); Json::Reader reader; - - if (mJsonBuffer.empty()) - { - VerifyOrReturnError(reader.parse(str, mJsonBuffer), CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(mJsonBuffer.isMember(kPayloadDataKey) && mJsonBuffer.isMember(kPayloadSizeKey), - CHIP_ERROR_INCORRECT_STATE); - return CHIP_NO_ERROR; - } - Json::Value json; VerifyOrReturnError(reader.parse(str, json), CHIP_ERROR_INVALID_ARGUMENT); - - // If there is a source, then it means the previously saved payload is an encrypted to decode, otherwise - // the previously saved payload is the non encrypted version, and the current decoded one is the encrypted version. - if (mJsonBuffer.isMember(kSourceKey)) - { - json[kPayloadEncryptedDataKey] = mJsonBuffer[kPayloadDataKey]; - json[kPayloadEncryptedSizeKey] = mJsonBuffer[kPayloadSizeKey]; - } - else - { - auto data = json[kPayloadDataKey]; - auto size = json[kPayloadSizeKey]; - json[kPayloadDataKey] = mJsonBuffer[kPayloadDataKey]; - json[kPayloadSizeKey] = mJsonBuffer[kPayloadSizeKey]; - json[kPayloadEncryptedDataKey] = data; - json[kPayloadEncryptedSizeKey] = size; - } - mJsonBuffer.removeMember(kPayloadDataKey); - mJsonBuffer.removeMember(kPayloadSizeKey); - - // If there is additional data in the previously saved json copy all of it. - for (const auto & key : mJsonBuffer.getMemberNames()) - { - json[key] = mJsonBuffer[key]; - mJsonBuffer.removeMember(key); - } - - VerifyOrReturnError(json.isMember(kSourceKey) || json.isMember(kDestinationKey), CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(json.isMember(kProtocolIdKey), CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(json.isMember(kProtocolCodeKey), CHIP_ERROR_INCORRECT_STATE); @@ -138,20 +113,19 @@ CHIP_ERROR TraceDecoder::LogJSON(Json::Value & json) return CHIP_NO_ERROR; } - if (!mOptions.mEnableMessageInitiator && json.isMember(kDestinationKey)) + if (!mOptions.mEnableMessageInitiator && IsOutbound(json)) { return CHIP_NO_ERROR; } - if (!mOptions.mEnableMessageResponder && json.isMember(kSourceKey)) + if (!mOptions.mEnableMessageResponder && IsInbound(json)) { return CHIP_NO_ERROR; } - bool isResponse = json.isMember(kSourceKey) ? true : false; + bool isResponse = IsInbound(json); ReturnErrorOnFailure(LogAndConsumeProtocol(json)); ReturnErrorOnFailure(MaybeLogAndConsumeHeaderFlags(json)); - ReturnErrorOnFailure(MaybeLogAndConsumeEncryptedPayload(json)); ReturnErrorOnFailure(MaybeLogAndConsumePayload(json, isResponse)); ReturnErrorOnFailure(MaybeLogAndConsumeOthers(json)); @@ -168,26 +142,6 @@ CHIP_ERROR TraceDecoder::MaybeLogAndConsumeHeaderFlags(Json::Value & json) return CHIP_NO_ERROR; } -CHIP_ERROR TraceDecoder::MaybeLogAndConsumeEncryptedPayload(Json::Value & json) -{ - if (mOptions.mEnableDataEncryptedPayload) - { - size_t size = static_cast(json[kPayloadEncryptedSizeKey].asLargestUInt()); - if (size) - { - auto payload = json[kPayloadEncryptedDataKey].asString(); - auto bufferPtr = json[kPayloadEncryptedBufferPtrKey].asString(); - auto scopedIndent = ScopedLogIndentWithSize("Encrypted Payload", size); - Log("data", payload.c_str()); - Log("buffer_ptr", bufferPtr.c_str()); - } - } - json.removeMember(kPayloadEncryptedSizeKey); - json.removeMember(kPayloadEncryptedDataKey); - json.removeMember(kPayloadEncryptedBufferPtrKey); - return CHIP_NO_ERROR; -} - CHIP_ERROR TraceDecoder::MaybeLogAndConsumeOthers(Json::Value & json) { std::vector keys = json.getMemberNames(); @@ -218,8 +172,16 @@ CHIP_ERROR TraceDecoder::LogAndConsumeProtocol(Json::Value & json) chip::StringBuilderBase builder(protocolInfo, sizeof(protocolInfo)); - builder.Add(json.isMember(kSourceKey) ? "<< from " : ">> to "); - builder.Add(json.isMember(kSourceKey) ? json[kSourceKey].asCString() : json[kDestinationKey].asCString()); + builder.Add(IsInbound(json) ? "<< from " : ">> to "); + + if (json.isMember(kPeerAddress)) + { + builder.Add(json[kPeerAddress].asCString()); + } + else + { + builder.Add("UNKNOWN"); + } builder.Add(" "); auto msgCounter = static_cast(json[kMessageCounterKey].asLargestUInt()); @@ -258,11 +220,10 @@ CHIP_ERROR TraceDecoder::LogAndConsumeProtocol(Json::Value & json) ChipLogProgress(DataManagement, "%s", builder.c_str()); - json.removeMember(kSourceKey); - json.removeMember(kDestinationKey); json.removeMember(kSessionIdKey); json.removeMember(kExchangeIdKey); json.removeMember(kMessageCounterKey); + json.removeMember(kDirectionKey); return CHIP_NO_ERROR; } diff --git a/examples/common/tracing/TraceDecoder.h b/examples/common/tracing/TraceDecoder.h index cc8dbd2374f9d5..4e70f5f12f1535 100644 --- a/examples/common/tracing/TraceDecoder.h +++ b/examples/common/tracing/TraceDecoder.h @@ -42,7 +42,12 @@ class TraceDecoder : public TraceStream { char buffer[2048] = {}; snprintf(buffer, sizeof(buffer), " %s\t %s", tag.c_str(), data.c_str()); - ReadString(buffer); + CHIP_ERROR err = ReadString(buffer); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Automation, "Failed to add field: %" CHIP_ERROR_FORMAT, err.Format()); + } } void FinishEvent() override {} @@ -55,12 +60,10 @@ class TraceDecoder : public TraceStream CHIP_ERROR MaybeLogAndConsumeMessageFlags(Json::Value & value); CHIP_ERROR MaybeLogAndConsumeExchangeFlags(Json::Value & value); CHIP_ERROR MaybeLogAndConsumePayload(Json::Value & value, bool isResponse); - CHIP_ERROR MaybeLogAndConsumeEncryptedPayload(Json::Value & value); CHIP_ERROR MaybeLogAndConsumeOthers(Json::Value & value); private: TraceDecoderOptions mOptions; - Json::Value mJsonBuffer; }; } // namespace trace diff --git a/examples/common/tracing/TraceHandlers.cpp b/examples/common/tracing/TraceHandlers.cpp index d595580fa7619a..73f3bb7a71e2e3 100644 --- a/examples/common/tracing/TraceHandlers.cpp +++ b/examples/common/tracing/TraceHandlers.cpp @@ -233,7 +233,9 @@ void SecureMessageSentHandler(const TraceSecureMessageSentData * eventData) return; } - std::string jsonBody = "{"; + std::string jsonBody = "{ \"direction\": \"outbound\", "; + jsonBody += AsFirstJsonKey("peer_address", AsJsonString(eventData->peerAddress)); + jsonBody += ", "; jsonBody += PacketHeaderToJson(eventData->packetHeader); jsonBody += ", "; jsonBody += PayloadHeaderToJson(eventData->payloadHeader); @@ -255,7 +257,7 @@ void SecureMessageReceivedHandler(const TraceSecureMessageReceivedData * eventDa return; } - std::string jsonBody = "{"; + std::string jsonBody = "{ \"direction\": \"inbound\", "; jsonBody += AsFirstJsonKey("peer_address", AsJsonString(eventData->peerAddress)); jsonBody += ", "; jsonBody += PacketHeaderToJson(eventData->packetHeader); diff --git a/src/transport/Session.h b/src/transport/Session.h index 29ebf593a9b5e3..14139b56df9c00 100644 --- a/src/transport/Session.h +++ b/src/transport/Session.h @@ -27,7 +27,6 @@ #include #include #include -#include namespace chip { namespace Transport { diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index 456b0e547aa717..7b9ebaf0ad8f68 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -181,11 +181,13 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P return CHIP_ERROR_INTERNAL; } + PeerAddress destination_address = Transport::PeerAddress::Multicast(fabric->GetFabricId(), groupSession->GetGroupId()); + // Trace before any encryption MATTER_LOG_MESSAGE_SEND(chip::Tracing::OutgoingMessageType::kGroupMessage, &payloadHeader, &packetHeader, chip::ByteSpan(message->Start(), message->TotalLength())); - CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, message->Start(), message->TotalLength()); + CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, destination_address, message->Start(), message->TotalLength()); Crypto::SymmetricKeyContext * keyContext = groups->GetKeyContext(groupSession->GetFabricIndex(), groupSession->GetGroupId()); @@ -219,10 +221,12 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P .SetSessionId(session->GetPeerSessionId()) // .SetSessionType(Header::SessionType::kUnicastSession); + PeerAddress destination_address = session->GetPeerAddress(); + // Trace before any encryption MATTER_LOG_MESSAGE_SEND(chip::Tracing::OutgoingMessageType::kSecureSession, &payloadHeader, &packetHeader, chip::ByteSpan(message->Start(), message->TotalLength())); - CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, message->Start(), message->TotalLength()); + CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, destination_address, message->Start(), message->TotalLength()); CryptoContext::NonceStorage nonce; NodeId sourceNodeId = session->GetLocalScopedNodeId().GetNodeId(); @@ -252,10 +256,13 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P break; } + auto unauthenticated = sessionHandle->AsUnauthenticatedSession(); + PeerAddress destination_address = unauthenticated->GetPeerAddress(); + // Trace after all headers are settled. MATTER_LOG_MESSAGE_SEND(chip::Tracing::OutgoingMessageType::kUnauthenticated, &payloadHeader, &packetHeader, chip::ByteSpan(message->Start(), message->TotalLength())); - CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, message->Start(), message->TotalLength()); + CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, destination_address, message->Start(), message->TotalLength()); ReturnErrorOnFailure(payloadHeader.EncodeBeforeData(message)); diff --git a/src/transport/TraceMessage.h b/src/transport/TraceMessage.h index b8c5f87f7c8c1a..bf6cbaef99c861 100644 --- a/src/transport/TraceMessage.h +++ b/src/transport/TraceMessage.h @@ -40,10 +40,10 @@ #define _CHIP_TRACE_MESSAGE_INTERNAL(type, data, size) PW_TRACE_INSTANT_DATA(::chip::trace::kTraceMessageEvent, type, data, size); #endif // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED && CHIP_CONFIG_TRANSPORT_PW_TRACE_ENABLED -#define CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, data, dataLen) \ +#define CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, peerAddress, data, dataLen) \ do \ { \ - const ::chip::trace::TraceSecureMessageSentData _trace_data{ &payloadHeader, &packetHeader, data, dataLen }; \ + const ::chip::trace::TraceSecureMessageSentData _trace_data{ &payloadHeader, &packetHeader, &peerAddress, data, dataLen }; \ _CHIP_TRACE_MESSAGE_INTERNAL(::chip::trace::kTraceMessageSentDataFormat, reinterpret_cast(&_trace_data), \ sizeof(_trace_data)); \ } while (0) @@ -58,14 +58,16 @@ } while (0) #else // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED || CHIP_CONFIG_TRANSPORT_PW_TRACE_ENABLED -#define CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, data, dataLen) \ +#define CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, peerAddress, data, dataLen) \ do \ { \ + (void) peerAddress; \ } while (0) #define CHIP_TRACE_MESSAGE_RECEIVED(payloadHeader, packetHeader, session, peerAddress, data, dataLen) \ do \ { \ + (void) peerAddress; \ } while (0) #endif // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED || CHIP_CONFIG_TRANSPORT_PW_TRACE_ENABLED @@ -81,6 +83,7 @@ struct TraceSecureMessageSentData { const PayloadHeader * payloadHeader; const PacketHeader * packetHeader; + const Transport::PeerAddress * peerAddress; const uint8_t * packetPayload; size_t packetSize; };