Skip to content

Commit

Permalink
Add simple YAML test for access control cluster
Browse files Browse the repository at this point in the history
This is a very simple test for now.
I will come back and add lots more.

Towards issue project-chip#10253
  • Loading branch information
mlepage-google committed Feb 15, 2022
1 parent 17dc4b0 commit cd249cc
Show file tree
Hide file tree
Showing 5 changed files with 1,353 additions and 0 deletions.
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
163 changes: 163 additions & 0 deletions src/app/tests/suites/TestAccessControlCluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# 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

0 comments on commit cd249cc

Please sign in to comment.