From 2cb55c47c8456312a2cbfe2826f04652beb74f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szablowski?= <56074162+doublemis1@users.noreply.github.com> Date: Thu, 25 Aug 2022 17:43:17 +0200 Subject: [PATCH] Update light switch doc (#21963) * Update multicast testing documentation with yaml test alignment * Regen zap * Fixing style Co-authored-by: Justin Wood --- .../light-switch-app/nrfconnect/README.md | 21 +------ src/app/tests/suites/TestGroupDemoConfig.yaml | 55 ++++++++++--------- .../chip-tool/zap-generated/test/Commands.h | 42 +++++++------- 3 files changed, 52 insertions(+), 66 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..97277f16be6526 100644 --- a/src/app/tests/suites/TestGroupDemoConfig.yaml +++ b/src/app/tests/suites/TestGroupDemoConfig.yaml @@ -27,7 +27,7 @@ name: Group Messaging Demo - Configuration config: nodeId: 0x12344321 - cluster: "Groups" + cluster: "Group Key Management" endpoint: 0 tests: @@ -39,23 +39,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,32 +58,49 @@ 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: "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 for test" + - 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, }, diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 19d36d770651be..92385597127747 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -75328,18 +75328,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)); @@ -75367,17 +75367,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; @@ -75411,8 +75401,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; @@ -75422,7 +75412,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); @@ -75430,8 +75420,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;