From bbe25f02c759cf339fbd6a0930c14a17f1edcab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szablowski?= Date: Wed, 17 Aug 2022 12:13:28 +0200 Subject: [PATCH 1/3] Update multicast testing documentation with yaml test alignment --- .../light-switch-app/nrfconnect/README.md | 21 +------ src/app/tests/suites/TestGroupDemoConfig.yaml | 60 ++++++++++--------- 2 files changed, 36 insertions(+), 45 deletions(-) diff --git a/examples/light-switch-app/nrfconnect/README.md b/examples/light-switch-app/nrfconnect/README.md index a40ed845742c0c..7d55b031e6b73d 100644 --- a/examples/light-switch-app/nrfconnect/README.md +++ b/examples/light-switch-app/nrfconnect/README.md @@ -695,35 +695,20 @@ To perform the unicast binding process, complete the following steps: 1. Build the CHIP Tool according to the steps from the [CHIP Tool user guide](../../../docs/guides/chip_tool_guide.md#building). 2. Go to the CHIP Tool build directory. -3. Add an ACL to the [lighting endpoint](../../lighting-app/nrfconnect/) - permissions by running the following command: - chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": [2], "targets": [{"cluster": 6, "endpoint": 1, "deviceType": null}, {"cluster": 8, "endpoint": 1, "deviceType": null}]}]' 1 0 - - In this command: - - - `{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}` - is an ACL for the communication with the CHIP Tool. - - `{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [2], "targets": [{"cluster": 6, "endpoint": 1, "deviceType": null}, {"cluster": 8, "endpoint": 1, "deviceType": null}]}` - is an ACL for binding (cluster `no. 6` is the On/Off cluster and the - cluster `no. 8` is the Level Control cluster). - - This allows the lighting application device to receive commands from the - light switch device. - -4. Add the light switch device to the multicast group by running the following +3. Add the light switch device to the multicast group by running the following command: chip-tool tests TestGroupDemoConfig --nodeId 1 -5. Add all light bulbs to the same multicast group by applying command below +4. Add all light bulbs to the same multicast group by applying command below for each of the light bulbs, using the appropriate `` (the user-defined ID of the node being commissioned except `2` due to use this `` for light-switch) for each of them: chip-tool tests TestGroupDemoConfig --nodeId -6. Add Binding commands for group multicast: +5. Add Binding commands for group multicast: chip-tool binding write binding '[{"fabricIndex": 1, "group": 257}]' 2 1 diff --git a/src/app/tests/suites/TestGroupDemoConfig.yaml b/src/app/tests/suites/TestGroupDemoConfig.yaml index ea475248d45e1e..102ebe22c12126 100644 --- a/src/app/tests/suites/TestGroupDemoConfig.yaml +++ b/src/app/tests/suites/TestGroupDemoConfig.yaml @@ -27,10 +27,11 @@ name: Group Messaging Demo - Configuration config: nodeId: 0x12344321 - cluster: "Groups" + cluster: "Group Key Management" endpoint: 0 tests: + - label: "Wait for the commissioned device to be retrieved" cluster: "DelayCommands" command: "WaitForCommissionee" @@ -39,23 +40,7 @@ tests: - name: "nodeId" value: nodeId - - label: "Add Group 1 - endpoint 1" - command: "AddGroup" - endpoint: 1 - arguments: - values: - - name: "groupId" - value: 0x0101 - - name: "groupName" - value: "Group #1" - response: - values: - - name: "status" - value: 0 - - name: "groupId" - value: 0x0101 - - - label: "KeySet Write 1" + - label: "KeySet Write 1 (endpoint 0)" cluster: "Group Key Management" command: "KeySetWrite" arguments: @@ -74,33 +59,54 @@ tests: EpochStartTime2: 1110002, } - - label: "Map Group Key Set to group ID on a given fabric" + + - label: "Write Group Keys (endpoint 0)" cluster: "Group Key Management" command: "writeAttribute" attribute: "GroupKeyMap" arguments: - value: [{ FabricIndex: 1, GroupId: 0x0101, GroupKeySetID: 0x01a1 }] + value: + [{ FabricIndex: 0, GroupId: 0x0101, GroupKeySetID: 0x01a1 }] - - label: "Install ACLs for test" + - label: "Add Group 1 (endpoint 1)" + cluster: "Groups" + command: "AddGroup" + endpoint: 1 + arguments: + values: + - name: "groupId" + value: 0x0101 + - name: "groupName" + value: "Group #1" + response: + values: + - name: "status" + value: 0 + - name: "groupId" + value: 0x0101 + + + - label: "Install ACLs" cluster: "Access Control" command: "writeAttribute" attribute: "ACL" arguments: value: [ - # Any CASE can admin + # Any CASE can administer { FabricIndex: 1, - Privilege: 5, - AuthMode: 2, + Privilege: 5, # administer + AuthMode: 2, # case Subjects: null, Targets: null, }, - # These groups can operate + # Any group can operate { FabricIndex: 1, - Privilege: 3, - AuthMode: 3, + Privilege: 3, # operate + AuthMode: 3, # group Subjects: [0x0101], Targets: null, }, ] + From 11b307f254c7f1998d65c2ee5936f218dbfffc19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szablowski?= Date: Wed, 17 Aug 2022 12:20:21 +0200 Subject: [PATCH 2/3] Regen zap --- .../chip-tool/zap-generated/test/Commands.h | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index bdd9b181fe77c9..01f2ac688fe6bb 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -75899,18 +75899,18 @@ class TestGroupDemoConfigSuite : public TestCommand break; case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); - } break; case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); + } break; case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -75938,17 +75938,7 @@ class TestGroupDemoConfigSuite : public TestCommand return WaitForCommissionee(kIdentityAlpha, value); } case 1: { - LogStep(1, "Add Group 1 - endpoint 1"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupId = 257U; - value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "KeySet Write 1"); + LogStep(1, "KeySet Write 1 (endpoint 0)"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -75982,8 +75972,8 @@ class TestGroupDemoConfigSuite : public TestCommand ); } - case 3: { - LogStep(3, "Map Group Key Set to group ID on a given fabric"); + case 2: { + LogStep(2, "Write Group Keys (endpoint 0)"); ListFreer listFreer; chip::app::DataModel::List value; @@ -75993,7 +75983,7 @@ class TestGroupDemoConfigSuite : public TestCommand listHolder_0->mList[0].groupId = 257U; listHolder_0->mList[0].groupKeySetID = 417U; - listHolder_0->mList[0].fabricIndex = 1U; + listHolder_0->mList[0].fabricIndex = 0U; value = chip::app::DataModel::List( listHolder_0->mList, 1); @@ -76001,8 +75991,18 @@ class TestGroupDemoConfigSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } + case 3: { + LogStep(3, "Add Group 1 (endpoint 1)"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 257U; + value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional + + ); + } case 4: { - LogStep(4, "Install ACLs for test"); + LogStep(4, "Install ACLs"); ListFreer listFreer; chip::app::DataModel::List value; From 03dc3a14fe221078e6d54860a34683c0afd2b005 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 17 Aug 2022 11:43:30 -0700 Subject: [PATCH 3/3] Fixing style --- src/app/tests/suites/TestGroupDemoConfig.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/app/tests/suites/TestGroupDemoConfig.yaml b/src/app/tests/suites/TestGroupDemoConfig.yaml index 102ebe22c12126..97277f16be6526 100644 --- a/src/app/tests/suites/TestGroupDemoConfig.yaml +++ b/src/app/tests/suites/TestGroupDemoConfig.yaml @@ -31,7 +31,6 @@ config: endpoint: 0 tests: - - label: "Wait for the commissioned device to be retrieved" cluster: "DelayCommands" command: "WaitForCommissionee" @@ -59,14 +58,12 @@ tests: EpochStartTime2: 1110002, } - - label: "Write Group Keys (endpoint 0)" cluster: "Group Key Management" command: "writeAttribute" attribute: "GroupKeyMap" arguments: - value: - [{ FabricIndex: 0, GroupId: 0x0101, GroupKeySetID: 0x01a1 }] + value: [{ FabricIndex: 0, GroupId: 0x0101, GroupKeySetID: 0x01a1 }] - label: "Add Group 1 (endpoint 1)" cluster: "Groups" @@ -85,7 +82,6 @@ tests: - name: "groupId" value: 0x0101 - - label: "Install ACLs" cluster: "Access Control" command: "writeAttribute" @@ -109,4 +105,3 @@ tests: Targets: null, }, ] -