diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index f8c0af9df1bad5..db1bdce4a54119 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -69,6 +69,7 @@ static_library("chip-tool-utils") { public_deps = [ "${chip_root}/src/app/server", + "${chip_root}/src/app/tests/suites/commands/discovery", "${chip_root}/src/app/tests/suites/commands/log", "${chip_root}/src/app/tests/suites/commands/system", "${chip_root}/src/app/tests/suites/pics", diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 72d4fdc870d40d..addc4ff4efb57c 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -32,6 +32,7 @@ CHIP_ERROR TestCommand::RunCommand() CHIP_ERROR TestCommand::WaitForCommissionee() { + CurrentCommissioner().ReleaseOperationalDevice(mNodeId); return CurrentCommissioner().GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); } @@ -42,7 +43,7 @@ void TestCommand::OnDeviceConnectedFn(void * context, chip::OperationalDevicePro VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "Device connected, but cannot run the test, as the context is null")); command->mDevices[command->GetIdentity()] = device; - command->NextTest(); + command->ContinueOnChipMainThread(); } void TestCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error) @@ -51,7 +52,8 @@ void TestCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHI peerId.GetNodeId(), error.Format()); auto * command = static_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "Test command context is null")); - command->SetCommandExitStatus(error); + + command->ContinueOnChipMainThread(); } void TestCommand::OnWaitForMsFn(chip::System::Layer * systemLayer, void * context) diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index a6aa4fff92d9a4..f798082eb23b86 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -19,6 +19,7 @@ #pragma once #include "../common/CHIPCommand.h" +#include #include #include #include @@ -34,6 +35,7 @@ class TestCommand : public CHIPCommand, public ConstraintsChecker, public PICSChecker, public LogCommands, + public DiscoveryCommands, public SystemCommands { public: diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index 4a62f625feca4d..8b9f9cfd549cca 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -102,6 +102,57 @@ class {{filename}}: public TestCommand {{/chip_tests_item_response_parameters}} {{/chip_tests_items}} + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + {{#chip_tests_items}} + {{#if (isStrEqual cluster "DiscoveryCommands")}} + if ((mTestIndex - 1) == {{index}}) + { + isExpectedDnssdResult = true; + {{#chip_tests_item_response_parameters}} + {{#*inline "itemValue"}}nodeData.{{name}}{{#if isOptional}}.Value(){{/if}}{{/inline}} + {{~#if hasExpectedValue}} + {{#if isOptional}}VerifyOrReturn(CheckValuePresent("{{name}}", nodeData.{{name}}));{{/if}} + VerifyOrReturn(CheckValue("{{name}}", {{>itemValue}}, + {{#if (chip_tests_config_has expectedValue)}} + m{{asUpperCamelCase expectedValue}}.HasValue() ? m{{asUpperCamelCase expectedValue}}.Value() : {{asTypedLiteral (chip_tests_config_get_default_value expectedValue) (chip_tests_config_get_type expectedValue)}} + {{else}} + {{expectedValue}} + {{/if}} + )); + {{/if}} + {{#if hasExpectedConstraints}} + {{#if isOptional}}VerifyOrReturn(CheckValuePresent("{{name}}", nodeData.{{name}}));{{/if}} + {{#if (hasProperty expectedConstraints "minLength")}}VerifyOrReturn(CheckConstraintMinLength("{{name}}", {{>itemValue}}.size(), {{expectedConstraints.minLength}}));{{/if}} + {{#if (hasProperty expectedConstraints "maxLength")}}VerifyOrReturn(CheckConstraintMaxLength("{{name}}", {{>itemValue}}.size(), {{expectedConstraints.maxLength}}));{{/if}} + {{#if (hasProperty expectedConstraints "minValue")}}VerifyOrReturn(CheckConstraintMinValue<{{chipType}}>("{{name}}", {{>itemValue}}, {{asTypedLiteral expectedConstraints.minValue type}}));{{/if}} + {{#if (hasProperty expectedConstraints "maxValue")}}VerifyOrReturn(CheckConstraintMaxValue<{{chipType}}>("{{name}}", {{>itemValue}}, {{asTypedLiteral expectedConstraints.maxValue type}}));{{/if}} + {{#if (hasProperty expectedConstraints "notValue")}}VerifyOrReturn(CheckConstraintNotValue("{{name}}", {{>itemValue}}, {{asTypedLiteral expectedConstraints.notValue type}}));{{/if}} + {{/if}} + + {{#if saveAs}} + {{#if (isString type)}} + if ({{saveAs}}Buffer != nullptr) + { + chip::Platform::MemoryFree({{saveAs}}Buffer); + } + {{saveAs}}Buffer = static_cast<{{#if (isOctetString type)}}uint8_t{{else}}char{{/if}} *>(chip::Platform::MemoryAlloc({{>itemValue}}.size())); + memcpy({{saveAs}}Buffer, {{>itemValue}}.data(), {{>itemValue}}.size()); + {{saveAs}} = {{chipType}}({{saveAs}}Buffer, {{>itemValue}}.size()); + {{else}} + {{saveAs}} = {{>itemValue}}; + {{/if}} + {{/if}} + {{/chip_tests_item_response_parameters}} + } + {{/if}} + {{/chip_tests_items}} + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + {{! Helper around zapTypeToDecodableClusterObjectType that lets us set the array/nullable/etc context appropriately.}} {{~#*inline "subscribeResponseDataArgument"~}} @@ -194,7 +245,13 @@ class {{filename}}: public TestCommand CHIP_ERROR {{>testCommand}}() { SetIdentity(kIdentity{{asUpperCamelCase identity}}); - return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{#if (isString type)}}"{{/if}}{{definedValue}}{{#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}}); + return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{#if (isString type)}}"{{/if~}} + {{~#if (chip_tests_config_has definedValue)~}} + m{{asUpperCamelCase definedValue}}.HasValue() ? m{{asUpperCamelCase definedValue}}.Value() : {{asTypedLiteral (chip_tests_config_get_default_value definedValue) (chip_tests_config_get_type definedValue)}} + {{else}} + {{definedValue}} + {{~/if~}} + {{~#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}}); } {{else if isWait}} CHIP_ERROR {{>testCommand}}() diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index 579fda699c8623..1ef8cdb0722018 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -241,6 +241,7 @@ function getTests() 'TestClusterComplexTypes', 'TestConstraints', 'TestDelayCommands', + 'TestDiscovery', 'TestLogCommands', 'TestSaveAs', 'TestConfigVariables', diff --git a/examples/placeholder/linux/BUILD.gn b/examples/placeholder/linux/BUILD.gn index 1917652769dc64..dbcfb549509fe2 100644 --- a/examples/placeholder/linux/BUILD.gn +++ b/examples/placeholder/linux/BUILD.gn @@ -41,6 +41,7 @@ executable("chip-${chip_tests_zap_config}") { deps = [ ":configuration", "${chip_root}/examples/platform/linux:app-main", + "${chip_root}/src/app/tests/suites/commands/discovery", "${chip_root}/src/app/tests/suites/commands/log", "${chip_root}/src/app/tests/suites/pics", "${chip_root}/src/lib", diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index 6f8a8cc64c342a..e03f5e39ce4d54 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -34,7 +35,7 @@ constexpr const char kIdentityAlpha[] = ""; constexpr const char kIdentityBeta[] = ""; constexpr const char kIdentityGamma[] = ""; -class TestCommand : public PICSChecker, public LogCommands +class TestCommand : public PICSChecker, public LogCommands, public DiscoveryCommands { public: TestCommand(const char * commandName) : mCommandPath(0, 0, 0), mAttributePath(0, 0, 0) {} @@ -70,6 +71,12 @@ class TestCommand : public PICSChecker, public LogCommands return CHIP_NO_ERROR; } + void Exit(std::string message) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", message.c_str()); + SetCommandExitStatus(CHIP_ERROR_INTERNAL); + } + static void ScheduleNextTest(intptr_t context) { TestCommand * command = reinterpret_cast(context); diff --git a/src/app/tests/suites/TestDiscovery.yaml b/src/app/tests/suites/TestDiscovery.yaml new file mode 100644 index 00000000000000..2987f8ee77908b --- /dev/null +++ b/src/app/tests/suites/TestDiscovery.yaml @@ -0,0 +1,314 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Test Discovery + +config: + endpoint: 0 + discriminator: + type: INT16U + defaultValue: GetUniqueDiscriminator() + vendorId: + type: INT16U + defaultValue: 65521 + productId: + type: INT16U + defaultValue: 32768 + deviceType: + type: INT16U + defaultValue: 5 + +tests: + - label: "Reboot target device" + cluster: "SystemCommands" + command: "Reboot" + arguments: + values: + - name: "discriminator" + value: discriminator + + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Open Commissioning Window" + cluster: "AdministratorCommissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 120 + + - label: "Wait 1000ms for the mdns advertisement to be published" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Check Instance Name" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "instanceName" + saveAs: deviceInstanceNameBeforeReboot + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + + # TODO: + # Find a way to validate the service type and the service domain + + - label: "Check Hostname" + PICS: "(WIFI || ETH) && !THREAD" + # On macOS the hostname is the device name and because of it this test is disabled for now. + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 12 + isUpperCase: true + isHexString: true + + - label: "Check Hostname" + PICS: "(!WIFI && !ETH) && THREAD" + # On macOS the hostname is the device name and because of it this test is disabled for now. + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + + # Commissioning Subtypes + + - 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: discriminator + + - label: "Check Commissioning Mode (_CM)" + cluster: "DiscoveryCommands" + command: "FindCommissionableByCommissioningMode" + + - label: "Check Vendor ID (_V)" + PICS: VENDOR_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByVendorId" + arguments: + values: + - name: "value" + value: vendorId + + - label: "Check Device Type ID (_T)" + # The device type is not broadcasted by the accessory under CI. + disabled: true + PICS: DEVTYPE_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByDeviceType" + arguments: + values: + - name: "value" + value: deviceType + + # TXT Records + + - label: "TXT key for discriminator (D)" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "longDiscriminator" + value: discriminator + constraints: + minValue: 0 + maxValue: 4096 + + - label: "TXT key for Vendor ID and Product ID (VP)" + PICS: VP_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "vendorId" + value: vendorId + + # Maybe it should be a PICS code to differentiate between manufacturer that wants to broadcast the + # product id ? + - label: "TXT key for Vendor ID and Product ID (VP)" + PICS: VP_KEY + optional: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "productId" + value: productId + + - label: "Optional TXT key for MRP Retry Interval Idle (CRI)" + PICS: CRI_COMM_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalIdle" + constraints: + maxValue: 3600000 + + - label: "Optional TXT key for MRP Retry Interval Active (CRA)" + PICS: CRA_COMM_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalActive" + constraints: + maxValue: 3600000 + + - label: "TXT key for commissioning mode (CM)" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "commissioningMode" + value: 1 + + - label: "Optional TXT key for device type (DT)" + disabled: true + PICS: DT_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceType" + value: deviceType + constraints: + # The specification says this is a number expressed as , but it seems like it can goes + # up to 0xBFFF (49151). + maxValue: 999 + + - label: "Optional TXT key for device name (DN)" + PICS: DN_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceName" + constraints: + maxLength: 32 + + - label: "Optional TXT key for rotating device identifier (RI)" + PICS: RI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "rotatingIdLen" + constraints: + maxValue: 100 + + - label: "Optional TXT key for pairing hint (PH)" + PICS: PH_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingHint" + notValue: 0 + + - label: "Optional TXT key for pairing instructions (PI)" + PICS: PI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingInstruction" + constraints: + maxLength: 128 + + - label: "Check IPs" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "numIPs" + constraints: + minValue: 1 + + - label: "Reboot target device" + cluster: "SystemCommands" + command: "Reboot" + arguments: + values: + - name: "discriminator" + value: discriminator + + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Open Commissioning Window" + cluster: "AdministratorCommissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 120 + + - label: "Wait 1000ms for the mdns advertisement to be published" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Check Instance Name" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "instanceName" + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + notValue: deviceInstanceNameBeforeReboot diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index cb797a2052bf9d..e6939e2e2db644 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -21,9 +21,12 @@ PICS: - label: "Does the device support discovery over WiFi?" id: WIFI - - label: "Does the device support discover over THREAD" + - label: "Does the device support discovery over THREAD" id: THREAD + - label: "Does the device support discovery over Ethernet?" + id: ETH + - label: "Does the device support manufacturing date" id: MANF_DATE @@ -225,3 +228,41 @@ PICS: - label: "Does the device implement receiving the OnWithTimedOff command?" id: CR_ONWITHTIMEOFF + + - label: "Does Dnssd advertisment broadcast Vendor ID" + id: VENDOR_SUBTYPE + + - label: "Does Dnssd advertisment broadcast Device Type ID" + id: DEVTYPE_SUBTYPE + + - label: + "The optional key CRI indicates the MRP_RETRY_INTERVAL_IDLE of the + Node" + id: CRI_COMM_DISCOVERY_KEY + + - label: + "The optional key CRA indicates the MRP_RETRY_INTERVAL_ACTIVE of the + Node" + id: CRA_COMM_DISCOVERY_KEY + + - label: + "The optional key VP, if present, MAY provide Vendor ID and Product ID + information of the device" + id: VP_KEY + + - label: + "The optional key DT MAY provide the publisher’s primary device type." + id: DT_KEY + + - label: "The optional key DN MAY provide a device advertisement name." + id: DN_KEY + + - label: "The optional key RI MAY provide a Rotating Device Identifier." + id: RI_KEY + + - label: "The optional key PH MAY provide a pairing hint." + id: PH_KEY + + - label: + "The optional key PI MAY provide additional information for pairing." + id: PI_KEY diff --git a/src/app/tests/suites/commands/discovery/BUILD.gn b/src/app/tests/suites/commands/discovery/BUILD.gn new file mode 100644 index 00000000000000..8183767c470a36 --- /dev/null +++ b/src/app/tests/suites/commands/discovery/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") + +static_library("discovery") { + output_name = "libDiscoveryCommands" + + sources = [ + "DiscoveryCommands.cpp", + "DiscoveryCommands.h", + ] + + cflags = [ "-Wconversion" ] + + public_deps = [ + "${chip_root}/src/lib/dnssd", + "${chip_root}/src/lib/support", + ] +} diff --git a/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp b/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp new file mode 100644 index 00000000000000..029b3a7af5a934 --- /dev/null +++ b/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "DiscoveryCommands.h" + +#include +#include +#include + +CHIP_ERROR DiscoveryCommands::FindCommissionable() +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kNone, (uint64_t) 0); + return mDNSResolver.FindCommissionableNodes(filter); +} + +CHIP_ERROR DiscoveryCommands::FindCommissionableByShortDiscriminator(uint64_t value) +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + uint64_t shortDiscriminator = static_cast((value >> 8) & 0x0F); + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kShortDiscriminator, shortDiscriminator); + return mDNSResolver.FindCommissionableNodes(filter); +} + +CHIP_ERROR DiscoveryCommands::FindCommissionableByLongDiscriminator(uint64_t value) +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kLongDiscriminator, value); + return mDNSResolver.FindCommissionableNodes(filter); +} + +CHIP_ERROR DiscoveryCommands::FindCommissionableByCommissioningMode() +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kCommissioningMode); + return mDNSResolver.FindCommissionableNodes(filter); +} + +CHIP_ERROR DiscoveryCommands::FindCommissionableByVendorId(uint64_t value) +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kVendorId, value); + return mDNSResolver.FindCommissionableNodes(filter); +} + +CHIP_ERROR DiscoveryCommands::FindCommissionableByDeviceType(uint64_t value) +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kDeviceType, value); + return mDNSResolver.FindCommissionableNodes(filter); +} + +CHIP_ERROR DiscoveryCommands::FindCommissioner() +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kCommissioner, 1); + return mDNSResolver.FindCommissioners(filter); +} + +CHIP_ERROR DiscoveryCommands::FindCommissionerByVendorId(uint64_t value) +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kVendorId, value); + return mDNSResolver.FindCommissioners(filter); +} + +CHIP_ERROR DiscoveryCommands::FindCommissionerByDeviceType(uint64_t value) +{ + ReturnErrorOnFailure(SetupDiscoveryCommands()); + + chip::Dnssd::DiscoveryFilter filter(chip::Dnssd::DiscoveryFilterType::kDeviceType, value); + return mDNSResolver.FindCommissioners(filter); +} + +CHIP_ERROR DiscoveryCommands::SetupDiscoveryCommands() +{ + ReturnErrorOnFailure(TearDownDiscoveryCommands()); + + if (mReady == false) + { + ReturnErrorOnFailure(mDNSResolver.Init(chip::DeviceLayer::UDPEndPointManager())); + mReady = true; + } + mDNSResolver.SetResolverDelegate(this); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DiscoveryCommands::TearDownDiscoveryCommands() +{ + mDNSResolver.SetResolverDelegate(nullptr); + return CHIP_NO_ERROR; +} + +uint16_t DiscoveryCommands::GetUniqueDiscriminator() +{ + if (mDiscriminatorUseForFiltering == 0) + { + std::random_device dev; + std::mt19937 rng(dev()); + std::uniform_int_distribution distribution(1, 4096); + mDiscriminatorUseForFiltering = static_cast(distribution(rng)); + } + return mDiscriminatorUseForFiltering; +} + +void DiscoveryCommands::OnNodeDiscoveryComplete(const chip::Dnssd::DiscoveredNodeData & nodeData) +{ + // TODO: If multiple results are found for the same filter, then the test result depends + // on which result comes first. At the moment, the code assume that there is only + // a single match on the network, but if that's not enough, there may be a need + // to implement some sort of list that is built for a given duration before returning + // + // But also, running on CI seems to show cross-talks between CI instances, so multiple + // results will comes up. Unexpected advertisements are filtered by validating the + // discriminator from the advertisement matches the one coming from the config section + // of the test. + if (nodeData.longDiscriminator != GetUniqueDiscriminator()) + { + ChipLogError(chipTool, "Non fatal error: Unexpected node advertisment. It will be ignored"); + nodeData.LogDetail(); + return; + } + + ReturnOnFailure(TearDownDiscoveryCommands()); + + nodeData.LogDetail(); + + DiscoveryCommandResult data; + data.hostName = chip::CharSpan(nodeData.hostName, strlen(nodeData.hostName)); + data.instanceName = chip::CharSpan(nodeData.instanceName, strlen(nodeData.instanceName)); + data.longDiscriminator = nodeData.longDiscriminator; + data.shortDiscriminator = ((nodeData.longDiscriminator >> 8) & 0x0F); + data.vendorId = nodeData.vendorId; + data.productId = nodeData.productId; + data.commissioningMode = nodeData.commissioningMode; + data.deviceType = nodeData.deviceType; + data.deviceName = chip::CharSpan(nodeData.deviceName, strlen(nodeData.deviceName)); + data.rotatingId = chip::ByteSpan(nodeData.rotatingId, nodeData.rotatingIdLen); + data.rotatingIdLen = nodeData.rotatingIdLen; + data.pairingHint = nodeData.pairingHint; + data.pairingInstruction = chip::CharSpan(nodeData.pairingInstruction, strlen(nodeData.pairingInstruction)); + data.supportsTcp = nodeData.supportsTcp; + data.port = nodeData.port; + + if (!chip::CanCastTo(nodeData.numIPs)) + { + ChipLogError(chipTool, "Too many ips."); + return; + } + data.numIPs = static_cast(nodeData.numIPs); + + if (nodeData.mrpRetryIntervalIdle.HasValue()) + { + data.mrpRetryIntervalIdle.SetValue(nodeData.mrpRetryIntervalIdle.Value().count()); + } + + if (nodeData.mrpRetryIntervalActive.HasValue()) + { + data.mrpRetryIntervalActive.SetValue(nodeData.mrpRetryIntervalActive.Value().count()); + } + + OnDiscoveryCommandsResults(data); +} diff --git a/src/app/tests/suites/commands/discovery/DiscoveryCommands.h b/src/app/tests/suites/commands/discovery/DiscoveryCommands.h new file mode 100644 index 00000000000000..d99cca90d8da07 --- /dev/null +++ b/src/app/tests/suites/commands/discovery/DiscoveryCommands.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include +#include + +struct DiscoveryCommandResult +{ + chip::CharSpan hostName; + chip::CharSpan instanceName; + uint16_t longDiscriminator; + uint8_t shortDiscriminator; + uint16_t vendorId; + uint16_t productId; + uint8_t commissioningMode; + uint16_t deviceType; + chip::CharSpan deviceName; + chip::ByteSpan rotatingId; + uint64_t rotatingIdLen; + uint16_t pairingHint; + chip::CharSpan pairingInstruction; + bool supportsTcp; + uint8_t numIPs; + uint16_t port; + chip::Optional mrpRetryIntervalIdle; + chip::Optional mrpRetryIntervalActive; +}; + +class DiscoveryCommands : public chip::Dnssd::ResolverDelegate +{ +public: + DiscoveryCommands(){}; + virtual ~DiscoveryCommands(){}; + + virtual CHIP_ERROR ContinueOnChipMainThread() = 0; + + CHIP_ERROR FindCommissionable(); + CHIP_ERROR FindCommissionableByShortDiscriminator(uint64_t value); + CHIP_ERROR FindCommissionableByLongDiscriminator(uint64_t value); + CHIP_ERROR FindCommissionableByCommissioningMode(); + CHIP_ERROR FindCommissionableByVendorId(uint64_t vendorId); + CHIP_ERROR FindCommissionableByDeviceType(uint64_t deviceType); + + CHIP_ERROR FindCommissioner(); + CHIP_ERROR FindCommissionerByVendorId(uint64_t vendorId); + CHIP_ERROR FindCommissionerByDeviceType(uint64_t deviceType); + + CHIP_ERROR SetupDiscoveryCommands(); + CHIP_ERROR TearDownDiscoveryCommands(); + virtual void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData){}; + + /////////// ResolverDelegate Interface ///////// + void OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData & nodeData) override{}; + void OnNodeIdResolutionFailed(const chip::PeerId & peerId, CHIP_ERROR error) override{}; + void OnNodeDiscoveryComplete(const chip::Dnssd::DiscoveredNodeData & nodeData) override; + +protected: + // This function initialize a random discriminator once and returns it all the time afterwards + uint16_t GetUniqueDiscriminator(); + +private: + bool mReady = false; + chip::Dnssd::ResolverProxy mDNSResolver; + uint16_t mDiscriminatorUseForFiltering = 0; +}; diff --git a/src/app/zap-templates/common/simulated-clusters/clusters/DiscoveryCommands.js b/src/app/zap-templates/common/simulated-clusters/clusters/DiscoveryCommands.js new file mode 100644 index 00000000000000..a154363b0c6ea1 --- /dev/null +++ b/src/app/zap-templates/common/simulated-clusters/clusters/DiscoveryCommands.js @@ -0,0 +1,162 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This file declares test suite utility methods for discovery. + * + * Each method declared in this file needs to be implemented on a per-language + * basis and allows exposing methods to the test suites that are not part + * of the regular cluster set of APIs. + * + */ + +const kTypeArgument = { + name : 'type', + type : 'CHAR_STRING', +}; + +const kNumberValueArgument = { + name : 'value', + type : 'INT64U', +}; + +const kStringValueArgument = { + name : 'value', + type : 'CHAR_STRING', +}; + +const kDefaultResponse = { + arguments : [ + { name : 'hostName', type : 'CHAR_STRING', chipType : 'chip::CharSpan' }, // + { name : 'instanceName', type : 'CHAR_STRING', chipType : 'chip::CharSpan' }, // + { name : 'longDiscriminator', type : 'INT16U', chipType : 'uint16_t' }, // + { name : 'shortDiscriminator', type : 'INT8U', chipType : 'uint8_t' }, // + { name : 'vendorId', type : 'INT16U', chipType : 'uint16_t' }, // + { name : 'productId', type : 'INT16U', chipType : 'uint16_t' }, // + { name : 'commissioningMode', type : 'INT8U', chipType : 'uint8_t' }, // + { name : 'deviceType', type : 'INT16U', chipType : 'uint16_t' }, // + { name : 'deviceName', type : 'CHAR_STRING' }, // + { name : 'rotatingId', type : 'OCTET_STRING', chipType : 'chip::ByteSpan' }, // + { name : 'rotatingIdLen', type : 'INT64U', chipType : 'uint64_t' }, // + { name : 'pairingHint', type : 'INT16U', chipType : 'uint16_t' }, // + { name : 'pairingInstruction', type : 'CHAR_STRING' }, // + { name : 'supportsTcp', type : 'BOOLEAN', chipType : 'bool' }, // + { name : 'numIPs', type : 'INT8U', chipType : 'uint8_t' }, // + { name : 'port', type : 'INT16U', chipType : 'uint16_t' }, // + { name : 'mrpRetryIntervalIdle', type : 'INT32U', chipType : 'uint32_t', isOptional : true }, // + { name : 'mrpRetryIntervalActive', type : 'INT32U', chipType : 'uint32_t', isOptional : true }, // + ] +}; + +// +// Commissionable +// + +const FindCommissionable = { + name : 'FindCommissionable', + arguments : [], + response : kDefaultResponse +}; + +const FindCommissionableByShortDiscriminator = { + name : 'FindCommissionableByShortDiscriminator', + arguments : [ kNumberValueArgument ], + response : kDefaultResponse +}; + +const FindCommissionableByLongDiscriminator = { + name : 'FindCommissionableByLongDiscriminator', + arguments : [ kNumberValueArgument ], + response : kDefaultResponse +}; + +const FindCommissionableByCompressedFabricId = { + name : 'FindOperationalByCompressedFabricId', + arguments : [ kNumberValueArgument ], + response : kDefaultResponse +}; + +const FindCommissionableByCommissioningMode = { + name : 'FindCommissionableByCommissioningMode', + arguments : [], + response : kDefaultResponse +}; + +const FindCommissionableByVendorId = { + name : 'FindCommissionableByVendorId', + arguments : [ kNumberValueArgument ], + response : kDefaultResponse +}; + +const FindCommissionableByDeviceType = { + name : 'FindCommissionableByDeviceType', + arguments : [ kNumberValueArgument ], + response : kDefaultResponse +}; + +const FindCommissionableByName = { + name : 'FindCommissionableByName', + arguments : [ kStringValueArgument ], + response : kDefaultResponse +}; + +// +// Commissioner +// + +const FindCommissioner = { + name : 'FindCommissioner', + arguments : [], + response : kDefaultResponse +}; + +const FindCommissionerByVendorId = { + name : 'FindCommissionableByVendorId', + arguments : [ kNumberValueArgument ], + response : kDefaultResponse +}; + +const FindCommissionerByDeviceType = { + name : 'FindCommissionerByDeviceType', + arguments : [ kNumberValueArgument ], + response : kDefaultResponse +}; + +const commands = [ + // Commissionable + FindCommissionable, + FindCommissionableByShortDiscriminator, + FindCommissionableByLongDiscriminator, + FindCommissionableByCommissioningMode, + FindCommissionableByVendorId, + FindCommissionableByDeviceType, + FindCommissionableByName, + // Commissioner + FindCommissioner, + FindCommissionerByVendorId, + FindCommissionerByDeviceType, +]; + +const DiscoveryCommands = { + name : 'DiscoveryCommands', + commands : commands, +}; + +// +// Module exports +// +exports.cluster = DiscoveryCommands; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 43b0f49d3e90a4..f87ebe52b2e6f9 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -157,6 +157,7 @@ class TestList : public Command printf("TestClusterComplexTypes\n"); printf("TestConstraints\n"); printf("TestDelayCommands\n"); + printf("TestDiscovery\n"); printf("TestLogCommands\n"); printf("TestSaveAs\n"); printf("TestConfigVariables\n"); @@ -276,6 +277,14 @@ class Test_TC_BI_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -554,6 +563,14 @@ class Test_TC_BI_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -1052,6 +1069,14 @@ class Test_TC_BI_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -1413,6 +1438,14 @@ class Test_TC_BOOL_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -1662,6 +1695,14 @@ class Test_TC_BOOL_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -1869,6 +1910,14 @@ class Test_TC_BRAC_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -2016,6 +2065,14 @@ class Test_TC_CC_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -2800,6 +2857,14 @@ class Test_TC_CC_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -7949,6 +8014,14 @@ class Test_TC_CC_3_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -8333,6 +8406,14 @@ class Test_TC_CC_3_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -8670,6 +8751,14 @@ class Test_TC_CC_3_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -8943,6 +9032,14 @@ class Test_TC_CC_4_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -9203,6 +9300,14 @@ class Test_TC_CC_4_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -9602,6 +9707,14 @@ class Test_TC_CC_4_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -9875,6 +9988,14 @@ class Test_TC_CC_4_4 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -10116,6 +10237,14 @@ class Test_TC_CC_5_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -10361,6 +10490,14 @@ class Test_TC_CC_5_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -10630,6 +10767,14 @@ class Test_TC_CC_5_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -10871,6 +11016,14 @@ class Test_TC_CC_6_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -11135,6 +11288,14 @@ class Test_TC_CC_6_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -11581,6 +11742,14 @@ class Test_TC_CC_6_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -11874,6 +12043,14 @@ class Test_TC_CC_7_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -12259,6 +12436,14 @@ class Test_TC_CC_7_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -12631,6 +12816,14 @@ class Test_TC_CC_7_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -12904,6 +13097,14 @@ class Test_TC_CC_7_4 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -13189,6 +13390,14 @@ class Test_TC_CC_8_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -14248,6 +14457,14 @@ class Test_TC_CC_9_1 : public TestCommand uint16_t EnhancedCurrentHueValue4; uint16_t ColorLoopStoredEnhancedHue4; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -16236,6 +16453,14 @@ class Test_TC_CC_9_2 : public TestCommand uint16_t EnhancedCurrentHueValue; uint16_t ColorLoopStoredEnhancedHueValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -17092,6 +17317,14 @@ class Test_TC_CC_9_3 : public TestCommand uint16_t EnhancedCurrentHueValue; uint16_t ColorLoopStoredEnhancedHueValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -17880,6 +18113,14 @@ class Test_TC_DM_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -18601,6 +18842,14 @@ class Test_TC_DM_3_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -18755,6 +19004,14 @@ class Test_TC_DM_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -18991,6 +19248,14 @@ class Test_TC_EMR_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -19227,6 +19492,14 @@ class Test_TC_ETHDIAG_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -19295,6 +19568,14 @@ class Test_TC_ETHDIAG_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -19375,6 +19656,14 @@ class Test_TC_FLW_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -19590,6 +19879,14 @@ class Test_TC_FLW_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -20086,6 +20383,14 @@ class Test_TC_FLW_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -20240,6 +20545,14 @@ class Test_TC_ILL_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -20505,6 +20818,14 @@ class Test_TC_LVL_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -20859,6 +21180,14 @@ class Test_TC_LVL_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -21460,6 +21789,14 @@ class Test_TC_LVL_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -22073,6 +22410,14 @@ class Test_TC_LVL_3_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -22590,6 +22935,14 @@ class Test_TC_LVL_4_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -23126,6 +23479,14 @@ class Test_TC_LVL_5_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_4(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_4(error); @@ -23544,6 +23905,14 @@ class Test_TC_LVL_6_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_4(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_4(error); @@ -23886,6 +24255,14 @@ class Test_TC_MC_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -24053,6 +24430,14 @@ class Test_TC_MC_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24147,6 +24532,14 @@ class Test_TC_MC_3_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24214,6 +24607,14 @@ class Test_TC_MC_3_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24281,6 +24682,14 @@ class Test_TC_MC_3_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24348,6 +24757,14 @@ class Test_TC_MC_3_4 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24415,6 +24832,14 @@ class Test_TC_MC_3_5 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24482,6 +24907,14 @@ class Test_TC_MC_3_6 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24549,6 +24982,14 @@ class Test_TC_MC_3_7 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24616,6 +25057,14 @@ class Test_TC_MC_3_8 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24683,6 +25132,14 @@ class Test_TC_MC_3_9 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24750,6 +25207,14 @@ class Test_TC_MC_3_10 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24817,6 +25282,14 @@ class Test_TC_MC_3_11 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -24888,6 +25361,14 @@ class Test_TC_MC_5_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -24995,6 +25476,14 @@ class Test_TC_MC_5_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -25008,7 +25497,7 @@ class Test_TC_MC_5_2 : public TestCommand CHIP_ERROR TestLogACommand_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("verify that the channel has changed on the device."); + return UserPrompt(" verify that the channel has changed on the device."); } }; @@ -25072,6 +25561,14 @@ class Test_TC_MC_5_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -25085,7 +25582,7 @@ class Test_TC_MC_5_3 : public TestCommand CHIP_ERROR TestLogACommand_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("verify that the channel has changed on the device"); + return UserPrompt(" verify that the channel has changed on the device"); } }; @@ -25165,6 +25662,14 @@ class Test_TC_MC_6_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -25188,13 +25693,13 @@ class Test_TC_MC_6_1 : public TestCommand CHIP_ERROR TestLogACommand_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); + return UserPrompt(" Verify that media is paused"); } CHIP_ERROR TestLogACommand_2() { SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is playing"); + return UserPrompt(" Physically verify that the media is playing"); } CHIP_ERROR TestReadsThePlaybackStateAttribute_3() @@ -25224,13 +25729,13 @@ class Test_TC_MC_6_1 : public TestCommand CHIP_ERROR TestLogACommand_4() { SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is paused"); + return UserPrompt(" Physically verify that the media is paused"); } CHIP_ERROR TestLogACommand_5() { SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is stoped"); + return UserPrompt(" Physically verify that the media is stoped"); } }; @@ -25322,6 +25827,14 @@ class Test_TC_MC_6_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -25345,13 +25858,13 @@ class Test_TC_MC_6_2 : public TestCommand CHIP_ERROR TestLogACommand_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); + return UserPrompt(" Verify that media is paused"); } CHIP_ERROR TestLogACommand_2() { SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is playing"); + return UserPrompt(" Physically verify that the media is playing"); } CHIP_ERROR TestReadsTheCurrentStateAttribute_3() @@ -25381,31 +25894,31 @@ class Test_TC_MC_6_2 : public TestCommand CHIP_ERROR TestLogACommand_4() { SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is started over"); + return UserPrompt(" Physically verify that the media is started over"); } CHIP_ERROR TestLogACommand_5() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the next media item in the queue has been loaded"); + return UserPrompt(" Verify that the next media item in the queue has been loaded"); } CHIP_ERROR TestLogACommand_6() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the previous media item in the queue has been loaded"); + return UserPrompt(" Verify that the previous media item in the queue has been loaded"); } CHIP_ERROR TestLogACommand_7() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has skipped forward 10 seconds"); + return UserPrompt(" Verify that the media has skipped forward 10 seconds"); } CHIP_ERROR TestLogACommand_8() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has skipped backward 10 seconds"); + return UserPrompt(" Verify that the media has skipped backward 10 seconds"); } }; @@ -25477,6 +25990,14 @@ class Test_TC_MC_6_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -25490,19 +26011,19 @@ class Test_TC_MC_6_3 : public TestCommand CHIP_ERROR TestLogACommand_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); + return UserPrompt(" Verify that media is paused"); } CHIP_ERROR TestLogACommand_2() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has moved to 10 seconds from the starting point."); + return UserPrompt(" Verify that the media has moved to 10 seconds from the starting point."); } CHIP_ERROR TestLogACommand_3() { SetIdentity(kIdentityAlpha); - return UserPrompt("User prompt needed to enter the value beyond the furthest valid position"); + return UserPrompt(" User prompt needed to enter the value beyond the furthest valid position"); } }; @@ -25598,6 +26119,14 @@ class Test_TC_MC_6_4 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -25641,7 +26170,7 @@ class Test_TC_MC_6_4 : public TestCommand CHIP_ERROR TestLogACommand_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); + return UserPrompt(" Verify that media is paused"); } CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_2() @@ -25671,7 +26200,7 @@ class Test_TC_MC_6_4 : public TestCommand CHIP_ERROR TestLogACommand_3() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media is playing"); + return UserPrompt(" Verify that the media is playing"); } CHIP_ERROR TestReadsTheCurrentStateAttribute_4() @@ -25701,13 +26230,13 @@ class Test_TC_MC_6_4 : public TestCommand CHIP_ERROR TestLogACommand_5() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play speed has increased"); + return UserPrompt(" Verify that the media play speed has increased"); } CHIP_ERROR TestLogACommand_6() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play has reversed direction"); + return UserPrompt(" Verify that the media play has reversed direction"); } CHIP_ERROR TestReadsTheCurrentStateAttribute_7() @@ -25737,13 +26266,13 @@ class Test_TC_MC_6_4 : public TestCommand CHIP_ERROR TestLogACommand_8() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play has reversed direction"); + return UserPrompt(" Verify that the media play has reversed direction"); } CHIP_ERROR TestLogACommand_9() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media is has resumed playing forward at the default speed"); + return UserPrompt(" Verify that the media is has resumed playing forward at the default speed"); } }; @@ -25803,6 +26332,14 @@ class Test_TC_MC_7_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -25870,6 +26407,14 @@ class Test_TC_MC_7_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -25947,6 +26492,14 @@ class Test_TC_MC_8_1 : public TestCommand uint8_t currentTarget; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -26115,6 +26668,14 @@ class Test_TC_MC_9_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -26188,7 +26749,7 @@ class Test_TC_MC_9_1 : public TestCommand CHIP_ERROR TestPrecondition_1() { SetIdentity(kIdentityAlpha); - return Log("DUT has one or more Content Apps available"); + return Log(" DUT has one or more Content Apps available"); } CHIP_ERROR TestReadsTheVendorNameAttribute_2() @@ -26407,6 +26968,14 @@ class Test_TC_OCC_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -26644,6 +27213,14 @@ class Test_TC_OCC_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -27032,6 +27609,14 @@ class Test_TC_OCC_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -27202,6 +27787,14 @@ class Test_TC_OO_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -27624,6 +28217,14 @@ class Test_TC_OO_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -28234,6 +28835,14 @@ class Test_TC_OO_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -29127,6 +29736,14 @@ class Test_TC_OO_2_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -30625,6 +31242,14 @@ class Test_TC_PS_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -30869,6 +31494,14 @@ class Test_TC_PRS_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -31069,6 +31702,14 @@ class Test_TC_PRS_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -31450,6 +32091,14 @@ class Test_TC_PCC_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -31846,6 +32495,14 @@ class Test_TC_PCC_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -33611,6 +34268,14 @@ class Test_TC_PCC_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -33849,6 +34514,14 @@ class Test_TC_PCC_2_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -34209,6 +34882,14 @@ class Test_TC_RH_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -34391,6 +35072,14 @@ class Test_TC_RH_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -34617,6 +35306,14 @@ class Test_TC_RH_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -34777,6 +35474,14 @@ class Test_TC_SWTCH_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -35197,6 +35902,14 @@ class Test_TC_SWTCH_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -35230,13 +35943,13 @@ class Test_TC_SWTCH_2_2 : public TestCommand CHIP_ERROR TestUserInteractionNeeded_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to SwitchLatched event"); + return UserPrompt(" Set up subscription to SwitchLatched event"); } CHIP_ERROR TestUserInteractionNeeded_2() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator sets switch to first position"); + return UserPrompt(" Operator sets switch to first position"); } CHIP_ERROR TestReadCurrentPositionAttribute_3() @@ -35266,19 +35979,19 @@ class Test_TC_SWTCH_2_2 : public TestCommand CHIP_ERROR TestUserInteractionNeeded_4() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator sets switch to second position"); + return UserPrompt(" Operator sets switch to second position"); } CHIP_ERROR TestUserInteractionNeeded_5() { SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to InitialPress event"); + return UserPrompt(" Set up subscription to InitialPress event"); } CHIP_ERROR TestUserInteractionNeeded_6() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch"); + return UserPrompt(" Operator does not operate switch"); } CHIP_ERROR TestReadCurrentPositionAttribute_7() @@ -35308,43 +36021,43 @@ class Test_TC_SWTCH_2_2 : public TestCommand CHIP_ERROR TestUserInteractionNeeded_8() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator sets switch to second position"); + return UserPrompt(" Operator sets switch to second position"); } CHIP_ERROR TestUserInteractionNeeded_9() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch (release switch)"); + return UserPrompt(" Operator does not operate switch (release switch)"); } CHIP_ERROR TestUserInteractionNeeded_10() { SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to InitialPress and ShortRelease events"); + return UserPrompt(" Set up subscription to InitialPress and ShortRelease events"); } CHIP_ERROR TestUserInteractionNeeded_11() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch"); + return UserPrompt(" Operator does not operate switch"); } CHIP_ERROR TestUserInteractionNeeded_12() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch (press briefly)"); + return UserPrompt(" Operator operates switch (press briefly)"); } CHIP_ERROR TestUserInteractionNeeded_13() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_14() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch for 5 seconds"); + return UserPrompt(" Operator operates switch for 5 seconds"); } CHIP_ERROR TestWait3000ms_15() @@ -35356,37 +36069,37 @@ class Test_TC_SWTCH_2_2 : public TestCommand CHIP_ERROR TestUserInteractionNeeded_16() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_17() { SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); + return UserPrompt(" Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); } CHIP_ERROR TestUserInteractionNeeded_18() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch"); + return UserPrompt(" Operator does not operate switch"); } CHIP_ERROR TestUserInteractionNeeded_19() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch (press briefly)"); + return UserPrompt(" Operator operates switch (press briefly)"); } CHIP_ERROR TestUserInteractionNeeded_20() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_21() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch for 5 seconds"); + return UserPrompt(" Operator operates switch for 5 seconds"); } CHIP_ERROR TestWait3000ms_22() @@ -35398,91 +36111,92 @@ class Test_TC_SWTCH_2_2 : public TestCommand CHIP_ERROR TestUserInteractionNeeded_23() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_24() { SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); + return UserPrompt( + " Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); } CHIP_ERROR TestUserInteractionNeeded_25() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch"); + return UserPrompt(" Operator does not operate switch"); } CHIP_ERROR TestUserInteractionNeeded_26() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch (press briefly)"); + return UserPrompt(" Operator operates switch (press briefly)"); } CHIP_ERROR TestUserInteractionNeeded_27() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_28() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch (press briefly)"); + return UserPrompt(" Operator operates switch (press briefly)"); } CHIP_ERROR TestUserInteractionNeeded_29() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_30() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch again (press briefly)"); + return UserPrompt(" Operator operates switch again (press briefly)"); } CHIP_ERROR TestUserInteractionNeeded_31() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_32() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch again (press briefly)"); + return UserPrompt(" Operator operates switch again (press briefly)"); } CHIP_ERROR TestUserInteractionNeeded_33() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_34() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch again (press briefly)"); + return UserPrompt(" Operator operates switch again (press briefly)"); } CHIP_ERROR TestUserInteractionNeeded_35() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } CHIP_ERROR TestUserInteractionNeeded_36() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch again (press briefly)"); + return UserPrompt(" Operator operates switch again (press briefly)"); } CHIP_ERROR TestUserInteractionNeeded_37() { SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); + return UserPrompt(" Operator releases switch"); } }; @@ -35563,6 +36277,14 @@ class Test_TC_TM_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -35807,6 +36529,14 @@ class Test_TC_TM_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -35961,6 +36691,14 @@ class Test_TC_TM_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -36114,6 +36852,14 @@ class Test_TC_TSTAT_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -36597,6 +37343,14 @@ class Test_TC_TSTAT_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -39158,6 +39912,14 @@ class Test_TC_TSTAT_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -40747,6 +41509,14 @@ class Test_TC_TSUIC_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -40975,6 +41745,14 @@ class Test_TC_TSUIC_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -41649,6 +42427,14 @@ class Test_TC_TSUIC_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -42042,6 +42828,14 @@ class Test_TC_DIAGTH_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -42283,6 +43077,14 @@ class Test_TC_WIFIDIAG_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -42390,6 +43192,14 @@ class Test_TC_WIFIDIAG_3_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -42488,6 +43298,14 @@ class Test_TC_WNCV_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -43038,6 +43856,14 @@ class Test_TC_WNCV_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -44962,6 +45788,14 @@ class Test_TC_WNCV_2_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -45048,6 +45882,14 @@ class Test_TC_WNCV_2_4 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -45203,6 +46045,14 @@ class Test_TC_WNCV_2_5 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -45352,6 +46202,14 @@ class Test_TC_WNCV_3_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -45520,6 +46378,14 @@ class Test_TC_WNCV_3_2 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -45688,6 +46554,14 @@ class Test_TC_WNCV_3_3 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -45856,6 +46730,14 @@ class TV_TargetNavigatorCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -46061,6 +46943,14 @@ class TV_AudioOutputCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -46293,6 +47183,14 @@ class TV_ApplicationLauncherCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -46520,6 +47418,14 @@ class TV_KeypadInputCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -46633,6 +47539,14 @@ class TV_AccountLoginCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -46797,6 +47711,14 @@ class TV_WakeOnLanCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -46923,6 +47845,14 @@ class TV_ApplicationBasicCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -47263,6 +48193,14 @@ class TV_MediaPlaybackCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -47906,6 +48844,14 @@ class TV_ChannelCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -48132,6 +49078,14 @@ class TV_LowPowerCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -48243,6 +49197,14 @@ class TV_ContentLauncherCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -48523,6 +49485,14 @@ class TV_MediaInputCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -50821,6 +51791,14 @@ class TestCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + typedef void (*Test_TestCluster_list_int8u_ReportCallback)(void * context, const chip::app::DataModel::DecodableList & value); Test_TestCluster_list_int8u_ReportCallback mTest_TestCluster_list_int8u_Reported = nullptr; @@ -67163,6 +68141,14 @@ class TestClusterComplexTypes : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_7(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_7(error); @@ -67978,6 +68964,14 @@ class TestConstraints : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -68711,6 +69705,14 @@ class TestDelayCommands : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -68728,6 +69730,543 @@ class TestDelayCommands : public TestCommand } }; +class TestDiscovery : public TestCommand +{ +public: + TestDiscovery(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestDiscovery", credsIssuerConfig), mTestIndex(0) + { + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); + AddArgument("productId", 0, UINT16_MAX, &mProductId); + AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); + } + + ~TestDiscovery() + { + if (deviceInstanceNameBeforeRebootBuffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); + deviceInstanceNameBeforeRebootBuffer = nullptr; + } + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: TestDiscovery\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: TestDiscovery\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); + err = TestRebootTargetDevice_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Open Commissioning Window\n"); + err = TestOpenCommissioningWindow_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 1000ms for the mdns advertisement to be published\n"); + err = TestWait1000msForTheMdnsAdvertisementToBePublished_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Check Instance Name\n"); + err = TestCheckInstanceName_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Check Long Discriminator _L\n"); + err = TestCheckLongDiscriminatorL_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Check Short Discriminator (_S)\n"); + err = TestCheckShortDiscriminatorS_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Check Commissioning Mode (_CM)\n"); + err = TestCheckCommissioningModeCm_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Check Vendor ID (_V)\n"); + if (ShouldSkip("VENDOR_SUBTYPE")) + { + NextTest(); + return; + } + err = TestCheckVendorIdV_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TXT key for discriminator (D)\n"); + err = TestTxtKeyForDiscriminatorD_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TXT key for Vendor ID and Product ID (VP)\n"); + if (ShouldSkip("VP_KEY")) + { + NextTest(); + return; + } + err = TestTxtKeyForVendorIdAndProductIdVp_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TXT key for Vendor ID and Product ID (VP)\n"); + if (ShouldSkip("VP_KEY")) + { + NextTest(); + return; + } + err = TestTxtKeyForVendorIdAndProductIdVp_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Optional TXT key for MRP Retry Interval Idle (CRI)\n"); + if (ShouldSkip("CRI_COMM_DISCOVERY_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForMrpRetryIntervalIdleCri_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Optional TXT key for MRP Retry Interval Active (CRA)\n"); + if (ShouldSkip("CRA_COMM_DISCOVERY_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForMrpRetryIntervalActiveCra_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : TXT key for commissioning mode (CM)\n"); + err = TestTxtKeyForCommissioningModeCm_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Optional TXT key for device name (DN)\n"); + if (ShouldSkip("DN_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForDeviceNameDn_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Optional TXT key for rotating device identifier (RI)\n"); + if (ShouldSkip("RI_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForRotatingDeviceIdentifierRi_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Optional TXT key for pairing hint (PH)\n"); + if (ShouldSkip("PH_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForPairingHintPh_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Optional TXT key for pairing instructions (PI)\n"); + if (ShouldSkip("PI_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForPairingInstructionsPi_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Check IPs\n"); + err = TestCheckIPs_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Reboot target device\n"); + err = TestRebootTargetDevice_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Open Commissioning Window\n"); + err = TestOpenCommissioningWindow_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Wait 1000ms for the mdns advertisement to be published\n"); + err = TestWait1000msForTheMdnsAdvertisementToBePublished_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Check Instance Name\n"); + err = TestCheckInstanceName_24(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 25; + + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mVendorId; + chip::Optional mProductId; + chip::Optional mDeviceType; + + char * deviceInstanceNameBeforeRebootBuffer = nullptr; + chip::CharSpan deviceInstanceNameBeforeReboot; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + if ((mTestIndex - 1) == 4) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMinLength("instanceName", nodeData.instanceName.size(), 16)); + VerifyOrReturn(CheckConstraintMaxLength("instanceName", nodeData.instanceName.size(), 16)); + + if (deviceInstanceNameBeforeRebootBuffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); + } + deviceInstanceNameBeforeRebootBuffer = static_cast(chip::Platform::MemoryAlloc(nodeData.instanceName.size())); + memcpy(deviceInstanceNameBeforeRebootBuffer, nodeData.instanceName.data(), nodeData.instanceName.size()); + deviceInstanceNameBeforeReboot = chip::CharSpan(deviceInstanceNameBeforeRebootBuffer, nodeData.instanceName.size()); + } + if ((mTestIndex - 1) == 5) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 6) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 7) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 8) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 9) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValue("longDiscriminator", nodeData.longDiscriminator, + mDiscriminator.HasValue() ? mDiscriminator.Value() : GetUniqueDiscriminator())); + + VerifyOrReturn(CheckConstraintMinValue("longDiscriminator", nodeData.longDiscriminator, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("longDiscriminator", nodeData.longDiscriminator, 4096U)); + } + if ((mTestIndex - 1) == 10) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValue("vendorId", nodeData.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); + } + if ((mTestIndex - 1) == 11) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValue("productId", nodeData.productId, mProductId.HasValue() ? mProductId.Value() : 32768U)); + } + if ((mTestIndex - 1) == 12) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValuePresent("mrpRetryIntervalIdle", nodeData.mrpRetryIntervalIdle)); + + VerifyOrReturn( + CheckConstraintMaxValue("mrpRetryIntervalIdle", nodeData.mrpRetryIntervalIdle.Value(), 3600000UL)); + } + if ((mTestIndex - 1) == 13) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValuePresent("mrpRetryIntervalActive", nodeData.mrpRetryIntervalActive)); + + VerifyOrReturn( + CheckConstraintMaxValue("mrpRetryIntervalActive", nodeData.mrpRetryIntervalActive.Value(), 3600000UL)); + } + if ((mTestIndex - 1) == 14) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValue("commissioningMode", nodeData.commissioningMode, 1)); + } + if ((mTestIndex - 1) == 15) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMaxLength("deviceName", nodeData.deviceName.size(), 32)); + } + if ((mTestIndex - 1) == 16) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMaxValue("rotatingIdLen", nodeData.rotatingIdLen, 100ULL)); + } + if ((mTestIndex - 1) == 17) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 18) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMaxLength("pairingInstruction", nodeData.pairingInstruction.size(), 128)); + } + if ((mTestIndex - 1) == 19) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMinValue("numIPs", nodeData.numIPs, 1)); + } + if ((mTestIndex - 1) == 24) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMinLength("instanceName", nodeData.instanceName.size(), 16)); + VerifyOrReturn(CheckConstraintMaxLength("instanceName", nodeData.instanceName.size(), 16)); + + VerifyOrReturn(CheckConstraintNotValue("instanceName", nodeData.instanceName, deviceInstanceNameBeforeReboot)); + } + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR TestRebootTargetDevice_0() + { + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : GetUniqueDiscriminator()); + } + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_1() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestOpenCommissioningWindow_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; + + RequestType request; + request.commissioningTimeout = 120U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_2(error); + }; + + ReturnErrorOnFailure( + chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestWait1000msForTheMdnsAdvertisementToBePublished_3() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + + CHIP_ERROR TestCheckInstanceName_4() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestCheckLongDiscriminatorL_5() + { + SetIdentity(kIdentityAlpha); + return FindCommissionableByLongDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : GetUniqueDiscriminator()); + } + + CHIP_ERROR TestCheckShortDiscriminatorS_6() + { + SetIdentity(kIdentityAlpha); + return FindCommissionableByShortDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() + : GetUniqueDiscriminator()); + } + + CHIP_ERROR TestCheckCommissioningModeCm_7() + { + SetIdentity(kIdentityAlpha); + return FindCommissionableByCommissioningMode(); + } + + CHIP_ERROR TestCheckVendorIdV_8() + { + SetIdentity(kIdentityAlpha); + return FindCommissionableByVendorId(mVendorId.HasValue() ? mVendorId.Value() : 65521U); + } + + CHIP_ERROR TestTxtKeyForDiscriminatorD_9() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestTxtKeyForVendorIdAndProductIdVp_10() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestTxtKeyForVendorIdAndProductIdVp_11() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForMrpRetryIntervalIdleCri_12() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForMrpRetryIntervalActiveCra_13() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestTxtKeyForCommissioningModeCm_14() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForDeviceNameDn_15() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForRotatingDeviceIdentifierRi_16() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForPairingHintPh_17() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForPairingInstructionsPi_18() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestCheckIPs_19() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestRebootTargetDevice_20() + { + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : GetUniqueDiscriminator()); + } + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_21() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestOpenCommissioningWindow_22() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; + + RequestType request; + request.commissioningTimeout = 120U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_22(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_22(error); + }; + + ReturnErrorOnFailure( + chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_22(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_22() { NextTest(); } + + CHIP_ERROR TestWait1000msForTheMdnsAdvertisementToBePublished_23() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + + CHIP_ERROR TestCheckInstanceName_24() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } +}; + class TestLogCommands : public TestCommand { public: @@ -68792,6 +70331,14 @@ class TestLogCommands : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -68805,13 +70352,13 @@ class TestLogCommands : public TestCommand CHIP_ERROR TestLogASimpleMessage_1() { SetIdentity(kIdentityAlpha); - return Log("This is a simple message"); + return Log(" This is a simple message"); } CHIP_ERROR TestDoASimpleUserPromptMessage_2() { SetIdentity(kIdentityAlpha); - return UserPrompt("This is a simple message"); + return UserPrompt(" This is a simple message"); } }; @@ -69363,6 +70910,14 @@ class TestSaveAs : public TestCommand uint8_t * readAttributeOctetStringNotDefaultValueBuffer = nullptr; chip::ByteSpan readAttributeOctetStringNotDefaultValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_4(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_4(error); @@ -72988,6 +74543,14 @@ class TestConfigVariables : public TestCommand uint8_t TestAddArgumentDefaultValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -73141,6 +74704,14 @@ class TestDescriptorCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -73439,6 +75010,14 @@ class TestBasicInformation : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -73716,6 +75295,14 @@ class TestIdentifyCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -73828,6 +75415,14 @@ class TestOperationalCredentialsCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -74069,6 +75664,14 @@ class TestModeSelectCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -74435,6 +76038,14 @@ class TestSystemCommands : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -74558,6 +76169,14 @@ class Test_TC_SWDIAG_1_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -74760,6 +76379,14 @@ class Test_TC_SWDIAG_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -74849,6 +76476,14 @@ class Test_TC_SWDIAG_3_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -75041,6 +76676,14 @@ class TestSubscribe_OnOff : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + typedef void (*Test_TestSubscribe_OnOff_OnOff_ReportCallback)(void * context, bool value); Test_TestSubscribe_OnOff_OnOff_ReportCallback mTest_TestSubscribe_OnOff_OnOff_Reported = nullptr; @@ -75771,6 +77414,14 @@ class DL_UsersAndCredentials : public TestCommand uint16_t NumberOfPINUsersSupported; uint16_t NumberOfRFIDUsersSupported; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -80774,6 +82425,14 @@ class DL_LockUnlock : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); @@ -81530,6 +83189,14 @@ class DL_Schedules : public TestCommand uint8_t NumberOfWeekDaySchedulesSupportedPerUser; uint8_t NumberOfYearDaySchedulesSupportedPerUser; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_2(error); @@ -84776,6 +86443,14 @@ class TestGroupMessaging : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_5(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_5(error); @@ -85333,6 +87008,14 @@ class TestGroupsCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -86121,6 +87804,14 @@ class TestGroupKeyManagementCluster : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); @@ -86815,6 +88506,14 @@ class Test_TC_DD_1_5 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -86822,8 +88521,8 @@ class Test_TC_DD_1_5 : public TestCommand CHIP_ERROR TestStep1_0() { SetIdentity(kIdentityAlpha); - return Log("Verify that the onboarding payload for NFC tags SHALL use NDEF URI Record Type Definition as defined by NFC " - "Forum in URI Record Type Definition RTD URI"); + return Log(" Verify that the onboarding payload for NFC tags SHALL use NDEF URI Record Type Definition as defined " + "by NFC Forum in URI Record Type Definition RTD URI"); } }; @@ -86891,6 +88590,14 @@ class Test_TC_DD_1_6 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -86898,21 +88605,21 @@ class Test_TC_DD_1_6 : public TestCommand CHIP_ERROR TestStep1_0() { SetIdentity(kIdentityAlpha); - return Log("Scan the DUTs QR code using a QR code reader"); + return Log(" Scan the DUTs QR code using a QR code reader"); } CHIP_ERROR TestStep1Verification_1() { SetIdentity(kIdentityAlpha); - return Log( - "Verify the QR code gets scanned successfully and the QR code must be of sufficient size and contrast respective to " - "surface material as to be readable with standard readers such as smartphones in normal lighting conditions"); + return Log(" Verify the QR code gets scanned successfully and the QR code must be of sufficient size and contrast " + "respective to surface material as to be readable with standard readers such as smartphones in normal lighting " + "conditions"); } CHIP_ERROR TestStep2Verificaiton_2() { SetIdentity(kIdentityAlpha); - return Log("Verify QR code version is 1 or higher"); + return Log(" Verify QR code version is 1 or higher"); } }; @@ -86976,6 +88683,14 @@ class Test_TC_DD_1_7 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -86983,14 +88698,14 @@ class Test_TC_DD_1_7 : public TestCommand CHIP_ERROR TestPrecondition_0() { SetIdentity(kIdentityAlpha); - return Log("Verify manual pairing code is printed on the device or in additional provided materials"); + return Log(" Verify manual pairing code is printed on the device or in additional provided materials"); } CHIP_ERROR TestStep1_1() { SetIdentity(kIdentityAlpha); - return Log("Verify that the Manual Pairing Code should be printed using a minimum font size of 6 points typically " - "producing a typeface height of 2.1 mm"); + return Log(" Verify that the Manual Pairing Code should be printed using a minimum font size of 6 points " + "typically producing a typeface height of 2.1 mm"); } }; @@ -87054,6 +88769,14 @@ class Test_TC_DD_1_8 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -87061,13 +88784,14 @@ class Test_TC_DD_1_8 : public TestCommand CHIP_ERROR TestStep1_0() { SetIdentity(kIdentityAlpha); - return Log("Scan the device QR code using DUT"); + return Log(" Scan the device QR code using DUT"); } CHIP_ERROR TestStep1Verification_1() { SetIdentity(kIdentityAlpha); - return Log("Verify the DUT is able to scan and parse the QR code successfully to onboard the device onto the CHIP network"); + return Log(" Verify the DUT is able to scan and parse the QR code successfully to onboard the device onto the " + "CHIP network"); } }; @@ -87135,6 +88859,14 @@ class Test_TC_DD_1_9 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -87142,20 +88874,21 @@ class Test_TC_DD_1_9 : public TestCommand CHIP_ERROR TestPrecondition_0() { SetIdentity(kIdentityAlpha); - return Log("Verify that the manual pairing code is printed on the device or in additional provided materials"); + return Log(" Verify that the manual pairing code is printed on the device or in additional provided materials"); } CHIP_ERROR TestStep1_1() { SetIdentity(kIdentityAlpha); - return Log("Provide the 11 digit or 21 digit pairing code from the Device in text speech or any format supported by DUT"); + return Log(" Provide the 11 digit or 21 digit pairing code from the Device in text speech or any format supported " + "by DUT"); } CHIP_ERROR TestStep1Verification_2() { SetIdentity(kIdentityAlpha); - return Log( - "Verify that the manual pairing code can be provided to DUT and parsed to onboard the device onto the CHIP network"); + return Log(" Verify that the manual pairing code can be provided to DUT and parsed to onboard the device onto the " + "CHIP network"); } }; @@ -87296,6 +89029,14 @@ class TestGroupDemoCommand : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -87748,6 +89489,14 @@ class TestGroupDemoConfig : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -87927,6 +89676,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), diff --git a/zzz_generated/placeholder/app1/zap-generated/test/Commands.h b/zzz_generated/placeholder/app1/zap-generated/test/Commands.h index 71b09e00a6144f..19cfcd6a95726e 100644 --- a/zzz_generated/placeholder/app1/zap-generated/test/Commands.h +++ b/zzz_generated/placeholder/app1/zap-generated/test/Commands.h @@ -157,6 +157,14 @@ class Test_TC_DM_1_3_Simulated : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -170,7 +178,7 @@ class Test_TC_DM_1_3_Simulated : public TestCommand CHIP_ERROR TestLogOnOffTestStartup_1() { SetIdentity(kIdentityAlpha); - return Log("*** Basic Cluster Tests Ready"); + return Log(" *** Basic Cluster Tests Ready"); } CHIP_ERROR TestQueryDataModelRevision_2() @@ -478,6 +486,14 @@ class Test_TC_DM_3_3_Simulated : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -650,6 +666,14 @@ class Test_TC_DM_2_3_Simulated : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // diff --git a/zzz_generated/placeholder/app2/zap-generated/test/Commands.h b/zzz_generated/placeholder/app2/zap-generated/test/Commands.h index 71b09e00a6144f..19cfcd6a95726e 100644 --- a/zzz_generated/placeholder/app2/zap-generated/test/Commands.h +++ b/zzz_generated/placeholder/app2/zap-generated/test/Commands.h @@ -157,6 +157,14 @@ class Test_TC_DM_1_3_Simulated : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -170,7 +178,7 @@ class Test_TC_DM_1_3_Simulated : public TestCommand CHIP_ERROR TestLogOnOffTestStartup_1() { SetIdentity(kIdentityAlpha); - return Log("*** Basic Cluster Tests Ready"); + return Log(" *** Basic Cluster Tests Ready"); } CHIP_ERROR TestQueryDataModelRevision_2() @@ -478,6 +486,14 @@ class Test_TC_DM_3_3_Simulated : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods // @@ -650,6 +666,14 @@ class Test_TC_DM_2_3_Simulated : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + // // Tests methods //