From 493148592eb247f6ef52ca8a3ea99153b8c87d7b Mon Sep 17 00:00:00 2001 From: Ricardo Casallas <77841255+rcasallas-silabs@users.noreply.github.com> Date: Thu, 14 Jul 2022 19:41:33 -0400 Subject: [PATCH] Groups cluster: Check that keys are set before AddGroup. (#20688) * Groups cluster: Check that keys are set before AddGroup. * Groups cluster: Review comments applied. --- .../clusters/groups-server/groups-server.cpp | 30 + .../suites/TestGroupKeyManagementCluster.yaml | 68 +- src/app/tests/suites/TestGroupMessaging.yaml | 142 ++-- src/app/tests/suites/TestGroupsCluster.yaml | 124 ++-- .../chip-tool/zap-generated/test/Commands.h | 583 ++++++++++------ .../zap-generated/test/Commands.h | 652 +++++++++++++----- 6 files changed, 1094 insertions(+), 505 deletions(-) diff --git a/src/app/clusters/groups-server/groups-server.cpp b/src/app/clusters/groups-server/groups-server.cpp index e1eb32eb04c994..fe5002da1306a1 100644 --- a/src/app/clusters/groups-server/groups-server.cpp +++ b/src/app/clusters/groups-server/groups-server.cpp @@ -68,6 +68,9 @@ using namespace app::Clusters; using namespace app::Clusters::Groups; using namespace chip::Credentials; +/** + * @brief Checks if group-endpoint association exist for the given fabric + */ static bool GroupExists(FabricIndex fabricIndex, EndpointId endpointId, GroupId groupId) { GroupDataProvider * provider = GetGroupDataProvider(); @@ -76,13 +79,40 @@ static bool GroupExists(FabricIndex fabricIndex, EndpointId endpointId, GroupId return provider->HasEndpoint(fabricIndex, groupId, endpointId); } +/** + * @brief Checks if there are key set associated with the given GroupId + */ +static bool KeyExists(FabricIndex fabricIndex, GroupId groupId) +{ + GroupDataProvider * provider = GetGroupDataProvider(); + VerifyOrReturnError(nullptr != provider, false); + GroupDataProvider::GroupKey entry; + + auto it = provider->IterateGroupKeys(fabricIndex); + bool found = false; + while (it->Next(entry) && !found) + { + found = (entry.group_id == groupId); + } + it->Release(); + + if (found) + { + GroupDataProvider::KeySet keys; + found = (CHIP_NO_ERROR == provider->GetKeySet(fabricIndex, entry.keyset_id, keys)); + } + return found; +} + static EmberAfStatus GroupAdd(FabricIndex fabricIndex, EndpointId endpointId, GroupId groupId, const CharSpan & groupName) { VerifyOrReturnError(IsFabricGroupId(groupId), EMBER_ZCL_STATUS_CONSTRAINT_ERROR); GroupDataProvider * provider = GetGroupDataProvider(); VerifyOrReturnError(nullptr != provider, EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrReturnError(KeyExists(fabricIndex, groupId), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS); + // Add a new entry to the GroupTable CHIP_ERROR err = provider->SetGroupInfo(fabricIndex, GroupDataProvider::GroupInfo(groupId, groupName)); if (CHIP_NO_ERROR == err) { diff --git a/src/app/tests/suites/TestGroupKeyManagementCluster.yaml b/src/app/tests/suites/TestGroupKeyManagementCluster.yaml index 7868b112f862af..ced7cc065d63ac 100644 --- a/src/app/tests/suites/TestGroupKeyManagementCluster.yaml +++ b/src/app/tests/suites/TestGroupKeyManagementCluster.yaml @@ -41,40 +41,6 @@ tests: response: value: 2 - - label: "Add Group 1" - cluster: "Groups" - endpoint: 1 - command: "AddGroup" - arguments: - values: - - name: "GroupId" - value: 0x0101 - - name: "GroupName" - value: "Group #1" - response: - values: - - name: "status" - value: 0 - - name: "GroupId" - value: 0x0101 - - - label: "Add Group 2" - cluster: "Groups" - endpoint: 1 - command: "AddGroup" - arguments: - values: - - name: "GroupId" - value: 0x0102 - - name: "GroupName" - value: "Group #2" - response: - values: - - name: "status" - value: 0 - - name: "GroupId" - value: 0x0102 - - label: "KeySet Write 1" command: "KeySetWrite" arguments: @@ -166,6 +132,40 @@ tests: { FabricIndex: 1, GroupId: 0x0102, GroupKeySetID: 0x01a2 }, ] + - label: "Add Group 1" + cluster: "Groups" + endpoint: 1 + command: "AddGroup" + arguments: + values: + - name: "GroupId" + value: 0x0101 + - name: "GroupName" + value: "Group #1" + response: + values: + - name: "status" + value: 0 + - name: "GroupId" + value: 0x0101 + + - label: "Add Group 2" + cluster: "Groups" + endpoint: 1 + command: "AddGroup" + arguments: + values: + - name: "GroupId" + value: 0x0102 + - name: "GroupName" + value: "Group #2" + response: + values: + - name: "status" + value: 0 + - name: "GroupId" + value: 0x0102 + - label: "Read GroupTable" command: "readAttribute" attribute: "GroupTable" diff --git a/src/app/tests/suites/TestGroupMessaging.yaml b/src/app/tests/suites/TestGroupMessaging.yaml index 10bf56f48cdac8..36ce37b69596ea 100644 --- a/src/app/tests/suites/TestGroupMessaging.yaml +++ b/src/app/tests/suites/TestGroupMessaging.yaml @@ -41,40 +41,6 @@ tests: - name: "nodeId" value: nodeId - - 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: "Add Group 2 (endpoint 0)" - cluster: "Groups" - command: "AddGroup" - endpoint: 0 - arguments: - values: - - name: "groupId" - value: 0x0102 - - name: "groupName" - value: "Group #2" - response: - values: - - name: "status" - value: 0 - - name: "groupId" - value: 0x0102 - - label: "KeySet Write 1" cluster: "Group Key Management" command: "KeySetWrite" @@ -122,6 +88,40 @@ tests: { FabricIndex: 0, GroupId: 0x0102, GroupKeySetID: 0x01a2 }, ] + - 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: "Add Group 2 (endpoint 0)" + cluster: "Groups" + command: "AddGroup" + endpoint: 0 + arguments: + values: + - name: "groupId" + value: 0x0102 + - name: "groupName" + value: "Group #2" + response: + values: + - name: "status" + value: 0 + - name: "groupId" + value: 0x0102 + - label: "Install ACLs" cluster: "Access Control" command: "writeAttribute" @@ -169,7 +169,7 @@ tests: arguments: values: - name: "ms" - value: 100 + value: 1000 # Test Pair 2 : Validates previous group write attribute with a unicast to read - label: "Read back Attribute" @@ -290,42 +290,6 @@ tests: - name: "nodeId" value: nodeId2 - - label: "Add Group 1 (endpoint 1) for gamma" - identity: "gamma" - 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: "Add Group 2 (endpoint 0) for gamma" - identity: "gamma" - cluster: "Groups" - command: "AddGroup" - endpoint: 0 - arguments: - values: - - name: "groupId" - value: 0x0102 - - name: "groupName" - value: "Group #2" - response: - values: - - name: "status" - value: 0 - - name: "groupId" - value: 0x0102 - - label: "KeySet Write 1 for gamma" identity: "gamma" cluster: "Group Key Management" @@ -376,6 +340,42 @@ tests: { FabricIndex: 0, GroupId: 0x0102, GroupKeySetID: 0x01a2 }, ] + - label: "Add Group 1 (endpoint 1) for gamma" + identity: "gamma" + 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: "Add Group 2 (endpoint 0) for gamma" + identity: "gamma" + cluster: "Groups" + command: "AddGroup" + endpoint: 0 + arguments: + values: + - name: "groupId" + value: 0x0102 + - name: "groupName" + value: "Group #2" + response: + values: + - name: "status" + value: 0 + - name: "groupId" + value: 0x0102 + - label: "Install ACLs for gamma" identity: "gamma" cluster: "Access Control" diff --git a/src/app/tests/suites/TestGroupsCluster.yaml b/src/app/tests/suites/TestGroupsCluster.yaml index 98a45437fd0b78..326dcbbdf1cc3c 100644 --- a/src/app/tests/suites/TestGroupsCluster.yaml +++ b/src/app/tests/suites/TestGroupsCluster.yaml @@ -46,20 +46,66 @@ tests: arguments: values: - name: "groupId" - value: 0x0001 + value: 0x0101 response: values: - name: "status" value: 0x8B - name: "groupId" - value: 0x0001 + value: 0x0101 + + - label: "Add First Group (no keys)" + command: "AddGroup" + arguments: + values: + - name: "groupId" + value: 0x0101 + - name: "groupName" + value: "Group #1" + response: + values: + - name: "status" + value: 0x7e + - name: "groupId" + value: 0x0101 + + - label: "Add KeySet" + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a1, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1110000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1110001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1110002, + } + + - label: "Write Group Keys" + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: + [ + { FabricIndex: 1, GroupId: 0x0101, GroupKeySetID: 0x01a1 }, + { FabricIndex: 1, GroupId: 0x0102, GroupKeySetID: 0x01a1 }, + ] - label: "Add First Group (new)" command: "AddGroup" arguments: values: - name: "groupId" - value: 0x0001 + value: 0x0101 - name: "groupName" value: "Group #1" response: @@ -67,20 +113,20 @@ tests: - name: "status" value: 0 - name: "groupId" - value: 0x0001 + value: 0x0101 - label: "View First Group (new)" command: "ViewGroup" arguments: values: - name: "groupId" - value: 0x0001 + value: 0x0101 response: values: - name: "status" value: 0 - name: "groupId" - value: 0x0001 + value: 0x0101 - name: "groupName" value: "Group #1" @@ -89,13 +135,13 @@ tests: arguments: values: - name: "groupId" - value: 0x1111 + value: 0x0102 response: values: - name: "status" value: 0x8B - name: "groupId" - value: 0x1111 + value: 0x0102 - label: "Get Group Membership 1 (all)" command: "GetGroupMembership" @@ -108,16 +154,14 @@ tests: - name: "capacity" value: null - name: "groupList" - value: [0x01] + value: [0x0101] - label: "Add Second Group (new)" - # https://github.com/project-chip/connectedhomeip/issues/11312 - disabled: true command: "AddGroup" arguments: values: - name: "groupId" - value: 0x1111 + value: 0x0102 - name: "groupName" value: "Group #2" response: @@ -125,22 +169,20 @@ tests: - name: "status" value: 0 - name: "groupId" - value: 0x1111 + value: 0x0102 - label: "View Second Group (new)" - # https://github.com/project-chip/connectedhomeip/issues/11312 - disabled: true command: "ViewGroup" arguments: values: - name: "groupId" - value: 0x1111 + value: 0x0102 response: values: - name: "status" value: 0 - name: "groupId" - value: 0x1111 + value: 0x0102 - name: "groupName" value: "Group #2" @@ -179,47 +221,43 @@ tests: arguments: values: - name: "groupId" - value: 0x01 + value: 0x0101 response: values: - name: "status" value: 0 - name: "groupId" - value: 0x01 + value: 0x0101 - name: "groupName" value: "Group #1" - label: "View Second Group (existing)" - # https://github.com/project-chip/connectedhomeip/issues/11312 - disabled: true command: "ViewGroup" arguments: values: - name: "groupId" - value: 0x1111 + value: 0x0102 response: values: - name: "status" value: 0 - name: "groupId" - value: 0x1111 + value: 0x0102 - name: "groupName" value: "Group #2" - label: "Get Group Membership 2" - # https://github.com/project-chip/connectedhomeip/issues/11312 - disabled: true command: "GetGroupMembership" arguments: values: - name: "groupList" - value: [0x02, 0x03, 0x7fff] + value: [0x0102, 0x0103, 0x7fff] response: values: - name: "capacity" value: null - name: "groupList" - value: [0x7fff] + value: [0x0102] - label: "View Group 3 (new)" # https://github.com/project-chip/connectedhomeip/issues/11312 @@ -256,41 +294,39 @@ tests: arguments: values: - name: "groupId" - value: 0x04 + value: 0x0104 response: values: - name: "status" value: 0x8B - name: "groupId" - value: 0x04 + value: 0x0104 - label: "Remove Second Group (existing)" - # https://github.com/project-chip/connectedhomeip/issues/11312 - disabled: true command: "RemoveGroup" arguments: values: - name: "groupId" - value: 0x1111 + value: 0x0102 response: values: - name: "status" value: 0 - name: "groupId" - value: 0x1111 + value: 0x0102 - label: "View First Group (not removed)" command: "ViewGroup" arguments: values: - name: "groupId" - value: 0x0001 + value: 0x0101 response: values: - name: "status" value: 0 - name: "groupId" - value: 0x0001 + value: 0x0101 - name: "groupName" value: "Group #1" @@ -299,13 +335,13 @@ tests: arguments: values: - name: "groupId" - value: 0x1111 + value: 0x0102 response: values: - name: "status" value: 0x8B - name: "groupId" - value: 0x1111 + value: 0x0102 - label: "View Group 3 (not removed)" # https://github.com/project-chip/connectedhomeip/issues/11312 @@ -329,13 +365,13 @@ tests: arguments: values: - name: "groupList" - value: [0x01, 0x02, 0x1111, 0x03] + value: [0x01, 0x0101, 0x0102, 0x03] response: values: - name: "capacity" value: null - name: "groupList" - value: [0x01] + value: [0x0101] - label: "Remove All" command: "RemoveAllGroups" @@ -345,26 +381,26 @@ tests: arguments: values: - name: "groupId" - value: 0x0001 + value: 0x0101 response: values: - name: "status" value: 0x8B - name: "groupId" - value: 0x0001 + value: 0x0101 - label: "View Second Group (still removed)" command: "ViewGroup" arguments: values: - name: "groupId" - value: 0x1111 + value: 0x0102 response: values: - name: "status" value: 0x8B - name: "groupId" - value: 0x1111 + value: 0x0102 - label: "View Group 3 (removed)" command: "ViewGroup" @@ -384,7 +420,7 @@ tests: arguments: values: - name: "groupList" - value: [0x01, 0x02, 0x1111, 0x03, 0x7fff] + value: [0x01, 0x0101, 0x0102, 0x03, 0x7fff] response: values: - name: "capacity" diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 780915ace1b9a2..be46236d9c65ef 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -63322,6 +63322,15 @@ class TestGroupMessagingSuite : public TestCommand shouldContinue = true; break; case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -63330,7 +63339,7 @@ class TestGroupMessagingSuite : public TestCommand VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); } break; - case 2: + case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -63339,15 +63348,6 @@ class TestGroupMessagingSuite : public TestCommand VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); } break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; @@ -63430,6 +63430,15 @@ class TestGroupMessagingSuite : public TestCommand shouldContinue = true; break; case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -63438,7 +63447,7 @@ class TestGroupMessagingSuite : public TestCommand VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); } break; - case 24: + case 27: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -63447,15 +63456,6 @@ class TestGroupMessagingSuite : public TestCommand VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); } break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; case 28: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; @@ -63546,27 +63546,7 @@ class TestGroupMessagingSuite : 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, "Add Group 2 (endpoint 0)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupId = 258U; - value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(0), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "KeySet Write 1"); + LogStep(1, "KeySet Write 1"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -63600,8 +63580,8 @@ class TestGroupMessagingSuite : public TestCommand ); } - case 4: { - LogStep(4, "KeySet Write 2"); + case 2: { + LogStep(2, "KeySet Write 2"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -63635,8 +63615,8 @@ class TestGroupMessagingSuite : public TestCommand ); } - case 5: { - LogStep(5, "Write Group Keys"); + case 3: { + LogStep(3, "Write Group Keys"); ListFreer listFreer; chip::app::DataModel::List value; @@ -63658,6 +63638,26 @@ class TestGroupMessagingSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } + case 4: { + LogStep(4, "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 5: { + LogStep(5, "Add Group 2 (endpoint 0)"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 258U; + value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(0), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional + + ); + } case 6: { LogStep(6, "Install ACLs"); ListFreer listFreer; @@ -63701,7 +63701,7 @@ class TestGroupMessagingSuite : public TestCommand LogStep(9, "Wait for write 1"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; + value.ms = 1000UL; return WaitForMs(kIdentityAlpha, value); } case 10: { @@ -63805,27 +63805,7 @@ class TestGroupMessagingSuite : public TestCommand return WaitForCommissionee(kIdentityGamma, value); } case 23: { - LogStep(23, "Add Group 1 (endpoint 1) for gamma"); - 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(kIdentityGamma, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Add Group 2 (endpoint 0) for gamma"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupId = 258U; - value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); - return SendCommand(kIdentityGamma, GetEndpoint(0), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 25: { - LogStep(25, "KeySet Write 1 for gamma"); + LogStep(23, "KeySet Write 1 for gamma"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -63859,8 +63839,8 @@ class TestGroupMessagingSuite : public TestCommand ); } - case 26: { - LogStep(26, "KeySet Write 2 for gamma"); + case 24: { + LogStep(24, "KeySet Write 2 for gamma"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -63894,8 +63874,8 @@ class TestGroupMessagingSuite : public TestCommand ); } - case 27: { - LogStep(27, "Write Group Keys for gamma"); + case 25: { + LogStep(25, "Write Group Keys for gamma"); ListFreer listFreer; chip::app::DataModel::List value; @@ -63917,6 +63897,26 @@ class TestGroupMessagingSuite : public TestCommand return WriteAttribute(kIdentityGamma, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } + case 26: { + LogStep(26, "Add Group 1 (endpoint 1) for gamma"); + 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(kIdentityGamma, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional + + ); + } + case 27: { + LogStep(27, "Add Group 2 (endpoint 0) for gamma"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 258U; + value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); + return SendCommand(kIdentityGamma, GetEndpoint(0), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional + + ); + } case 28: { LogStep(28, "Install ACLs for gamma"); ListFreer listFreer; @@ -64037,7 +64037,7 @@ class TestGroupMessagingSuite : public TestCommand class TestGroupsClusterSuite : public TestCommand { public: - TestGroupsClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestGroupsCluster", 19, credsIssuerConfig) + TestGroupsClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestGroupsCluster", 27, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -64089,7 +64089,7 @@ class TestGroupsClusterSuite : public TestCommand chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); } break; case 3: @@ -64097,30 +64097,45 @@ class TestGroupsClusterSuite : public TestCommand { 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, 1U)); + VerifyOrReturn(CheckValue("status", value.status, 126U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); } break; case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + 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 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); } break; - case 5: + case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 4369U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); } break; - case 6: + case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; @@ -64129,12 +64144,31 @@ class TestGroupsClusterSuite : public TestCommand { auto iter_0 = value.groupList.begin(); VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); - VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 1U)); + VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 257U)); VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); } } break; - case 7: + case 10: + 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, 258U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); + VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #2", 8))); + } + break; + case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; @@ -64143,17 +64177,41 @@ class TestGroupsClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupId", value.groupId, 32767U)); } break; - case 8: + case 13: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); } break; - case 9: + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); + VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #2", 8))); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("capacity", value.capacity)); + { + auto iter_0 = value.groupList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); + VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 258U)); + VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); + } + } + break; + case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; @@ -64162,35 +64220,44 @@ class TestGroupsClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupId", value.groupId, 0U)); } break; - case 10: + case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 4U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 260U)); } break; - case 11: + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); + } + break; + case 19: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); } break; - case 12: + case 20: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 4369U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); } break; - case 13: + case 21: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; @@ -64199,33 +64266,33 @@ class TestGroupsClusterSuite : public TestCommand { auto iter_0 = value.groupList.begin(); VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); - VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 1U)); + VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 257U)); VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); } } break; - case 14: + case 22: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 15: + case 23: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); } break; - case 16: + case 24: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupId", value.groupId, 4369U)); + VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); } break; - case 17: + case 25: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; @@ -64234,7 +64301,7 @@ class TestGroupsClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupId", value.groupId, 32767U)); } break; - case 18: + case 26: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; @@ -64282,44 +64349,112 @@ class TestGroupsClusterSuite : public TestCommand LogStep(2, "View First Group (not found)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupId = 1U; + value.groupId = 257U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, chip::NullOptional ); } case 3: { - LogStep(3, "Add First Group (new)"); + LogStep(3, "Add First Group (no keys)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupId = 1U; + 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, "View First Group (new)"); + LogStep(4, "Add KeySet"); + ListFreer listFreer; + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; + + value.groupKeySet.groupKeySetID = 417U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 1110000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 1110001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 1110002ULL; + + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional + + ); + } + case 5: { + LogStep(5, "Write Group Keys"); + ListFreer listFreer; + chip::app::DataModel::List value; + + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].groupId = 257U; + listHolder_0->mList[0].groupKeySetID = 417U; + listHolder_0->mList[0].fabricIndex = 1U; + + listHolder_0->mList[1].groupId = 258U; + listHolder_0->mList[1].groupKeySetID = 417U; + listHolder_0->mList[1].fabricIndex = 1U; + + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); + } + case 6: { + LogStep(6, "Add First Group (new)"); + 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 7: { + LogStep(7, "View First Group (new)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupId = 1U; + value.groupId = 257U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, chip::NullOptional ); } - case 5: { - LogStep(5, "View Second Group (not found)"); + case 8: { + LogStep(8, "View Second Group (not found)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupId = 4369U; + value.groupId = 258U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, chip::NullOptional ); } - case 6: { - LogStep(6, "Get Group Membership 1 (all)"); + case 9: { + LogStep(9, "Get Group Membership 1 (all)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; @@ -64329,8 +64464,28 @@ class TestGroupsClusterSuite : public TestCommand ); } - case 7: { - LogStep(7, "View Group 3 (not found)"); + case 10: { + LogStep(10, "Add Second Group (new)"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 258U; + value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional + + ); + } + case 11: { + LogStep(11, "View Second Group (new)"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 258U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, + chip::NullOptional + + ); + } + case 12: { + LogStep(12, "View Group 3 (not found)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; value.groupId = 32767U; @@ -64339,18 +64494,46 @@ class TestGroupsClusterSuite : public TestCommand ); } - case 8: { - LogStep(8, "View First Group (existing)"); + case 13: { + LogStep(13, "View First Group (existing)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupId = 1U; + value.groupId = 257U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, chip::NullOptional ); } - case 9: { - LogStep(9, "Remove Group 0 (invalid)"); + case 14: { + LogStep(14, "View Second Group (existing)"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 258U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, + chip::NullOptional + + ); + } + case 15: { + LogStep(15, "Get Group Membership 2"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; + + { + auto * listHolder_0 = new ListHolder(3); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = 258U; + listHolder_0->mList[1] = 259U; + listHolder_0->mList[2] = 32767U; + value.groupList = chip::app::DataModel::List(listHolder_0->mList, 3); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::GetGroupMembership::Id, value, + chip::NullOptional + + ); + } + case 16: { + LogStep(16, "Remove Group 0 (invalid)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; value.groupId = 0U; @@ -64359,38 +64542,48 @@ class TestGroupsClusterSuite : public TestCommand ); } - case 10: { - LogStep(10, "Remove Group 4 (not found)"); + case 17: { + LogStep(17, "Remove Group 4 (not found)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; - value.groupId = 4U; + value.groupId = 260U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveGroup::Id, value, chip::NullOptional ); } - case 11: { - LogStep(11, "View First Group (not removed)"); + case 18: { + LogStep(18, "Remove Second Group (existing)"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; + value.groupId = 258U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveGroup::Id, value, + chip::NullOptional + + ); + } + case 19: { + LogStep(19, "View First Group (not removed)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupId = 1U; + value.groupId = 257U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, chip::NullOptional ); } - case 12: { - LogStep(12, "View Second Group (removed)"); + case 20: { + LogStep(20, "View Second Group (removed)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupId = 4369U; + value.groupId = 258U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, chip::NullOptional ); } - case 13: { - LogStep(13, "Get Group Membership 3"); + case 21: { + LogStep(21, "Get Group Membership 3"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; @@ -64398,8 +64591,8 @@ class TestGroupsClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(4); listFreer.add(listHolder_0); listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 4369U; + listHolder_0->mList[1] = 257U; + listHolder_0->mList[2] = 258U; listHolder_0->mList[3] = 3U; value.groupList = chip::app::DataModel::List(listHolder_0->mList, 4); } @@ -64408,8 +64601,8 @@ class TestGroupsClusterSuite : public TestCommand ); } - case 14: { - LogStep(14, "Remove All"); + case 22: { + LogStep(22, "Remove All"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type value; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveAllGroups::Id, value, @@ -64417,28 +64610,28 @@ class TestGroupsClusterSuite : public TestCommand ); } - case 15: { - LogStep(15, "View First Group (removed)"); + case 23: { + LogStep(23, "View First Group (removed)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupId = 1U; + value.groupId = 257U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, chip::NullOptional ); } - case 16: { - LogStep(16, "View Second Group (still removed)"); + case 24: { + LogStep(24, "View Second Group (still removed)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupId = 4369U; + value.groupId = 258U; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, chip::NullOptional ); } - case 17: { - LogStep(17, "View Group 3 (removed)"); + case 25: { + LogStep(25, "View Group 3 (removed)"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; value.groupId = 32767U; @@ -64447,8 +64640,8 @@ class TestGroupsClusterSuite : public TestCommand ); } - case 18: { - LogStep(18, "Get Group Membership 4"); + case 26: { + LogStep(26, "Get Group Membership 4"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; @@ -64456,8 +64649,8 @@ class TestGroupsClusterSuite : public TestCommand auto * listHolder_0 = new ListHolder(5); listFreer.add(listHolder_0); listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 4369U; + listHolder_0->mList[1] = 257U; + listHolder_0->mList[2] = 258U; listHolder_0->mList[3] = 3U; listHolder_0->mList[4] = 32767U; value.groupList = chip::app::DataModel::List(listHolder_0->mList, 5); @@ -64531,29 +64724,11 @@ class TestGroupKeyManagementClusterSuite : public TestCommand 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)); - { - 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, 258U)); - } break; case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType value; @@ -64574,13 +64749,13 @@ class TestGroupKeyManagementClusterSuite : public TestCommand CheckValue("groupKeySet.epochStartTime2.Value()", value.groupKeySet.epochStartTime2.Value(), 1110002ULL)); } break; - case 8: + case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 9: + case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 10: + case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -64601,6 +64776,24 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; + case 9: + 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 10: + 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, 258U)); + } + break; case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { @@ -64736,27 +64929,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::Id, true, chip::NullOptional); } case 3: { - LogStep(3, "Add Group 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, "Add Group 2"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupId = 258U; - value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "KeySet Write 1"); + LogStep(3, "KeySet Write 1"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -64790,8 +64963,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 6: { - LogStep(6, "KeySet Write 2"); + case 4: { + LogStep(4, "KeySet Write 2"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -64825,8 +64998,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 7: { - LogStep(7, "KeySet Read"); + case 5: { + LogStep(5, "KeySet Read"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; value.groupKeySetID = 417U; @@ -64835,8 +65008,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 8: { - LogStep(8, "Write Group Keys (invalid)"); + case 6: { + LogStep(6, "Write Group Keys (invalid)"); ListFreer listFreer; chip::app::DataModel::List value; @@ -64854,8 +65027,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } - case 9: { - LogStep(9, "Write Group Keys"); + case 7: { + LogStep(7, "Write Group Keys"); ListFreer listFreer; chip::app::DataModel::List value; @@ -64877,11 +65050,31 @@ class TestGroupKeyManagementClusterSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } - case 10: { - LogStep(10, "Read Group Keys"); + case 8: { + LogStep(8, "Read Group Keys"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, true, chip::NullOptional); } + case 9: { + LogStep(9, "Add Group 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 10: { + LogStep(10, "Add Group 2"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 258U; + value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional + + ); + } case 11: { LogStep(11, "Read GroupTable"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 9ccc4077aa8559..9ae5f3b152c63a 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -110079,68 +110079,100 @@ class TestGroupsCluster : public TestCommandBridge { err = TestViewFirstGroupNotFound_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Add First Group (new)\n"); - err = TestAddFirstGroupNew_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Add First Group (no keys)\n"); + err = TestAddFirstGroupNoKeys_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : View First Group (new)\n"); - err = TestViewFirstGroupNew_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Add KeySet\n"); + err = TestAddKeySet_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : View Second Group (not found)\n"); - err = TestViewSecondGroupNotFound_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Write Group Keys\n"); + err = TestWriteGroupKeys_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Get Group Membership 1 (all)\n"); - err = TestGetGroupMembership1All_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Add First Group (new)\n"); + err = TestAddFirstGroupNew_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : View Group 3 (not found)\n"); - err = TestViewGroup3NotFound_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : View First Group (new)\n"); + err = TestViewFirstGroupNew_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : View First Group (existing)\n"); - err = TestViewFirstGroupExisting_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : View Second Group (not found)\n"); + err = TestViewSecondGroupNotFound_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Remove Group 0 (invalid)\n"); - err = TestRemoveGroup0Invalid_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Get Group Membership 1 (all)\n"); + err = TestGetGroupMembership1All_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Remove Group 4 (not found)\n"); - err = TestRemoveGroup4NotFound_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Add Second Group (new)\n"); + err = TestAddSecondGroupNew_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : View First Group (not removed)\n"); - err = TestViewFirstGroupNotRemoved_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : View Second Group (new)\n"); + err = TestViewSecondGroupNew_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : View Second Group (removed)\n"); - err = TestViewSecondGroupRemoved_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : View Group 3 (not found)\n"); + err = TestViewGroup3NotFound_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Get Group Membership 3\n"); - err = TestGetGroupMembership3_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : View First Group (existing)\n"); + err = TestViewFirstGroupExisting_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Remove All\n"); - err = TestRemoveAll_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : View Second Group (existing)\n"); + err = TestViewSecondGroupExisting_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : View First Group (removed)\n"); - err = TestViewFirstGroupRemoved_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : Get Group Membership 2\n"); + err = TestGetGroupMembership2_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : View Second Group (still removed)\n"); - err = TestViewSecondGroupStillRemoved_16(); + ChipLogProgress(chipTool, " ***** Test Step 16 : Remove Group 0 (invalid)\n"); + err = TestRemoveGroup0Invalid_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : View Group 3 (removed)\n"); - err = TestViewGroup3Removed_17(); + ChipLogProgress(chipTool, " ***** Test Step 17 : Remove Group 4 (not found)\n"); + err = TestRemoveGroup4NotFound_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Get Group Membership 4\n"); - err = TestGetGroupMembership4_18(); + ChipLogProgress(chipTool, " ***** Test Step 18 : Remove Second Group (existing)\n"); + err = TestRemoveSecondGroupExisting_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : View First Group (not removed)\n"); + err = TestViewFirstGroupNotRemoved_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : View Second Group (removed)\n"); + err = TestViewSecondGroupRemoved_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Get Group Membership 3\n"); + err = TestGetGroupMembership3_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Remove All\n"); + err = TestRemoveAll_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : View First Group (removed)\n"); + err = TestViewFirstGroupRemoved_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : View Second Group (still removed)\n"); + err = TestViewSecondGroupStillRemoved_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : View Group 3 (removed)\n"); + err = TestViewGroup3Removed_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Get Group Membership 4\n"); + err = TestGetGroupMembership4_26(); break; } @@ -110210,6 +110242,30 @@ class TestGroupsCluster : public TestCommandBridge { case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -110223,7 +110279,7 @@ class TestGroupsCluster : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; + const uint16_t mTestCount = 27; chip::Optional mNodeId; chip::Optional mCluster; @@ -110274,7 +110330,7 @@ class TestGroupsCluster : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; + params.groupId = [NSNumber numberWithUnsignedShort:257U]; [cluster viewGroupWithParams:params completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"View First Group (not found) Error: %@", err); @@ -110288,7 +110344,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 1U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); } NextTest(); @@ -110297,14 +110353,119 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddFirstGroupNew_3() + CHIP_ERROR TestAddFirstGroupNoKeys_3() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; + params.groupId = [NSNumber numberWithUnsignedShort:257U]; + params.groupName = @"Group #1"; + [cluster addGroupWithParams:params + completionHandler:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Add First Group (no keys) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("status", actualValue, 126U)); + } + + { + id actualValue = values.groupId; + VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestAddKeySet_4() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroupKeyManagement * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupKeyManagementClusterKeySetWriteParams alloc] init]; + params.groupKeySet = [[MTRGroupKeyManagementClusterGroupKeySetStruct alloc] init]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySetID = + [NSNumber numberWithUnsignedShort:417U]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = + [NSNumber numberWithUnsignedChar:0U]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = + [[NSData alloc] initWithBytes:"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = + [NSNumber numberWithUnsignedLongLong:1110000ULL]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = + [[NSData alloc] initWithBytes:"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = + [NSNumber numberWithUnsignedLongLong:1110001ULL]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = + [[NSData alloc] initWithBytes:"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = + [NSNumber numberWithUnsignedLongLong:1110002ULL]; + + [cluster keySetWriteWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Add KeySet Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWriteGroupKeys_5() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroupKeyManagement * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id groupKeyMapArgument; + { + NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; + temp_0[0] = [[MTRGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; + ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupId = [NSNumber numberWithUnsignedShort:257U]; + ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; + ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1U]; + + temp_0[1] = [[MTRGroupKeyManagementClusterGroupKeyMapStruct alloc] init]; + ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).groupId = [NSNumber numberWithUnsignedShort:258U]; + ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).groupKeySetID = [NSNumber numberWithUnsignedShort:417U]; + ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:1U]; + + groupKeyMapArgument = temp_0; + } + [cluster writeAttributeGroupKeyMapWithValue:groupKeyMapArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write Group Keys Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestAddFirstGroupNew_6() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; + params.groupId = [NSNumber numberWithUnsignedShort:257U]; params.groupName = @"Group #1"; [cluster addGroupWithParams:params completionHandler:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { @@ -110319,7 +110480,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 1U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); } NextTest(); @@ -110328,14 +110489,14 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewFirstGroupNew_4() + CHIP_ERROR TestViewFirstGroupNew_7() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; + params.groupId = [NSNumber numberWithUnsignedShort:257U]; [cluster viewGroupWithParams:params completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"View First Group (new) Error: %@", err); @@ -110349,7 +110510,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 1U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); } { @@ -110363,14 +110524,14 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewSecondGroupNotFound_5() + CHIP_ERROR TestViewSecondGroupNotFound_8() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:4369U]; + params.groupId = [NSNumber numberWithUnsignedShort:258U]; [cluster viewGroupWithParams:params completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"View Second Group (not found) Error: %@", err); @@ -110384,7 +110545,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 4369U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); } NextTest(); @@ -110393,7 +110554,7 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestGetGroupMembership1All_6() + CHIP_ERROR TestGetGroupMembership1All_9() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -110419,7 +110580,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupList; VerifyOrReturn(CheckValue("groupList", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("", actualValue[0], 1U)); + VerifyOrReturn(CheckValue("", actualValue[0], 257U)); } NextTest(); @@ -110428,7 +110589,73 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewGroup3NotFound_7() + CHIP_ERROR TestAddSecondGroupNew_10() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; + params.groupId = [NSNumber numberWithUnsignedShort:258U]; + params.groupName = @"Group #2"; + [cluster addGroupWithParams:params + completionHandler:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Add Second Group (new) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("status", actualValue, 0U)); + } + + { + id actualValue = values.groupId; + VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestViewSecondGroupNew_11() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; + params.groupId = [NSNumber numberWithUnsignedShort:258U]; + [cluster viewGroupWithParams:params + completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"View Second Group (new) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("status", actualValue, 0U)); + } + + { + id actualValue = values.groupId; + VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); + } + + { + id actualValue = values.groupName; + VerifyOrReturn(CheckValueAsString("groupName", actualValue, @"Group #2")); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestViewGroup3NotFound_12() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -110458,14 +110685,14 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewFirstGroupExisting_8() + CHIP_ERROR TestViewFirstGroupExisting_13() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; + params.groupId = [NSNumber numberWithUnsignedShort:257U]; [cluster viewGroupWithParams:params completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"View First Group (existing) Error: %@", err); @@ -110479,7 +110706,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 1U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); } { @@ -110493,7 +110720,80 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveGroup0Invalid_9() + CHIP_ERROR TestViewSecondGroupExisting_14() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; + params.groupId = [NSNumber numberWithUnsignedShort:258U]; + [cluster viewGroupWithParams:params + completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"View Second Group (existing) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("status", actualValue, 0U)); + } + + { + id actualValue = values.groupId; + VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); + } + + { + id actualValue = values.groupName; + VerifyOrReturn(CheckValueAsString("groupName", actualValue, @"Group #2")); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGetGroupMembership2_15() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupsClusterGetGroupMembershipParams alloc] init]; + { + NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; + temp_0[0] = [NSNumber numberWithUnsignedShort:258U]; + temp_0[1] = [NSNumber numberWithUnsignedShort:259U]; + temp_0[2] = [NSNumber numberWithUnsignedShort:32767U]; + params.groupList = temp_0; + } + [cluster getGroupMembershipWithParams:params + completionHandler:^( + MTRGroupsClusterGetGroupMembershipResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Get Group Membership 2 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.capacity; + VerifyOrReturn(CheckValueNull("capacity", actualValue)); + } + + { + id actualValue = values.groupList; + VerifyOrReturn(CheckValue("groupList", [actualValue count], static_cast(1))); + VerifyOrReturn(CheckValue("", actualValue[0], 258U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestRemoveGroup0Invalid_16() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -110523,14 +110823,14 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveGroup4NotFound_10() + CHIP_ERROR TestRemoveGroup4NotFound_17() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterRemoveGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:4U]; + params.groupId = [NSNumber numberWithUnsignedShort:260U]; [cluster removeGroupWithParams:params completionHandler:^(MTRGroupsClusterRemoveGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"Remove Group 4 (not found) Error: %@", err); @@ -110544,7 +110844,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 4U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 260U)); } NextTest(); @@ -110553,14 +110853,44 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewFirstGroupNotRemoved_11() + CHIP_ERROR TestRemoveSecondGroupExisting_18() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupsClusterRemoveGroupParams alloc] init]; + params.groupId = [NSNumber numberWithUnsignedShort:258U]; + [cluster removeGroupWithParams:params + completionHandler:^(MTRGroupsClusterRemoveGroupResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Remove Second Group (existing) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("status", actualValue, 0U)); + } + + { + id actualValue = values.groupId; + VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestViewFirstGroupNotRemoved_19() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; + params.groupId = [NSNumber numberWithUnsignedShort:257U]; [cluster viewGroupWithParams:params completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"View First Group (not removed) Error: %@", err); @@ -110574,7 +110904,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 1U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); } { @@ -110588,14 +110918,14 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewSecondGroupRemoved_12() + CHIP_ERROR TestViewSecondGroupRemoved_20() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:4369U]; + params.groupId = [NSNumber numberWithUnsignedShort:258U]; [cluster viewGroupWithParams:params completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"View Second Group (removed) Error: %@", err); @@ -110609,7 +110939,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 4369U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); } NextTest(); @@ -110618,7 +110948,7 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestGetGroupMembership3_13() + CHIP_ERROR TestGetGroupMembership3_21() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -110628,8 +110958,8 @@ class TestGroupsCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [NSNumber numberWithUnsignedShort:1U]; - temp_0[1] = [NSNumber numberWithUnsignedShort:2U]; - temp_0[2] = [NSNumber numberWithUnsignedShort:4369U]; + temp_0[1] = [NSNumber numberWithUnsignedShort:257U]; + temp_0[2] = [NSNumber numberWithUnsignedShort:258U]; temp_0[3] = [NSNumber numberWithUnsignedShort:3U]; params.groupList = temp_0; } @@ -110648,7 +110978,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupList; VerifyOrReturn(CheckValue("groupList", [actualValue count], static_cast(1))); - VerifyOrReturn(CheckValue("", actualValue[0], 1U)); + VerifyOrReturn(CheckValue("", actualValue[0], 257U)); } NextTest(); @@ -110657,7 +110987,7 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveAll_14() + CHIP_ERROR TestRemoveAll_22() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -110674,14 +111004,14 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewFirstGroupRemoved_15() + CHIP_ERROR TestViewFirstGroupRemoved_23() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:1U]; + params.groupId = [NSNumber numberWithUnsignedShort:257U]; [cluster viewGroupWithParams:params completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"View First Group (removed) Error: %@", err); @@ -110695,7 +111025,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 1U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); } NextTest(); @@ -110704,14 +111034,14 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewSecondGroupStillRemoved_16() + CHIP_ERROR TestViewSecondGroupStillRemoved_24() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:4369U]; + params.groupId = [NSNumber numberWithUnsignedShort:258U]; [cluster viewGroupWithParams:params completionHandler:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { NSLog(@"View Second Group (still removed) Error: %@", err); @@ -110725,7 +111055,7 @@ class TestGroupsCluster : public TestCommandBridge { { id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 4369U)); + VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); } NextTest(); @@ -110734,7 +111064,7 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestViewGroup3Removed_17() + CHIP_ERROR TestViewGroup3Removed_25() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -110764,7 +111094,7 @@ class TestGroupsCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestGetGroupMembership4_18() + CHIP_ERROR TestGetGroupMembership4_26() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -110774,8 +111104,8 @@ class TestGroupsCluster : public TestCommandBridge { { NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; temp_0[0] = [NSNumber numberWithUnsignedShort:1U]; - temp_0[1] = [NSNumber numberWithUnsignedShort:2U]; - temp_0[2] = [NSNumber numberWithUnsignedShort:4369U]; + temp_0[1] = [NSNumber numberWithUnsignedShort:257U]; + temp_0[2] = [NSNumber numberWithUnsignedShort:258U]; temp_0[3] = [NSNumber numberWithUnsignedShort:3U]; temp_0[4] = [NSNumber numberWithUnsignedShort:32767U]; params.groupList = temp_0; @@ -110855,36 +111185,36 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { err = TestReadMaxGroupKeysPerFabric_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Add Group 1\n"); - err = TestAddGroup1_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : KeySet Write 1\n"); + err = TestKeySetWrite1_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Add Group 2\n"); - err = TestAddGroup2_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : KeySet Write 2\n"); + err = TestKeySetWrite2_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : KeySet Write 1\n"); - err = TestKeySetWrite1_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : KeySet Read\n"); + err = TestKeySetRead_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : KeySet Write 2\n"); - err = TestKeySetWrite2_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Write Group Keys (invalid)\n"); + err = TestWriteGroupKeysInvalid_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : KeySet Read\n"); - err = TestKeySetRead_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Write Group Keys\n"); + err = TestWriteGroupKeys_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Write Group Keys (invalid)\n"); - err = TestWriteGroupKeysInvalid_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Read Group Keys\n"); + err = TestReadGroupKeys_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write Group Keys\n"); - err = TestWriteGroupKeys_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Add Group 1\n"); + err = TestAddGroup1_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read Group Keys\n"); - err = TestReadGroupKeys_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Add Group 2\n"); + err = TestAddGroup2_10(); break; case 11: ChipLogProgress(chipTool, " ***** Test Step 11 : Read GroupTable\n"); @@ -110956,13 +111286,13 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -111072,69 +111402,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup1_3() - { - MTRBaseDevice * device = GetDevice("alpha"); - MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:257U]; - params.groupName = @"Group #1"; - [cluster addGroupWithParams:params - completionHandler:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Add Group 1 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("status", actualValue, 0U)); - } - - { - id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestAddGroup2_4() - { - MTRBaseDevice * device = GetDevice("alpha"); - MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; - params.groupId = [NSNumber numberWithUnsignedShort:258U]; - params.groupName = @"Group #2"; - [cluster addGroupWithParams:params - completionHandler:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Add Group 2 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("status", actualValue, 0U)); - } - - { - id actualValue = values.groupId; - VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestKeySetWrite1_5() + CHIP_ERROR TestKeySetWrite1_3() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroupKeyManagement * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device @@ -111173,7 +111441,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite2_6() + CHIP_ERROR TestKeySetWrite2_4() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroupKeyManagement * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device @@ -111212,7 +111480,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetRead_7() + CHIP_ERROR TestKeySetRead_5() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroupKeyManagement * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device @@ -111262,7 +111530,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysInvalid_8() + CHIP_ERROR TestWriteGroupKeysInvalid_6() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroupKeyManagement * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device @@ -111291,7 +111559,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeys_9() + CHIP_ERROR TestWriteGroupKeys_7() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroupKeyManagement * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device @@ -111326,7 +111594,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeys_10() + CHIP_ERROR TestReadGroupKeys_8() { MTRBaseDevice * device = GetDevice("alpha"); MTRBaseClusterGroupKeyManagement * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device @@ -111366,6 +111634,68 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } + CHIP_ERROR TestAddGroup1_9() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; + params.groupId = [NSNumber numberWithUnsignedShort:257U]; + params.groupName = @"Group #1"; + [cluster addGroupWithParams:params + completionHandler:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Add Group 1 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("status", actualValue, 0U)); + } + + { + id actualValue = values.groupId; + VerifyOrReturn(CheckValue("groupId", actualValue, 257U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestAddGroup2_10() + { + MTRBaseDevice * device = GetDevice("alpha"); + MTRBaseClusterGroups * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; + params.groupId = [NSNumber numberWithUnsignedShort:258U]; + params.groupName = @"Group #2"; + [cluster addGroupWithParams:params + completionHandler:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Add Group 2 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("status", actualValue, 0U)); + } + + { + id actualValue = values.groupId; + VerifyOrReturn(CheckValue("groupId", actualValue, 258U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + CHIP_ERROR TestReadGroupTable_11() { MTRBaseDevice * device = GetDevice("alpha");