Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle Add simple YAML test for access control cluster #15211

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/chip-tool/templates/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ function getManualTests()

function getTests()
{
const AccessControl = [
'TestAccessControlCluster',
];

const BinaryInput = [
'Test_TC_BI_1_1',
'Test_TC_BI_2_1',
Expand Down Expand Up @@ -285,6 +289,7 @@ function getTests()
];

const tests = [
AccessControl, //
BinaryInput, //
BooleanState, //
BridgedActions, //
Expand Down
167 changes: 167 additions & 0 deletions src/app/tests/suites/TestAccessControlCluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# 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: Access Control Cluster Tests

config:
nodeId: 0x12344321
cluster: "Access Control"
endpoint: 0

tests:
- label: "Wait for commissionee"
cluster: "DelayCommands"
command: "WaitForCommissionee"
arguments:
values:
- name: "nodeId"
value: nodeId

- label: "Write"
command: "writeAttribute"
attribute: "ACL"
arguments:
value: [
{
FabricIndex: 1,
Privilege: 5, # administer
AuthMode: 2, # case
Subjects: [nodeId, 1234, 5678, 9090],
Targets:
[
{ Cluster: null, Endpoint: 0, DeviceType: null },
{ Cluster: 1, Endpoint: null, DeviceType: null },
{ Cluster: 2, Endpoint: 3, DeviceType: null },
],
},
{
FabricIndex: 1,
Privilege: 1, # view
AuthMode: 2, # case
Subjects: [1234, 5678, 0x8080, 0xFFFF],
Targets:
[
{ Cluster: null, Endpoint: 1, DeviceType: null },
{ Cluster: 2, Endpoint: null, DeviceType: null },
{ Cluster: 3, Endpoint: 4, DeviceType: null },
],
},
{
FabricIndex: 1,
Privilege: 3, # operate
AuthMode: 3, # group
Subjects: [0x0101, 0x0102, 0xAAAA, 0xBBBB],
Targets:
[
{ Cluster: null, Endpoint: 2, DeviceType: null },
{ Cluster: 3, Endpoint: null, DeviceType: null },
{ Cluster: 4, Endpoint: 5, DeviceType: null },
],
},
]

- label: "Read"
command: "readAttribute"
attribute: "ACL"
response:
value: [
{
FabricIndex: 1,
Privilege: 5, # administer
AuthMode: 2, # case
Subjects: [nodeId, 1234, 5678, 9090],
Targets:
[
{ Cluster: null, Endpoint: 0, DeviceType: null },
{ Cluster: 1, Endpoint: null, DeviceType: null },
{ Cluster: 2, Endpoint: 3, DeviceType: null },
],
},
{
FabricIndex: 1,
Privilege: 1, # view
AuthMode: 2, # case
Subjects: [1234, 5678, 0x8080, 0xFFFF],
Targets:
[
{ Cluster: null, Endpoint: 1, DeviceType: null },
{ Cluster: 2, Endpoint: null, DeviceType: null },
{ Cluster: 3, Endpoint: 4, DeviceType: null },
],
},
{
FabricIndex: 1,
Privilege: 3, # operate
AuthMode: 3, # group
Subjects: [0x0101, 0x0102, 0xAAAA, 0xBBBB],
Targets:
[
{ Cluster: null, Endpoint: 2, DeviceType: null },
{ Cluster: 3, Endpoint: null, DeviceType: null },
{ Cluster: 4, Endpoint: 5, DeviceType: null },
],
},
]

- label: "Write"
command: "writeAttribute"
attribute: "ACL"
arguments:
value: [
{
FabricIndex: 1,
Privilege: 5, # administer
AuthMode: 2, # case
Subjects: [nodeId],
Targets:
[
{ Cluster: null, Endpoint: 0, DeviceType: null },
{ Cluster: 1, Endpoint: null, DeviceType: null },
{ Cluster: 2, Endpoint: 3, DeviceType: null },
],
},
{
FabricIndex: 1,
Privilege: 1, # view
AuthMode: 2, # case
Subjects: [0xCCCC, 0xDDDD],
Targets: [{ Cluster: 5, Endpoint: 6, DeviceType: null }],
},
]

- label: "Read"
command: "readAttribute"
attribute: "ACL"
response:
value: [
{
FabricIndex: 1,
Privilege: 5, # administer
AuthMode: 2, # case
Subjects: [nodeId],
Targets:
[
{ Cluster: null, Endpoint: 0, DeviceType: null },
{ Cluster: 1, Endpoint: null, DeviceType: null },
{ Cluster: 2, Endpoint: 3, DeviceType: null },
],
},
{
FabricIndex: 1,
Privilege: 1, # view
AuthMode: 2, # case
Subjects: [0xCCCC, 0xDDDD],
Targets: [{ Cluster: 5, Endpoint: 6, DeviceType: null }],
},
]
5 changes: 5 additions & 0 deletions src/darwin/Framework/CHIP/templates/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

function getTests()
{
const AccessControl = [
'TestAccessControlCluster',
];

const BinaryInput = [
'Test_TC_BI_1_1',
'Test_TC_BI_2_1',
Expand Down Expand Up @@ -231,6 +235,7 @@ function getTests()
];

const tests = [
AccessControl, //
BinaryInput, //
BooleanState, //
BridgedActions, //
Expand Down
Loading