From b8eee57502ffdef9f3725d7af7b40fd6aee2770c Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 16 Feb 2023 16:42:38 +0100 Subject: [PATCH] [TC-SC-5.2] Update the test to really check if the group message has been received (#25051) * [TC-SC-5.2] Update the test to really check if the group message has been received * Update generated tests code --- .../templates/tests/ciTests.json | 1 + .../suites/certification/Test_TC_SC_5_2.yaml | 57 +- .../chip-tool/zap-generated/test/Commands.h | 100 +++- .../zap-generated/test/Commands.h | 490 ------------------ 4 files changed, 116 insertions(+), 532 deletions(-) diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index 1a8b5bb84ecefa..ba80c6aa2d8a60 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -3,6 +3,7 @@ "disable": [ "TestClientMonitoringCluster", "Test_TC_SC_4_2", + "Test_TC_SC_5_2", "TestClusterComplexTypes", "TestEvents", "TestDiscovery", diff --git a/src/app/tests/suites/certification/Test_TC_SC_5_2.yaml b/src/app/tests/suites/certification/Test_TC_SC_5_2.yaml index c145e9ff429a84..f6748e1877530d 100644 --- a/src/app/tests/suites/certification/Test_TC_SC_5_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_SC_5_2.yaml @@ -76,11 +76,11 @@ tests: { GroupKeySetID: 0x01a3, GroupKeySecurityPolicy: 0, - EpochKey0: "0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf", + EpochKey0: "hex:d0d1d2d3d4d5d6d7d8d9dadbdcdddedf", EpochStartTime0: 2220000, - EpochKey1: "0xd1d1d2d3d4d5d6d7d8d9dadbdcdddedf", + EpochKey1: "hex:d1d1d2d3d4d5d6d7d8d9dadbdcdddedf", EpochStartTime1: 2220001, - EpochKey2: "0xd2d1d2d3d4d5d6d7d8d9dadbdcdddedf", + EpochKey2: "hex:d2d1d2d3d4d5d6d7d8d9dadbdcdddedf", EpochStartTime2: 2220002, } @@ -90,7 +90,11 @@ tests: command: "writeAttribute" attribute: "GroupKeyMap" arguments: - value: [{ FabricIndex: 1, GroupId: 0x0103, GroupKeySetID: 0x01a3 }] + value: + [ + { FabricIndex: 1, GroupId: 0x0101, GroupKeySetID: 0x01a3 }, + { FabricIndex: 1, GroupId: 0x0103, GroupKeySetID: 0x01a3 }, + ] - label: "TH sends RemoveAllGroups command" command: "RemoveAllGroups" @@ -102,39 +106,64 @@ tests: - name: GroupID value: 0x0103 - name: GroupName - value: "Test Group" + value: "Test Group 0103" + response: + values: + - name: Status + value: 0 + - name: GroupID + value: 0x0103 + + - label: + "TH sends AddGroup command again but using group messaging (0x0103)" + groupId: 0x0103 + command: "AddGroup" + arguments: + values: + - name: GroupID + value: 0x0101 + - name: GroupName + value: "Test Group 0101" + + # Give the group AddGroup time to actually happen; unicast delivery can outrace + # multicast if the unicast packet is sent immediately after the multicast one. + - label: "Wait for AddGroup" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 - - label: "TH sends ViewGroup command using group messaging" + - label: "TH sends ViewGroup command" PICS: G.S.F00 command: "ViewGroup" - groupId: 0x0103 arguments: values: - name: GroupID - value: 0x0103 + value: 0x0101 response: values: - name: Status value: 0 - name: GroupID - value: 0x0103 + value: 0x0101 - name: GroupName - value: "Test Group" + value: "Test Group 0101" - - label: "TH sends ViewGroup command using group messaging" + - label: "TH sends ViewGroup command" PICS: "!(G.S.F00)" command: "ViewGroup" - groupId: 0x0103 arguments: values: - name: GroupID - value: 0x0103 + value: 0x0101 response: values: - name: Status value: 0 - name: GroupID - value: 0x0103 + value: 0x0101 - name: GroupName value: "" diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 5e651950aaf53c..73cb583b541529 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -41905,7 +41905,7 @@ class Test_TC_SC_5_1Suite : public TestCommand class Test_TC_SC_5_2Suite : public TestCommand { public: - Test_TC_SC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_5_2", 12, credsIssuerConfig) + Test_TC_SC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_5_2", 14, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -41970,35 +41970,48 @@ class Test_TC_SC_5_2Suite : 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, 259U)); } break; case 7: + 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))); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: 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, 259U)); - VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Test Group", 10))); + VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); + VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Test Group 0101", 15))); } break; - case 8: + case 10: 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, 259U)); + VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("", 0))); } break; - case 9: + case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 10: + case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 11: + case 13: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; default: @@ -42085,17 +42098,23 @@ class Test_TC_SC_5_2Suite : public TestCommand static_cast(0); value.groupKeySet.epochKey0.SetNonNull(); value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char("0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedfgarbage: not in length on purpose"), 34); + chip::Uint8::from_const_char( + "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), + 16); value.groupKeySet.epochStartTime0.SetNonNull(); value.groupKeySet.epochStartTime0.Value() = 2220000ULL; value.groupKeySet.epochKey1.SetNonNull(); value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char("0xd1d1d2d3d4d5d6d7d8d9dadbdcdddedfgarbage: not in length on purpose"), 34); + chip::Uint8::from_const_char( + "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), + 16); value.groupKeySet.epochStartTime1.SetNonNull(); value.groupKeySet.epochStartTime1.Value() = 2220001ULL; value.groupKeySet.epochKey2.SetNonNull(); value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char("0xd2d1d2d3d4d5d6d7d8d9dadbdcdddedfgarbage: not in length on purpose"), 34); + chip::Uint8::from_const_char( + "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), + 16); value.groupKeySet.epochStartTime2.SetNonNull(); value.groupKeySet.epochStartTime2.Value() = 2220002ULL; @@ -42110,15 +42129,19 @@ class Test_TC_SC_5_2Suite : public TestCommand chip::app::DataModel::List value; { - auto * listHolder_0 = new ListHolder(1); + auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); - listHolder_0->mList[0].groupId = 259U; + listHolder_0->mList[0].groupId = 257U; listHolder_0->mList[0].groupKeySetID = 419U; listHolder_0->mList[0].fabricIndex = 1U; + listHolder_0->mList[1].groupId = 259U; + listHolder_0->mList[1].groupKeySetID = 419U; + listHolder_0->mList[1].fabricIndex = 1U; + value = chip::app::DataModel::List( - listHolder_0->mList, 1); + listHolder_0->mList, 2); } return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); @@ -42137,29 +42160,50 @@ class Test_TC_SC_5_2Suite : public TestCommand ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroup::Type value; value.groupID = 259U; - value.groupName = chip::Span("Test Groupgarbage: not in length on purpose", 10); + value.groupName = chip::Span("Test Group 0103garbage: not in length on purpose", 15); return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional ); } case 7: { - LogStep(7, "TH sends ViewGroup command using group messaging"); + LogStep(7, "TH sends AddGroup command again but using group messaging (0x0103)"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupID = 257U; + value.groupName = chip::Span("Test Group 0101garbage: not in length on purpose", 15); + return SendGroupCommand(kIdentityAlpha, 259, Groups::Id, Groups::Commands::AddGroup::Id, value); + } + case 8: { + LogStep(8, "Wait for AddGroup"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 9: { + LogStep(9, "TH sends ViewGroup command"); VerifyOrDo(!ShouldSkip("G.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 259U; - return SendGroupCommand(kIdentityAlpha, 259, Groups::Id, Groups::Commands::ViewGroup::Id, value); + value.groupID = 257U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, + chip::NullOptional + + ); } - case 8: { - LogStep(8, "TH sends ViewGroup command using group messaging"); + case 10: { + LogStep(10, "TH sends ViewGroup command"); VerifyOrDo(!ShouldSkip("!(G.S.F00)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 259U; - return SendGroupCommand(kIdentityAlpha, 259, Groups::Id, Groups::Commands::ViewGroup::Id, value); + value.groupID = 257U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, + chip::NullOptional + + ); } - case 9: { - LogStep(9, "TH removes the GroupKeySet"); + case 11: { + LogStep(11, "TH removes the GroupKeySet"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; value.groupKeySetID = 419U; @@ -42168,8 +42212,8 @@ class Test_TC_SC_5_2Suite : public TestCommand ); } - case 10: { - LogStep(10, "TH cleans up groups using RemoveAllGroups command"); + case 12: { + LogStep(12, "TH cleans up groups using RemoveAllGroups command"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type value; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveAllGroups::Id, value, @@ -42177,8 +42221,8 @@ class Test_TC_SC_5_2Suite : public TestCommand ); } - case 11: { - LogStep(11, "TH removes ACL Operate privileges for Group 0x0103"); + case 13: { + LogStep(13, "TH removes ACL Operate privileges for Group 0x0103"); ListFreer listFreer; chip::app::DataModel::List value; 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 afaa82182b7039..e72fc7d6ec5a44 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -155,7 +155,6 @@ class TestList : public Command { printf("Test_TC_RH_1_1\n"); printf("Test_TC_RH_2_1\n"); printf("Test_TC_SC_5_1\n"); - printf("Test_TC_SC_5_2\n"); printf("Test_TC_SWTCH_1_1\n"); printf("Test_TC_TMP_1_1\n"); printf("Test_TC_TMP_2_1\n"); @@ -59226,494 +59225,6 @@ class Test_TC_SC_5_1 : public TestCommandBridge { } }; -class Test_TC_SC_5_2 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_SC_5_2() - : TestCommandBridge("Test_TC_SC_5_2") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_SC_5_2() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SC_5_2\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SC_5_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the commissioner node ID\n"); - err = TestReadTheCommissionerNodeId_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH adds ACL Operate privileges for Group 0x0103\n"); - err = TestThAddsAclOperatePrivilegesForGroup0x0103_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH sends KeySetWrite command with TH key\n"); - err = TestThSendsKeySetWriteCommandWithThKey_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH binds GroupId to GroupKeySet\n"); - err = TestThBindsGroupIdToGroupKeySet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH sends RemoveAllGroups command\n"); - err = TestThSendsRemoveAllGroupsCommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : TH sends AddGroup command\n"); - err = TestThSendsAddGroupCommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH sends ViewGroup command using group messaging\n"); - if (ShouldSkip("G.S.F00")) { - NextTest(); - return; - } - err = TestThSendsViewGroupCommandUsingGroupMessaging_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : TH sends ViewGroup command using group messaging\n"); - if (ShouldSkip("!(G.S.F00)")) { - NextTest(); - return; - } - err = TestThSendsViewGroupCommandUsingGroupMessaging_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : TH removes the GroupKeySet\n"); - err = TestThRemovesTheGroupKeySet_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : TH cleans up groups using RemoveAllGroups command\n"); - err = TestThCleansUpGroupsUsingRemoveAllGroupsCommand_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH removes ACL Operate privileges for Group 0x0103\n"); - err = TestThRemovesAclOperatePrivilegesForGroup0x0103_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - 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)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - NSNumber * _Nonnull commissionerNodeId; - - CHIP_ERROR TestReadTheCommissionerNodeId_1() - { - - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId("alpha", value, ^(const chip::GetCommissionerNodeIdResponse & values) { - { - commissionerNodeId = [[NSNumber alloc] initWithUnsignedLongLong:values.nodeId]; - } - NextTest(); - }); - } - - CHIP_ERROR TestThAddsAclOperatePrivilegesForGroup0x0103_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[MTRAccessControlClusterAccessControlEntryStruct alloc] init]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5U]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2U]; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [commissionerNodeId copy]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).subjects = temp_3; - } - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).targets = nil; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1U]; - - temp_0[1] = [[MTRAccessControlClusterAccessControlEntryStruct alloc] init]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:4U]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:3U]; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedLongLong:259ULL]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).subjects = temp_3; - } - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).targets = nil; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:1U]; - - aclArgument = temp_0; - } - [cluster writeAttributeACLWithValue:aclArgument - completion:^(NSError * _Nullable err) { - NSLog(@"TH adds ACL Operate privileges for Group 0x0103 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThSendsKeySetWriteCommandWithThKey_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(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:419U]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = - [NSNumber numberWithUnsignedChar:0U]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = - [[NSData alloc] initWithBytes:"0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf" length:34]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = - [NSNumber numberWithUnsignedLongLong:2220000ULL]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = - [[NSData alloc] initWithBytes:"0xd1d1d2d3d4d5d6d7d8d9dadbdcdddedf" length:34]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = - [NSNumber numberWithUnsignedLongLong:2220001ULL]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = - [[NSData alloc] initWithBytes:"0xd2d1d2d3d4d5d6d7d8d9dadbdcdddedf" length:34]; - ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = - [NSNumber numberWithUnsignedLongLong:2220002ULL]; - - [cluster keySetWriteWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends KeySetWrite command with TH key Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThBindsGroupIdToGroupKeySet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(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:259U]; - ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).groupKeySetID = [NSNumber numberWithUnsignedShort:419U]; - ((MTRGroupKeyManagementClusterGroupKeyMapStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1U]; - - groupKeyMapArgument = temp_0; - } - [cluster writeAttributeGroupKeyMapWithValue:groupKeyMapArgument - completion:^(NSError * _Nullable err) { - NSLog(@"TH binds GroupId to GroupKeySet Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThSendsRemoveAllGroupsCommand_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster removeAllGroupsWithCompletion:^(NSError * _Nullable err) { - NSLog(@"TH sends RemoveAllGroups command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThSendsAddGroupCommand_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; - params.groupID = [NSNumber numberWithUnsignedShort:259U]; - params.groupName = @"Test Group"; - [cluster addGroupWithParams:params - completion:^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends AddGroup command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThSendsViewGroupCommandUsingGroupMessaging_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupID = [NSNumber numberWithUnsignedShort:259U]; - [cluster viewGroupWithParams:params - completion:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends ViewGroup command using group messaging 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, 259U)); - } - - { - id actualValue = values.groupName; - VerifyOrReturn(CheckValueAsString("GroupName", actualValue, @"Test Group")); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThSendsViewGroupCommandUsingGroupMessaging_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; - params.groupID = [NSNumber numberWithUnsignedShort:259U]; - [cluster viewGroupWithParams:params - completion:^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends ViewGroup command using group messaging 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, 259U)); - } - - { - id actualValue = values.groupName; - VerifyOrReturn(CheckValueAsString("GroupName", actualValue, @"")); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThRemovesTheGroupKeySet_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRGroupKeyManagementClusterKeySetRemoveParams alloc] init]; - params.groupKeySetID = [NSNumber numberWithUnsignedShort:419U]; - [cluster keySetRemoveWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH removes the GroupKeySet Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThCleansUpGroupsUsingRemoveAllGroupsCommand_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster removeAllGroupsWithCompletion:^(NSError * _Nullable err) { - NSLog(@"TH cleans up groups using RemoveAllGroups command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThRemovesAclOperatePrivilegesForGroup0x0103_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id aclArgument; - { - NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; - temp_0[0] = [[MTRAccessControlClusterAccessControlEntryStruct alloc] init]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5U]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2U]; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [commissionerNodeId copy]; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).subjects = temp_3; - } - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).targets = nil; - ((MTRAccessControlClusterAccessControlEntryStruct *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:1U]; - - aclArgument = temp_0; - } - [cluster writeAttributeACLWithValue:aclArgument - completion:^(NSError * _Nullable err) { - NSLog(@"TH removes ACL Operate privileges for Group 0x0103 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - class Test_TC_SWTCH_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -133919,7 +133430,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(),