Skip to content

Commit

Permalink
Add TestMultiAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple committed Feb 26, 2022
1 parent db7ab8c commit 2c949ef
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/chip-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static_library("chip-tool-utils") {

public_deps = [
"${chip_root}/src/app/server",
"${chip_root}/src/app/tests/suites/commands/commissioner",
"${chip_root}/src/app/tests/suites/commands/delay",
"${chip_root}/src/app/tests/suites/commands/discovery",
"${chip_root}/src/app/tests/suites/commands/log",
Expand Down
4 changes: 4 additions & 0 deletions examples/chip-tool/commands/tests/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "../common/CHIPCommand.h"
#include <app/tests/suites/commands/commissioner/CommissionerCommands.h>
#include <app/tests/suites/commands/delay/DelayCommands.h>
#include <app/tests/suites/commands/discovery/DiscoveryCommands.h>
#include <app/tests/suites/commands/log/LogCommands.h>
Expand All @@ -36,6 +37,7 @@ class TestCommand : public CHIPCommand,
public ConstraintsChecker,
public PICSChecker,
public LogCommands,
public CommissionerCommands,
public DiscoveryCommands,
public SystemCommands,
public DelayCommands
Expand Down Expand Up @@ -77,6 +79,8 @@ class TestCommand : public CHIPCommand,
return CHIP_NO_ERROR;
}

chip::Controller::DeviceCommissioner & GetCurrentCommissioner() override { return CurrentCommissioner(); };

void Exit(std::string message) override;
void ThrowFailureResponse();
void ThrowSuccessResponse();
Expand Down
5 changes: 5 additions & 0 deletions examples/chip-tool/templates/tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@ function getTests()
'TestBinding',
];

const MultiAdmin = [
'TestMultiAdmin',
];

const SoftwareDiagnostics = [
'Test_TC_SWDIAG_1_1',
'Test_TC_SWDIAG_2_1',
Expand Down Expand Up @@ -511,6 +515,7 @@ function getTests()
WindowCovering, //
TV, //
Others, //
MultiAdmin, //
SoftwareDiagnostics, //
Subscriptions, //
DoorLock, //
Expand Down
141 changes: 141 additions & 0 deletions src/app/tests/suites/TestMultiAdmin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# 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.

name: Test Multi Admin

config:
nodeId: 0x12344321
nodeId2:
type: NODE_ID
defaultValue: 0xCAFE
nodeId3:
type: NODE_ID
defaultValue: 0xC00FEE
endpoint: 0
discriminator:
type: INT16U
defaultValue: 3840
payload:
type: CHAR_STRING
defaultValue: "MT:-24J0AFN00KA0648G00" # This value needs to be generated automatically

tests:
- label: "Reboot target device"
cluster: "SystemCommands"
command: "Reboot"
arguments:
values:
- name: "discriminator"
value: discriminator

- label: "Wait for the commissioned device to be retrieved for alpha"
cluster: "DelayCommands"
command: "WaitForCommissionee"
arguments:
values:
- name: "nodeId"
value: nodeId

- label: "Open Commissioning Window from alpha"
cluster: "AdministratorCommissioning"
command: "OpenBasicCommissioningWindow"
timedInteractionTimeoutMs: 10000
arguments:
values:
- name: "CommissioningTimeout"
value: 120

- label: "Commission from beta"
identity: "beta"
cluster: "CommissionerCommands"
command: "PairWithQRCode"
arguments:
values:
- name: "nodeId"
value: nodeId2
- name: "payload"
value: payload

- label: "Wait for the commissioned device to be retrieved for beta"
identity: "beta"
cluster: "DelayCommands"
command: "WaitForCommissionee"
arguments:
values:
- name: "nodeId"
value: nodeId2

- label: "Open Commissioning Window from beta"
identity: "beta"
cluster: "AdministratorCommissioning"
command: "OpenBasicCommissioningWindow"
timedInteractionTimeoutMs: 10000
arguments:
values:
- name: "CommissioningTimeout"
value: 120

- label: "Commission from gamma"
identity: "gamma"
cluster: "CommissionerCommands"
command: "PairWithQRCode"
arguments:
values:
- name: "nodeId"
value: nodeId3
- name: "payload"
value: payload

- label: "Wait for the commissioned device to be retrieved for gamma"
identity: "gamma"
cluster: "DelayCommands"
command: "WaitForCommissionee"
arguments:
values:
- name: "nodeId"
value: nodeId3

- label: "read the mandatory attribute: NodeLabel from alpha"
identity: "alpha"
cluster: "Basic"
command: "readAttribute"
attribute: "NodeLabel"
response:
value: ""
saveAs: readFromAlpha

- label: "write the mandatory attribute NodeLabel from beta"
identity: "beta"
cluster: "Basic"
command: "writeAttribute"
attribute: "NodeLabel"
arguments:
value: "written from beta"

- label: "read the mandatory attribute: NodeLabel from gamma"
identity: "gamma"
cluster: "Basic"
command: "readAttribute"
attribute: "NodeLabel"
response:
constraints:
notValue: readFromAlpha

- label: "write the mandatory attribute NodeLabel back to default"
identity: "alpha"
cluster: "Basic"
command: "writeAttribute"
attribute: "NodeLabel"
arguments:
value: readFromAlpha

0 comments on commit 2c949ef

Please sign in to comment.