Skip to content

Commit

Permalink
Add simulated dm test (#14543)
Browse files Browse the repository at this point in the history
* Add Test_TC_DM_2_3 test

* Generated Code.
  • Loading branch information
Josh V [Apple] authored and pull[bot] committed Feb 16, 2022
1 parent aa3465a commit 1236617
Show file tree
Hide file tree
Showing 23 changed files with 1,042 additions and 43 deletions.
41 changes: 41 additions & 0 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,46 @@ server cluster Descriptor = 29 {
readonly global attribute int16u clusterRevision = 65533;
}

client cluster GeneralCommissioning = 48 {
enum GeneralCommissioningError : ENUM8 {
kOk = 0;
kValueOutsideRange = 1;
kInvalidAuthentication = 2;
kNotCommissioning = 3;
}

enum RegulatoryLocationType : ENUM8 {
kIndoor = 0;
kOutdoor = 1;
kIndoorOutdoor = 2;
}

struct BasicCommissioningInfoType {
INT32U failSafeExpiryLengthMs = 0;
}

attribute int64u breadcrumb = 0;
readonly attribute BasicCommissioningInfoType basicCommissioningInfoList[] = 1;
readonly global attribute int16u clusterRevision = 65533;

request struct ArmFailSafeRequest {
INT16U expiryLengthSeconds = 0;
INT64U breadcrumb = 1;
INT32U timeoutMs = 2;
}

request struct SetRegulatoryConfigRequest {
RegulatoryLocationType location = 0;
CHAR_STRING countryCode = 1;
INT64U breadcrumb = 2;
INT32U timeoutMs = 3;
}

command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0;
command CommissioningComplete(): CommissioningCompleteResponse = 4;
command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2;
}

server cluster GeneralCommissioning = 48 {
enum GeneralCommissioningError : ENUM8 {
kOk = 0;
Expand Down Expand Up @@ -829,6 +869,7 @@ server cluster TemperatureMeasurement = 1026 {
endpoint 0 {
server cluster Basic;
server cluster Descriptor;
binding cluster GeneralCommissioning;
server cluster GeneralCommissioning;
server cluster NetworkCommissioning;
binding cluster OperationalCredentials;
Expand Down
8 changes: 4 additions & 4 deletions examples/placeholder/linux/apps/app1/config.zap
Original file line number Diff line number Diff line change
Expand Up @@ -491,31 +491,31 @@
"mfgCode": null,
"define": "GENERAL_COMMISSIONING_CLUSTER",
"side": "client",
"enabled": 0,
"enabled": 1,
"commands": [
{
"name": "ArmFailSafe",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
"outgoing": 1
},
{
"name": "SetRegulatoryConfig",
"code": 2,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
"outgoing": 1
},
{
"name": "CommissioningComplete",
"code": 4,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
"outgoing": 1
}
],
"attributes": [
Expand Down
1 change: 1 addition & 0 deletions examples/placeholder/linux/apps/app1/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function getTests()
const tests = [
"Test_TC_DM_1_3_Simulated",
"Test_TC_DM_3_3_Simulated",
"Test_TC_DM_2_3_Simulated",
];

return tests.join(', ');
Expand Down
41 changes: 41 additions & 0 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,46 @@ server cluster Descriptor = 29 {
readonly global attribute int16u clusterRevision = 65533;
}

client cluster GeneralCommissioning = 48 {
enum GeneralCommissioningError : ENUM8 {
kOk = 0;
kValueOutsideRange = 1;
kInvalidAuthentication = 2;
kNotCommissioning = 3;
}

enum RegulatoryLocationType : ENUM8 {
kIndoor = 0;
kOutdoor = 1;
kIndoorOutdoor = 2;
}

struct BasicCommissioningInfoType {
INT32U failSafeExpiryLengthMs = 0;
}

attribute int64u breadcrumb = 0;
readonly attribute BasicCommissioningInfoType basicCommissioningInfoList[] = 1;
readonly global attribute int16u clusterRevision = 65533;

request struct ArmFailSafeRequest {
INT16U expiryLengthSeconds = 0;
INT64U breadcrumb = 1;
INT32U timeoutMs = 2;
}

request struct SetRegulatoryConfigRequest {
RegulatoryLocationType location = 0;
CHAR_STRING countryCode = 1;
INT64U breadcrumb = 2;
INT32U timeoutMs = 3;
}

command ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0;
command CommissioningComplete(): CommissioningCompleteResponse = 4;
command SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2;
}

server cluster GeneralCommissioning = 48 {
enum GeneralCommissioningError : ENUM8 {
kOk = 0;
Expand Down Expand Up @@ -829,6 +869,7 @@ server cluster TemperatureMeasurement = 1026 {
endpoint 0 {
server cluster Basic;
server cluster Descriptor;
binding cluster GeneralCommissioning;
server cluster GeneralCommissioning;
server cluster NetworkCommissioning;
binding cluster OperationalCredentials;
Expand Down
8 changes: 4 additions & 4 deletions examples/placeholder/linux/apps/app2/config.zap
Original file line number Diff line number Diff line change
Expand Up @@ -491,31 +491,31 @@
"mfgCode": null,
"define": "GENERAL_COMMISSIONING_CLUSTER",
"side": "client",
"enabled": 0,
"enabled": 1,
"commands": [
{
"name": "ArmFailSafe",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
"outgoing": 1
},
{
"name": "SetRegulatoryConfig",
"code": 2,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
"outgoing": 1
},
{
"name": "CommissioningComplete",
"code": 4,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
"outgoing": 1
}
],
"attributes": [
Expand Down
12 changes: 11 additions & 1 deletion examples/placeholder/linux/include/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ class TestCommand : public PICSChecker, public LogCommands
virtual ~TestCommand() {}

virtual void NextTest() = 0;
void Wait() {}
CHIP_ERROR WaitMS(chip::System::Clock::Timeout ms)
{
return chip::DeviceLayer::SystemLayer().StartTimer(ms, OnWaitForMsFn, this);
}
CHIP_ERROR WaitForMs(uint16_t ms) { return WaitMS(chip::System::Clock::Milliseconds32(ms)); }
void SetCommandExitStatus(CHIP_ERROR status)
{
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
Expand Down Expand Up @@ -120,6 +124,11 @@ class TestCommand : public PICSChecker, public LogCommands
mCommandPath = chip::app::ConcreteCommandPath(0, 0, 0);
mAttributePath = chip::app::ConcreteAttributePath(0, 0, 0);
}
static void OnWaitForMsFn(chip::System::Layer * systemLayer, void * context)
{
auto * command = static_cast<TestCommand *>(context);
command->NextTest();
}

std::atomic_bool isRunning{ true };

Expand All @@ -128,4 +137,5 @@ class TestCommand : public PICSChecker, public LogCommands
chip::app::ConcreteAttributePath mAttributePath;
chip::Optional<chip::EndpointId> mEndpointId;
void SetIdentity(const char * name){};
void Wait(){};
};
58 changes: 58 additions & 0 deletions src/app/tests/suites/certification/Test_TC_DM_2_3_Simulated.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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: 10.2.3. [TC-DM-2.3] Operational Credential Commands [DUT - Commissioner]

config:
cluster: "Operational Credentials"
endpoint: 0

tests:
- label: "Wait for Arm Fail Safe"
wait: "ArmFailSafe"
cluster: "General Commissioning"

- label: "Wait for Set Regulatory Config"
wait: "SetRegulatoryConfig"
cluster: "General Commissioning"

- label: "Wait for Attestation Certificate Chain Request"
wait: "CertificateChainRequest"

- label: "Wait for Attestation Certificate Chain Request"
wait: "CertificateChainRequest"

- label: "Wait for Attestation Request"
wait: "AttestationRequest"

- label: "Wait for CSR Request"
wait: "OpCSRRequest"

- label: "Wait for Add Trusted Root Certificate Request"
wait: "AddTrustedRootCertificate"

- label: "Wait for Add Op NOC"
wait: "AddNOC"

- label: "Wait for Commissioning Complete"
wait: "CommissioningComplete"
cluster: "General Commissioning"

- label: "Wait 3000ms"
cluster: "DelayCommands"
command: "WaitForMs"
arguments:
values:
- name: "ms"
value: 3000

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1236617

Please sign in to comment.