diff --git a/src/access/tests/TestAccessControl.cpp b/src/access/tests/TestAccessControl.cpp index 9961793aa6879d..4b180b91f8e86f 100644 --- a/src/access/tests/TestAccessControl.cpp +++ b/src/access/tests/TestAccessControl.cpp @@ -146,11 +146,6 @@ constexpr NodeId validPaseSubjects[] = { NodeIdFromPAKEKeyId(0x0001), NodeIdFromPAKEKeyId(0xFFFE), NodeIdFromPAKEKeyId(0xFFFF), // end - - // Debatable whether these are valid or not, - // since they have bits in the unused part - // of the range set. Code currently treats - // them as valid (ignoring the unused bits). }; // clang-format on diff --git a/src/app/tests/suites/TestAccessControlCluster.yaml b/src/app/tests/suites/TestAccessControlCluster.yaml index 6eebe91ebd425e..25ee42d8d521b2 100644 --- a/src/app/tests/suites/TestAccessControlCluster.yaml +++ b/src/app/tests/suites/TestAccessControlCluster.yaml @@ -28,7 +28,7 @@ tests: - name: "nodeId" value: nodeId - - label: "Write three entries" + - label: "Write entries" command: "writeAttribute" attribute: "ACL" arguments: @@ -49,29 +49,29 @@ tests: FabricIndex: 0, Privilege: 1, # view AuthMode: 2, # case - Subjects: [1234, 5678, 0x8080, 0xFFFF], + Subjects: [4, 5, 6, 7], Targets: [ - { Cluster: null, Endpoint: 1, DeviceType: null }, - { Cluster: 2, Endpoint: null, DeviceType: null }, - { Cluster: 3, Endpoint: 4, DeviceType: null }, + { Cluster: null, Endpoint: 8, DeviceType: null }, + { Cluster: 9, Endpoint: null, DeviceType: null }, + { Cluster: 10, Endpoint: 11, DeviceType: null }, ], }, { FabricIndex: 0, Privilege: 3, # operate AuthMode: 3, # group - Subjects: [0x0101, 0x0102, 0xAAAA, 0xBBBB], + Subjects: [12, 13, 14, 15], Targets: [ - { Cluster: null, Endpoint: 2, DeviceType: null }, - { Cluster: 3, Endpoint: null, DeviceType: null }, - { Cluster: 4, Endpoint: 5, DeviceType: null }, + { Cluster: null, Endpoint: 16, DeviceType: null }, + { Cluster: 17, Endpoint: null, DeviceType: null }, + { Cluster: 18, Endpoint: 19, DeviceType: null }, ], }, ] - - label: "Read three entries" + - label: "Verify" command: "readAttribute" attribute: "ACL" response: @@ -92,29 +92,29 @@ tests: FabricIndex: 1, Privilege: 1, # view AuthMode: 2, # case - Subjects: [1234, 5678, 0x8080, 0xFFFF], + Subjects: [4, 5, 6, 7], Targets: [ - { Cluster: null, Endpoint: 1, DeviceType: null }, - { Cluster: 2, Endpoint: null, DeviceType: null }, - { Cluster: 3, Endpoint: 4, DeviceType: null }, + { Cluster: null, Endpoint: 8, DeviceType: null }, + { Cluster: 9, Endpoint: null, DeviceType: null }, + { Cluster: 10, Endpoint: 11, DeviceType: null }, ], }, { FabricIndex: 1, Privilege: 3, # operate AuthMode: 3, # group - Subjects: [0x0101, 0x0102, 0xAAAA, 0xBBBB], + Subjects: [12, 13, 14, 15], Targets: [ - { Cluster: null, Endpoint: 2, DeviceType: null }, - { Cluster: 3, Endpoint: null, DeviceType: null }, - { Cluster: 4, Endpoint: 5, DeviceType: null }, + { Cluster: null, Endpoint: 16, DeviceType: null }, + { Cluster: 17, Endpoint: null, DeviceType: null }, + { Cluster: 18, Endpoint: 19, DeviceType: null }, ], }, ] - - label: "Write two entries" + - label: "Write entries empty lists" command: "writeAttribute" attribute: "ACL" arguments: @@ -124,23 +124,136 @@ tests: Privilege: 5, # administer AuthMode: 2, # case Subjects: null, - Targets: - [ - { Cluster: null, Endpoint: 0, DeviceType: null }, - { Cluster: 1, Endpoint: null, DeviceType: null }, - { Cluster: 2, Endpoint: 3, DeviceType: null }, - ], + Targets: null, + }, + { + FabricIndex: 0, + Privilege: 1, # view + AuthMode: 2, # case + Subjects: [], + Targets: [], + }, + ] + + - label: "Verify" + command: "readAttribute" + attribute: "ACL" + response: + value: [ + { + FabricIndex: 1, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + { + FabricIndex: 1, + Privilege: 1, # view + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + ] + + - label: "Write entry invalid privilege" + command: "writeAttribute" + attribute: "ACL" + arguments: + value: [ + { + FabricIndex: 0, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + { + FabricIndex: 0, + Privilege: 5, # admin + AuthMode: 3, # group + Subjects: null, + Targets: null, + }, + ] + response: + error: 1 + + - label: "Verify" + command: "readAttribute" + attribute: "ACL" + response: + value: [ + { + FabricIndex: 1, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + ] + + - label: "Write entry invalid auth mode" + command: "writeAttribute" + attribute: "ACL" + arguments: + value: [ + { + FabricIndex: 0, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + { + FabricIndex: 0, + Privilege: 1, # view + AuthMode: 1, # pase + Subjects: null, + Targets: null, + }, + ] + response: + error: 1 + + - label: "Verify" + command: "readAttribute" + attribute: "ACL" + response: + value: [ + { + FabricIndex: 1, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + ] + + - label: "Write entry invalid subject" + command: "writeAttribute" + attribute: "ACL" + arguments: + value: [ + { + FabricIndex: 0, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, }, { FabricIndex: 0, Privilege: 1, # view AuthMode: 2, # case - Subjects: [0xCCCC, 0xDDDD], - Targets: [{ Cluster: 5, Endpoint: 6, DeviceType: null }], + Subjects: [0], + Targets: null, }, ] + response: + error: 1 - - label: "Read two entries" + - label: "Verify" command: "readAttribute" attribute: "ACL" response: @@ -150,24 +263,167 @@ tests: Privilege: 5, # administer AuthMode: 2, # case Subjects: null, + Targets: null, + }, + ] + + - label: "Write entry invalid target" + command: "writeAttribute" + attribute: "ACL" + arguments: + value: [ + { + FabricIndex: 0, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + { + FabricIndex: 0, + Privilege: 1, # view + AuthMode: 2, # case + Subjects: null, Targets: + [{ Cluster: null, Endpoint: null, DeviceType: null }], + }, + ] + response: + error: 1 + + - label: "Verify" + command: "readAttribute" + attribute: "ACL" + response: + value: [ + { + FabricIndex: 1, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + ] + + - label: "Write entry too many subjects" + command: "writeAttribute" + attribute: "ACL" + arguments: + value: [ + { + FabricIndex: 0, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + { + FabricIndex: 0, + Privilege: 1, # view + AuthMode: 2, # case + Subjects: [ - { Cluster: null, Endpoint: 0, DeviceType: null }, - { Cluster: 1, Endpoint: null, DeviceType: null }, - { Cluster: 2, Endpoint: 3, DeviceType: null }, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, ], + Targets: null, }, + ] + response: + error: 1 + + - label: "Verify" + command: "readAttribute" + attribute: "ACL" + response: + value: [ { FabricIndex: 1, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + ] + + - label: "Write entry too many targets" + command: "writeAttribute" + attribute: "ACL" + arguments: + value: [ + { + FabricIndex: 0, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, + }, + { + FabricIndex: 0, Privilege: 1, # view AuthMode: 2, # case - Subjects: [0xCCCC, 0xDDDD], - Targets: [{ Cluster: 5, Endpoint: 6, DeviceType: null }], + Subjects: null, + Targets: + [ + { Cluster: null, Endpoint: 1, DeviceType: null }, + { Cluster: null, Endpoint: 2, DeviceType: null }, + { Cluster: null, Endpoint: 3, DeviceType: null }, + { Cluster: null, Endpoint: 4, DeviceType: null }, + { Cluster: null, Endpoint: 5, DeviceType: null }, + { Cluster: null, Endpoint: 6, DeviceType: null }, + { Cluster: null, Endpoint: 7, DeviceType: null }, + { Cluster: null, Endpoint: 8, DeviceType: null }, + { Cluster: null, Endpoint: 9, DeviceType: null }, + { Cluster: null, Endpoint: 10, DeviceType: null }, + { Cluster: null, Endpoint: 11, DeviceType: null }, + { Cluster: null, Endpoint: 12, DeviceType: null }, + { Cluster: null, Endpoint: 13, DeviceType: null }, + { Cluster: null, Endpoint: 14, DeviceType: null }, + { Cluster: null, Endpoint: 15, DeviceType: null }, + { Cluster: null, Endpoint: 16, DeviceType: null }, + { Cluster: null, Endpoint: 17, DeviceType: null }, + { Cluster: null, Endpoint: 18, DeviceType: null }, + { Cluster: null, Endpoint: 19, DeviceType: null }, + { Cluster: null, Endpoint: 20, DeviceType: null }, + ], + }, + ] + response: + error: 1 + + - label: "Verify" + command: "readAttribute" + attribute: "ACL" + response: + value: [ + { + FabricIndex: 1, + Privilege: 5, # administer + AuthMode: 2, # case + Subjects: null, + Targets: null, }, ] - # NOTE: this effectively restores the ACL contents from before this test ran - - label: "Write one entry" + - label: "Restore ACL" command: "writeAttribute" attribute: "ACL" arguments: @@ -181,7 +437,7 @@ tests: }, ] - - label: "Read one entry" + - label: "Verify" command: "readAttribute" attribute: "ACL" response: diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index f62657527f05c7..602b1e8eb305bd 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -233,7 +233,7 @@ - (void)testSendClusterTestAccessControlCluster_000000_WaitForCommissionee } - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Write three entries"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Write entries"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -274,27 +274,27 @@ - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedLongLong:1234ULL]; - temp_3[1] = [NSNumber numberWithUnsignedLongLong:5678ULL]; - temp_3[2] = [NSNumber numberWithUnsignedLongLong:32896ULL]; - temp_3[3] = [NSNumber numberWithUnsignedLongLong:65535ULL]; + temp_3[0] = [NSNumber numberWithUnsignedLongLong:4ULL]; + temp_3[1] = [NSNumber numberWithUnsignedLongLong:5ULL]; + temp_3[2] = [NSNumber numberWithUnsignedLongLong:6ULL]; + temp_3[3] = [NSNumber numberWithUnsignedLongLong:7ULL]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; } { NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:1U]; + ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:8U]; ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; temp_3[1] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = [NSNumber numberWithUnsignedInt:2UL]; + ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = [NSNumber numberWithUnsignedInt:9UL]; ((CHIPAccessControlClusterTarget *) temp_3[1]).endpoint = nil; ((CHIPAccessControlClusterTarget *) temp_3[1]).deviceType = nil; temp_3[2] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = [NSNumber numberWithUnsignedInt:3UL]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:4U]; + ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = [NSNumber numberWithUnsignedInt:10UL]; + ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:11U]; ((CHIPAccessControlClusterTarget *) temp_3[2]).deviceType = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; @@ -306,27 +306,27 @@ - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).authMode = [NSNumber numberWithUnsignedChar:3]; { NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedLongLong:257ULL]; - temp_3[1] = [NSNumber numberWithUnsignedLongLong:258ULL]; - temp_3[2] = [NSNumber numberWithUnsignedLongLong:43690ULL]; - temp_3[3] = [NSNumber numberWithUnsignedLongLong:48059ULL]; + temp_3[0] = [NSNumber numberWithUnsignedLongLong:12ULL]; + temp_3[1] = [NSNumber numberWithUnsignedLongLong:13ULL]; + temp_3[2] = [NSNumber numberWithUnsignedLongLong:14ULL]; + temp_3[3] = [NSNumber numberWithUnsignedLongLong:15ULL]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).subjects = temp_3; } { NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:2U]; + ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:16U]; ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; temp_3[1] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = [NSNumber numberWithUnsignedInt:3UL]; + ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = [NSNumber numberWithUnsignedInt:17UL]; ((CHIPAccessControlClusterTarget *) temp_3[1]).endpoint = nil; ((CHIPAccessControlClusterTarget *) temp_3[1]).deviceType = nil; temp_3[2] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = [NSNumber numberWithUnsignedInt:4UL]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:5U]; + ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = [NSNumber numberWithUnsignedInt:18UL]; + ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:19U]; ((CHIPAccessControlClusterTarget *) temp_3[2]).deviceType = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[2]).targets = temp_3; @@ -336,7 +336,7 @@ - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute } [cluster writeAttributeAclWithValue:aclArgument completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write three entries Error: %@", err); + NSLog(@"Write entries Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -347,7 +347,7 @@ - (void)testSendClusterTestAccessControlCluster_000001_WriteAttribute } - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read three entries"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -359,7 +359,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute [cluster readAttributeAclWithParams:params completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read three entries Error: %@", err); + NSLog(@"Verify Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -446,16 +446,16 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects count], 4); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[0] unsignedLongLongValue], - 1234ULL); + 4ULL); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[1] unsignedLongLongValue], - 5678ULL); + 5ULL); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[2] unsignedLongLongValue], - 32896ULL); + 6ULL); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[3] unsignedLongLongValue], - 65535ULL); + 7ULL); XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets == nil); XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets count], 3); XCTAssertTrue( @@ -471,7 +471,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) .targets[0]).endpoint unsignedShortValue], - 1U); + 8U); XCTAssertTrue( ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) .targets[0]) @@ -485,7 +485,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) .targets[1]).cluster unsignedIntValue], - 2UL); + 9UL); XCTAssertTrue( ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) .targets[1]) @@ -504,7 +504,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) .targets[2]).cluster unsignedIntValue], - 3UL); + 10UL); XCTAssertFalse( ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) .targets[2]) @@ -513,7 +513,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) .targets[2]).endpoint unsignedShortValue], - 4U); + 11U); XCTAssertTrue( ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) .targets[2]) @@ -529,16 +529,16 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects count], 4); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects[0] unsignedLongLongValue], - 257ULL); + 12ULL); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects[1] unsignedLongLongValue], - 258ULL); + 13ULL); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects[2] unsignedLongLongValue], - 43690ULL); + 14ULL); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).subjects[3] unsignedLongLongValue], - 48059ULL); + 15ULL); XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).targets == nil); XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]).targets count], 3); XCTAssertTrue( @@ -554,7 +554,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[0]).endpoint unsignedShortValue], - 2U); + 16U); XCTAssertTrue( ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[0]) @@ -568,7 +568,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[1]).cluster unsignedIntValue], - 3UL); + 17UL); XCTAssertTrue( ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[1]) @@ -587,7 +587,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[2]).cluster unsignedIntValue], - 4UL); + 18UL); XCTAssertFalse( ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[2]) @@ -596,7 +596,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[2]).endpoint unsignedShortValue], - 5U); + 19U); XCTAssertTrue( ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[2]) .targets[2]) @@ -611,7 +611,7 @@ - (void)testSendClusterTestAccessControlCluster_000002_ReadAttribute } - (void)testSendClusterTestAccessControlCluster_000003_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Write two entries"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Write entries empty lists"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -626,25 +626,7 @@ - (void)testSendClusterTestAccessControlCluster_000003_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; - { - NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:0U]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; - - temp_3[1] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = [NSNumber numberWithUnsignedInt:1UL]; - ((CHIPAccessControlClusterTarget *) temp_3[1]).endpoint = nil; - ((CHIPAccessControlClusterTarget *) temp_3[1]).deviceType = nil; - - temp_3[2] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = [NSNumber numberWithUnsignedInt:2UL]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:3U]; - ((CHIPAccessControlClusterTarget *) temp_3[2]).deviceType = nil; - - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = temp_3; - } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; @@ -652,17 +634,10 @@ - (void)testSendClusterTestAccessControlCluster_000003_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; { NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [NSNumber numberWithUnsignedLongLong:52428ULL]; - temp_3[1] = [NSNumber numberWithUnsignedLongLong:56797ULL]; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; } { NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; - temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = [NSNumber numberWithUnsignedInt:5UL]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:6U]; - ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; - ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; } @@ -670,7 +645,7 @@ - (void)testSendClusterTestAccessControlCluster_000003_WriteAttribute } [cluster writeAttributeAclWithValue:aclArgument completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write two entries Error: %@", err); + NSLog(@"Write entries empty lists Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -681,7 +656,7 @@ - (void)testSendClusterTestAccessControlCluster_000003_WriteAttribute } - (void)testSendClusterTestAccessControlCluster_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read two entries"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -693,7 +668,7 @@ - (void)testSendClusterTestAccessControlCluster_000004_ReadAttribute [cluster readAttributeAclWithParams:params completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read two entries Error: %@", err); + NSLog(@"Verify Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -707,108 +682,89 @@ - (void)testSendClusterTestAccessControlCluster_000004_ReadAttribute XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); - XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); - XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets count], 3); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[0]) - .cluster - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[0]) - .endpoint - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[0]).endpoint unsignedShortValue], - 0U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[0]) - .deviceType - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[1]) - .cluster - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[1]).cluster unsignedIntValue], - 1UL); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[1]) - .endpoint - == nil); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[1]) - .deviceType - == nil); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]) - .cluster - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]).cluster unsignedIntValue], - 2UL); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]) - .endpoint - == nil); - XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]).endpoint unsignedShortValue], - 3U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]) - .targets[2]) - .deviceType - == nil); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).privilege unsignedCharValue], 1); XCTAssertEqual( [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).authMode unsignedCharValue], 2); - XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects == nil); - XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects count], 2); - XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[0] unsignedLongLongValue], - 52428ULL); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects == nil); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets == nil); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000005_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry invalid privilege"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + id aclArgument; + { + NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; + temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + + temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:5]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:3]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + + aclArgument = temp_0; + } + [cluster writeAttributeAclWithValue:aclArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write entry invalid privilege Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + CHIPReadParams * params = [[CHIPReadParams alloc] init]; + params.fabricFiltered = [NSNumber numberWithBool:true]; + [cluster + readAttributeAclWithParams:params + completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue count], 1); XCTAssertEqual( - [((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).subjects[1] unsignedLongLongValue], - 56797ULL); - XCTAssertFalse(((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets == nil); - XCTAssertEqual([((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]).targets count], 1); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]) - .cluster - == nil); + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]).cluster unsignedIntValue], - 5UL); - XCTAssertFalse( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]) - .endpoint - == nil); + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); XCTAssertEqual( - [((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]).endpoint unsignedShortValue], - 6U); - XCTAssertTrue( - ((CHIPAccessControlClusterTarget *) ((CHIPAccessControlClusterAccessControlEntry *) actualValue[1]) - .targets[0]) - .deviceType - == nil); + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); } [expectation fulfill]; @@ -816,9 +772,9 @@ - (void)testSendClusterTestAccessControlCluster_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestAccessControlCluster_000005_WriteAttribute +- (void)testSendClusterTestAccessControlCluster_000007_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Write one entry"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry invalid auth mode"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -835,22 +791,530 @@ - (void)testSendClusterTestAccessControlCluster_000005_WriteAttribute ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:1]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + aclArgument = temp_0; } [cluster writeAttributeAclWithValue:aclArgument completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write one entry Error: %@", err); + NSLog(@"Write entry invalid auth mode Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + CHIPReadParams * params = [[CHIPReadParams alloc] init]; + params.fabricFiltered = [NSNumber numberWithBool:true]; + [cluster + readAttributeAclWithParams:params + completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue count], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000009_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry invalid subject"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + id aclArgument; + { + NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; + temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + + temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; + { + NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; + temp_3[0] = [NSNumber numberWithUnsignedLongLong:0ULL]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; + } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + + aclArgument = temp_0; + } + [cluster writeAttributeAclWithValue:aclArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write entry invalid subject Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestAccessControlCluster_000006_ReadAttribute +- (void)testSendClusterTestAccessControlCluster_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + CHIPReadParams * params = [[CHIPReadParams alloc] init]; + params.fabricFiltered = [NSNumber numberWithBool:true]; + [cluster + readAttributeAclWithParams:params + completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue count], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000011_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry invalid target"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + id aclArgument; + { + NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; + temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + + temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; + { + NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; + temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = nil; + ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; + + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; + } + + aclArgument = temp_0; + } + [cluster writeAttributeAclWithValue:aclArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write entry invalid target Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000012_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + CHIPReadParams * params = [[CHIPReadParams alloc] init]; + params.fabricFiltered = [NSNumber numberWithBool:true]; + [cluster + readAttributeAclWithParams:params + completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue count], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000013_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry too many subjects"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + id aclArgument; + { + NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; + temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + + temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; + { + NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; + temp_3[0] = [NSNumber numberWithUnsignedLongLong:1ULL]; + temp_3[1] = [NSNumber numberWithUnsignedLongLong:2ULL]; + temp_3[2] = [NSNumber numberWithUnsignedLongLong:3ULL]; + temp_3[3] = [NSNumber numberWithUnsignedLongLong:4ULL]; + temp_3[4] = [NSNumber numberWithUnsignedLongLong:5ULL]; + temp_3[5] = [NSNumber numberWithUnsignedLongLong:6ULL]; + temp_3[6] = [NSNumber numberWithUnsignedLongLong:7ULL]; + temp_3[7] = [NSNumber numberWithUnsignedLongLong:8ULL]; + temp_3[8] = [NSNumber numberWithUnsignedLongLong:9ULL]; + temp_3[9] = [NSNumber numberWithUnsignedLongLong:10ULL]; + temp_3[10] = [NSNumber numberWithUnsignedLongLong:11ULL]; + temp_3[11] = [NSNumber numberWithUnsignedLongLong:12ULL]; + temp_3[12] = [NSNumber numberWithUnsignedLongLong:13ULL]; + temp_3[13] = [NSNumber numberWithUnsignedLongLong:14ULL]; + temp_3[14] = [NSNumber numberWithUnsignedLongLong:15ULL]; + temp_3[15] = [NSNumber numberWithUnsignedLongLong:16ULL]; + temp_3[16] = [NSNumber numberWithUnsignedLongLong:17ULL]; + temp_3[17] = [NSNumber numberWithUnsignedLongLong:18ULL]; + temp_3[18] = [NSNumber numberWithUnsignedLongLong:19ULL]; + temp_3[19] = [NSNumber numberWithUnsignedLongLong:20ULL]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = temp_3; + } + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = nil; + + aclArgument = temp_0; + } + [cluster writeAttributeAclWithValue:aclArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write entry too many subjects Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000014_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + CHIPReadParams * params = [[CHIPReadParams alloc] init]; + params.fabricFiltered = [NSNumber numberWithBool:true]; + [cluster + readAttributeAclWithParams:params + completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue count], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000015_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write entry too many targets"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + id aclArgument; + { + NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; + temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + + temp_0[1] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).privilege = [NSNumber numberWithUnsignedChar:1]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).authMode = [NSNumber numberWithUnsignedChar:2]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).subjects = nil; + { + NSMutableArray * temp_3 = [[NSMutableArray alloc] init]; + temp_3[0] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[0]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[0]).endpoint = [NSNumber numberWithUnsignedShort:1U]; + ((CHIPAccessControlClusterTarget *) temp_3[0]).deviceType = nil; + + temp_3[1] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[1]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[1]).endpoint = [NSNumber numberWithUnsignedShort:2U]; + ((CHIPAccessControlClusterTarget *) temp_3[1]).deviceType = nil; + + temp_3[2] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[2]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[2]).endpoint = [NSNumber numberWithUnsignedShort:3U]; + ((CHIPAccessControlClusterTarget *) temp_3[2]).deviceType = nil; + + temp_3[3] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[3]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[3]).endpoint = [NSNumber numberWithUnsignedShort:4U]; + ((CHIPAccessControlClusterTarget *) temp_3[3]).deviceType = nil; + + temp_3[4] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[4]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[4]).endpoint = [NSNumber numberWithUnsignedShort:5U]; + ((CHIPAccessControlClusterTarget *) temp_3[4]).deviceType = nil; + + temp_3[5] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[5]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[5]).endpoint = [NSNumber numberWithUnsignedShort:6U]; + ((CHIPAccessControlClusterTarget *) temp_3[5]).deviceType = nil; + + temp_3[6] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[6]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[6]).endpoint = [NSNumber numberWithUnsignedShort:7U]; + ((CHIPAccessControlClusterTarget *) temp_3[6]).deviceType = nil; + + temp_3[7] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[7]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[7]).endpoint = [NSNumber numberWithUnsignedShort:8U]; + ((CHIPAccessControlClusterTarget *) temp_3[7]).deviceType = nil; + + temp_3[8] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[8]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[8]).endpoint = [NSNumber numberWithUnsignedShort:9U]; + ((CHIPAccessControlClusterTarget *) temp_3[8]).deviceType = nil; + + temp_3[9] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[9]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[9]).endpoint = [NSNumber numberWithUnsignedShort:10U]; + ((CHIPAccessControlClusterTarget *) temp_3[9]).deviceType = nil; + + temp_3[10] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[10]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[10]).endpoint = [NSNumber numberWithUnsignedShort:11U]; + ((CHIPAccessControlClusterTarget *) temp_3[10]).deviceType = nil; + + temp_3[11] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[11]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[11]).endpoint = [NSNumber numberWithUnsignedShort:12U]; + ((CHIPAccessControlClusterTarget *) temp_3[11]).deviceType = nil; + + temp_3[12] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[12]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[12]).endpoint = [NSNumber numberWithUnsignedShort:13U]; + ((CHIPAccessControlClusterTarget *) temp_3[12]).deviceType = nil; + + temp_3[13] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[13]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[13]).endpoint = [NSNumber numberWithUnsignedShort:14U]; + ((CHIPAccessControlClusterTarget *) temp_3[13]).deviceType = nil; + + temp_3[14] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[14]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[14]).endpoint = [NSNumber numberWithUnsignedShort:15U]; + ((CHIPAccessControlClusterTarget *) temp_3[14]).deviceType = nil; + + temp_3[15] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[15]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[15]).endpoint = [NSNumber numberWithUnsignedShort:16U]; + ((CHIPAccessControlClusterTarget *) temp_3[15]).deviceType = nil; + + temp_3[16] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[16]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[16]).endpoint = [NSNumber numberWithUnsignedShort:17U]; + ((CHIPAccessControlClusterTarget *) temp_3[16]).deviceType = nil; + + temp_3[17] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[17]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[17]).endpoint = [NSNumber numberWithUnsignedShort:18U]; + ((CHIPAccessControlClusterTarget *) temp_3[17]).deviceType = nil; + + temp_3[18] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[18]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[18]).endpoint = [NSNumber numberWithUnsignedShort:19U]; + ((CHIPAccessControlClusterTarget *) temp_3[18]).deviceType = nil; + + temp_3[19] = [[CHIPAccessControlClusterTarget alloc] init]; + ((CHIPAccessControlClusterTarget *) temp_3[19]).cluster = nil; + ((CHIPAccessControlClusterTarget *) temp_3[19]).endpoint = [NSNumber numberWithUnsignedShort:20U]; + ((CHIPAccessControlClusterTarget *) temp_3[19]).deviceType = nil; + + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[1]).targets = temp_3; + } + + aclArgument = temp_0; + } + [cluster writeAttributeAclWithValue:aclArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write entry too many targets Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000016_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + CHIPReadParams * params = [[CHIPReadParams alloc] init]; + params.fabricFiltered = [NSNumber numberWithBool:true]; + [cluster + readAttributeAclWithParams:params + completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue count], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).fabricIndex unsignedCharValue], 1); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).privilege unsignedCharValue], 5); + XCTAssertEqual( + [((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).authMode unsignedCharValue], 2); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).subjects == nil); + XCTAssertTrue(((CHIPAccessControlClusterAccessControlEntry *) actualValue[0]).targets == nil); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000017_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Restore ACL"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestAccessControl * cluster = [[CHIPTestAccessControl alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + id aclArgument; + { + NSMutableArray * temp_0 = [[NSMutableArray alloc] init]; + temp_0[0] = [[CHIPAccessControlClusterAccessControlEntry alloc] init]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).fabricIndex = [NSNumber numberWithUnsignedChar:0]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).privilege = [NSNumber numberWithUnsignedChar:5]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).authMode = [NSNumber numberWithUnsignedChar:2]; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).subjects = nil; + ((CHIPAccessControlClusterAccessControlEntry *) temp_0[0]).targets = nil; + + aclArgument = temp_0; + } + [cluster writeAttributeAclWithValue:aclArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Restore ACL Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestAccessControlCluster_000018_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read one entry"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -862,7 +1326,7 @@ - (void)testSendClusterTestAccessControlCluster_000006_ReadAttribute [cluster readAttributeAclWithParams:params completionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read one entry Error: %@", err); + NSLog(@"Verify Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index f6dd9c25bf1e83..31fe45fadaf798 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -367,28 +367,76 @@ class TestAccessControlClusterSuite : public TestCommand err = TestWaitForCommissionee_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write three entries\n"); - err = TestWriteThreeEntries_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Write entries\n"); + err = TestWriteEntries_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read three entries\n"); - err = TestReadThreeEntries_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Verify\n"); + err = TestVerify_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write two entries\n"); - err = TestWriteTwoEntries_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Write entries empty lists\n"); + err = TestWriteEntriesEmptyLists_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read two entries\n"); - err = TestReadTwoEntries_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Verify\n"); + err = TestVerify_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write one entry\n"); - err = TestWriteOneEntry_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Write entry invalid privilege\n"); + err = TestWriteEntryInvalidPrivilege_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read one entry\n"); - err = TestReadOneEntry_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Verify\n"); + err = TestVerify_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Write entry invalid auth mode\n"); + err = TestWriteEntryInvalidAuthMode_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Verify\n"); + err = TestVerify_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Write entry invalid subject\n"); + err = TestWriteEntryInvalidSubject_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Verify\n"); + err = TestVerify_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Write entry invalid target\n"); + err = TestWriteEntryInvalidTarget_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Verify\n"); + err = TestVerify_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Write entry too many subjects\n"); + err = TestWriteEntryTooManySubjects_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Verify\n"); + err = TestVerify_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Write entry too many targets\n"); + err = TestWriteEntryTooManyTargets_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Verify\n"); + err = TestVerify_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Restore ACL\n"); + err = TestRestoreAcl_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Verify\n"); + err = TestVerify_18(); break; } @@ -401,7 +449,7 @@ class TestAccessControlClusterSuite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; + const uint16_t mTestCount = 19; chip::Optional mNodeId; chip::Optional mCluster; @@ -484,6 +532,144 @@ class TestAccessControlClusterSuite : public TestCommand (static_cast(context))->OnSuccessResponse_6(acl); } + static void OnFailureCallback_7(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_7(error); + } + + static void OnSuccessCallback_7(void * context) + { + (static_cast(context))->OnSuccessResponse_7(); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void OnSuccessCallback_8( + void * context, + const chip::app::DataModel::DecodableList & + acl) + { + (static_cast(context))->OnSuccessResponse_8(acl); + } + + static void OnFailureCallback_9(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_9(error); + } + + static void OnSuccessCallback_9(void * context) + { + (static_cast(context))->OnSuccessResponse_9(); + } + + static void OnFailureCallback_10(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_10(error); + } + + static void OnSuccessCallback_10( + void * context, + const chip::app::DataModel::DecodableList & + acl) + { + (static_cast(context))->OnSuccessResponse_10(acl); + } + + static void OnFailureCallback_11(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_11(error); + } + + static void OnSuccessCallback_11(void * context) + { + (static_cast(context))->OnSuccessResponse_11(); + } + + static void OnFailureCallback_12(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_12(error); + } + + static void OnSuccessCallback_12( + void * context, + const chip::app::DataModel::DecodableList & + acl) + { + (static_cast(context))->OnSuccessResponse_12(acl); + } + + static void OnFailureCallback_13(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_13(error); + } + + static void OnSuccessCallback_13(void * context) + { + (static_cast(context))->OnSuccessResponse_13(); + } + + static void OnFailureCallback_14(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_14(error); + } + + static void OnSuccessCallback_14( + void * context, + const chip::app::DataModel::DecodableList & + acl) + { + (static_cast(context))->OnSuccessResponse_14(acl); + } + + static void OnFailureCallback_15(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_15(error); + } + + static void OnSuccessCallback_15(void * context) + { + (static_cast(context))->OnSuccessResponse_15(); + } + + static void OnFailureCallback_16(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_16(error); + } + + static void OnSuccessCallback_16( + void * context, + const chip::app::DataModel::DecodableList & + acl) + { + (static_cast(context))->OnSuccessResponse_16(acl); + } + + static void OnFailureCallback_17(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_17(error); + } + + static void OnSuccessCallback_17(void * context) + { + (static_cast(context))->OnSuccessResponse_17(); + } + + static void OnFailureCallback_18(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_18(error); + } + + static void OnSuccessCallback_18( + void * context, + const chip::app::DataModel::DecodableList & + acl) + { + (static_cast(context))->OnSuccessResponse_18(acl); + } + // // Tests methods // @@ -494,7 +680,7 @@ class TestAccessControlClusterSuite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestWriteThreeEntries_1() + CHIP_ERROR TestWriteEntries_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::AccessControlClusterTest cluster; @@ -545,10 +731,10 @@ class TestAccessControlClusterSuite : public TestCommand { auto * listHolder_3 = new ListHolder(4); listFreer.add(listHolder_3); - listHolder_3->mList[0] = 1234ULL; - listHolder_3->mList[1] = 5678ULL; - listHolder_3->mList[2] = 32896ULL; - listHolder_3->mList[3] = 65535ULL; + listHolder_3->mList[0] = 4ULL; + listHolder_3->mList[1] = 5ULL; + listHolder_3->mList[2] = 6ULL; + listHolder_3->mList[3] = 7ULL; listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); } listHolder_0->mList[1].targets.SetNonNull(); @@ -559,18 +745,18 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_3->mList[0].cluster.SetNull(); listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 1U; + listHolder_3->mList[0].endpoint.Value() = 8U; listHolder_3->mList[0].deviceType.SetNull(); listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 2UL; + listHolder_3->mList[1].cluster.Value() = 9UL; listHolder_3->mList[1].endpoint.SetNull(); listHolder_3->mList[1].deviceType.SetNull(); listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 3UL; + listHolder_3->mList[2].cluster.Value() = 10UL; listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 4U; + listHolder_3->mList[2].endpoint.Value() = 11U; listHolder_3->mList[2].deviceType.SetNull(); listHolder_0->mList[1].targets.Value() = @@ -585,10 +771,10 @@ class TestAccessControlClusterSuite : public TestCommand { auto * listHolder_3 = new ListHolder(4); listFreer.add(listHolder_3); - listHolder_3->mList[0] = 257ULL; - listHolder_3->mList[1] = 258ULL; - listHolder_3->mList[2] = 43690ULL; - listHolder_3->mList[3] = 48059ULL; + listHolder_3->mList[0] = 12ULL; + listHolder_3->mList[1] = 13ULL; + listHolder_3->mList[2] = 14ULL; + listHolder_3->mList[3] = 15ULL; listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); } listHolder_0->mList[2].targets.SetNonNull(); @@ -599,18 +785,18 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_3->mList[0].cluster.SetNull(); listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 2U; + listHolder_3->mList[0].endpoint.Value() = 16U; listHolder_3->mList[0].deviceType.SetNull(); listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 3UL; + listHolder_3->mList[1].cluster.Value() = 17UL; listHolder_3->mList[1].endpoint.SetNull(); listHolder_3->mList[1].deviceType.SetNull(); listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 4UL; + listHolder_3->mList[2].cluster.Value() = 18UL; listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 5U; + listHolder_3->mList[2].endpoint.Value() = 19U; listHolder_3->mList[2].deviceType.SetNull(); listHolder_0->mList[2].targets.Value() = @@ -634,7 +820,7 @@ class TestAccessControlClusterSuite : public TestCommand void OnSuccessResponse_1() { NextTest(); } - CHIP_ERROR TestReadThreeEntries_2() + CHIP_ERROR TestVerify_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::AccessControlClusterTest cluster; @@ -696,16 +882,16 @@ class TestAccessControlClusterSuite : public TestCommand auto iter_NaN = iter_0.GetValue().subjects.Value().begin(); VerifyOrReturn( CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_NaN.GetValue(), 1234ULL)); + VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_NaN.GetValue(), 4ULL)); VerifyOrReturn( CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_NaN.GetValue(), 5678ULL)); + VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_NaN.GetValue(), 5ULL)); VerifyOrReturn( CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_NaN.GetValue(), 32896ULL)); + VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_NaN.GetValue(), 6ULL)); VerifyOrReturn( CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_NaN.GetValue(), 65535ULL)); + VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_NaN.GetValue(), 7ULL)); VerifyOrReturn( CheckNoMoreListItems("acl[1].subjects.Value()", iter_NaN, 4)); } @@ -716,20 +902,20 @@ class TestAccessControlClusterSuite : public TestCommand CheckNextListItemDecodes("acl[1].targets.Value()", iter_NaN, 0)); VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 8U)); VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); VerifyOrReturn( CheckNextListItemDecodes("acl[1].targets.Value()", iter_NaN, 1)); VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 2UL)); + VerifyOrReturn(CheckValue("acl[1].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 9UL)); VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); VerifyOrReturn( CheckNextListItemDecodes("acl[1].targets.Value()", iter_NaN, 2)); VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 3UL)); + VerifyOrReturn(CheckValue("acl[1].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 10UL)); VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 4U)); + VerifyOrReturn(CheckValue("acl[1].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 11U)); VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); VerifyOrReturn( CheckNoMoreListItems("acl[1].targets.Value()", iter_NaN, 3)); @@ -743,16 +929,16 @@ class TestAccessControlClusterSuite : public TestCommand auto iter_NaN = iter_0.GetValue().subjects.Value().begin(); VerifyOrReturn( CheckNextListItemDecodes("acl[2].subjects.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_NaN.GetValue(), 257ULL)); + VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_NaN.GetValue(), 12ULL)); VerifyOrReturn( CheckNextListItemDecodes("acl[2].subjects.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_NaN.GetValue(), 258ULL)); + VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_NaN.GetValue(), 13ULL)); VerifyOrReturn( CheckNextListItemDecodes("acl[2].subjects.Value()", iter_NaN, 2)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_NaN.GetValue(), 43690ULL)); + VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_NaN.GetValue(), 14ULL)); VerifyOrReturn( CheckNextListItemDecodes("acl[2].subjects.Value()", iter_NaN, 3)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_NaN.GetValue(), 48059ULL)); + VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_NaN.GetValue(), 15ULL)); VerifyOrReturn( CheckNoMoreListItems("acl[2].subjects.Value()", iter_NaN, 4)); } @@ -763,20 +949,20 @@ class TestAccessControlClusterSuite : public TestCommand CheckNextListItemDecodes("acl[2].targets.Value()", iter_NaN, 0)); VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 2U)); + VerifyOrReturn(CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 16U)); VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); VerifyOrReturn( CheckNextListItemDecodes("acl[2].targets.Value()", iter_NaN, 1)); VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[2].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 3UL)); + VerifyOrReturn(CheckValue("acl[2].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 17UL)); VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); VerifyOrReturn( CheckNextListItemDecodes("acl[2].targets.Value()", iter_NaN, 2)); VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[2].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 4UL)); + VerifyOrReturn(CheckValue("acl[2].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 18UL)); VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[2].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 5U)); + VerifyOrReturn(CheckValue("acl[2].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 19U)); VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); VerifyOrReturn( CheckNoMoreListItems("acl[2].targets.Value()", iter_NaN, 3)); @@ -787,7 +973,7 @@ class TestAccessControlClusterSuite : public TestCommand NextTest(); } - CHIP_ERROR TestWriteTwoEntries_3() + CHIP_ERROR TestWriteEntriesEmptyLists_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::AccessControlClusterTest cluster; @@ -804,59 +990,18 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[0].privilege = static_cast(5); listHolder_0->mList[0].authMode = static_cast(2); listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 1UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 2UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 3U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List(listHolder_3->mList, 3); - } + listHolder_0->mList[0].targets.SetNull(); listHolder_0->mList[1].fabricIndex = 0; listHolder_0->mList[1].privilege = static_cast(1); listHolder_0->mList[1].authMode = static_cast(2); listHolder_0->mList[1].subjects.SetNonNull(); - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 52428ULL; - listHolder_3->mList[1] = 56797ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 2); - } + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(); listHolder_0->mList[1].targets.SetNonNull(); - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 5UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 6U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List(listHolder_3->mList, 1); - } + listHolder_0->mList[1].targets.Value() = + chip::app::DataModel::List(); aclArgument = chip::app::DataModel::List( listHolder_0->mList, 2); @@ -875,7 +1020,7 @@ class TestAccessControlClusterSuite : public TestCommand void OnSuccessResponse_3() { NextTest(); } - CHIP_ERROR TestReadTwoEntries_4() + CHIP_ERROR TestVerify_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::AccessControlClusterTest cluster; @@ -903,67 +1048,20 @@ class TestAccessControlClusterSuite : public TestCommand VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets", iter_0.GetValue().targets)); - { - auto iter_NaN = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn( - CheckNextListItemDecodes("acl[0].targets.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[0].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 0U)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[0].targets.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[0].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 1UL)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[0].targets.Value()", iter_NaN, 2)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[0].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 2UL)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[0].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 3U)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[0].targets.Value()", iter_NaN, 3)); - } + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1)); VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_NaN = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_NaN.GetValue(), 52428ULL)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_NaN.GetValue(), 56797ULL)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].subjects.Value()", iter_NaN, 2)); - } - VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); - { - auto iter_NaN = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].targets.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[0].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 5UL)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 6U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].targets.Value()", iter_NaN, 1)); - } + VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); } NextTest(); } - CHIP_ERROR TestWriteOneEntry_5() + CHIP_ERROR TestWriteEntryInvalidPrivilege_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::AccessControlClusterTest cluster; @@ -973,7 +1071,7 @@ class TestAccessControlClusterSuite : public TestCommand chip::app::DataModel::List aclArgument; { - auto * listHolder_0 = new ListHolder(1); + auto * listHolder_0 = new ListHolder(2); listFreer.add(listHolder_0); listHolder_0->mList[0].fabricIndex = 0; @@ -982,8 +1080,14 @@ class TestAccessControlClusterSuite : public TestCommand listHolder_0->mList[0].subjects.SetNull(); listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; + listHolder_0->mList[1].privilege = static_cast(5); + listHolder_0->mList[1].authMode = static_cast(3); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNull(); + aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 1); + listHolder_0->mList, 2); } ReturnErrorOnFailure(cluster.WriteAttribute( @@ -994,12 +1098,13 @@ class TestAccessControlClusterSuite : public TestCommand void OnFailureResponse_5(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); + NextTest(); } - void OnSuccessResponse_5() { NextTest(); } + void OnSuccessResponse_5() { ThrowSuccessResponse(); } - CHIP_ERROR TestReadOneEntry_6() + CHIP_ERROR TestVerify_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::AccessControlClusterTest cluster; @@ -1033,6 +1138,620 @@ class TestAccessControlClusterSuite : public TestCommand NextTest(); } + + CHIP_ERROR TestWriteEntryInvalidAuthMode_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + chip::app::DataModel::List aclArgument; + + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].fabricIndex = 0; + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + + listHolder_0->mList[1].fabricIndex = 0; + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(1); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNull(); + + aclArgument = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + + ReturnErrorOnFailure(cluster.WriteAttribute( + aclArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); + NextTest(); + } + + void OnSuccessResponse_7() { ThrowSuccessResponse(); } + + CHIP_ERROR TestVerify_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_8( + const chip::app::DataModel::DecodableList & + acl) + { + { + auto iter_0 = acl.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + + NextTest(); + } + + CHIP_ERROR TestWriteEntryInvalidSubject_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + chip::app::DataModel::List aclArgument; + + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].fabricIndex = 0; + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + + listHolder_0->mList[1].fabricIndex = 0; + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNonNull(); + + { + auto * listHolder_3 = new ListHolder(1); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = 0ULL; + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); + } + listHolder_0->mList[1].targets.SetNull(); + + aclArgument = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + + ReturnErrorOnFailure(cluster.WriteAttribute( + aclArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); + NextTest(); + } + + void OnSuccessResponse_9() { ThrowSuccessResponse(); } + + CHIP_ERROR TestVerify_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_10( + const chip::app::DataModel::DecodableList & + acl) + { + { + auto iter_0 = acl.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + + NextTest(); + } + + CHIP_ERROR TestWriteEntryInvalidTarget_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + chip::app::DataModel::List aclArgument; + + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].fabricIndex = 0; + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + + listHolder_0->mList[1].fabricIndex = 0; + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNonNull(); + + { + auto * listHolder_3 = new ListHolder(1); + listFreer.add(listHolder_3); + + listHolder_3->mList[0].cluster.SetNull(); + listHolder_3->mList[0].endpoint.SetNull(); + listHolder_3->mList[0].deviceType.SetNull(); + + listHolder_0->mList[1].targets.Value() = + chip::app::DataModel::List(listHolder_3->mList, 1); + } + + aclArgument = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + + ReturnErrorOnFailure(cluster.WriteAttribute( + aclArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); + NextTest(); + } + + void OnSuccessResponse_11() { ThrowSuccessResponse(); } + + CHIP_ERROR TestVerify_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_12( + const chip::app::DataModel::DecodableList & + acl) + { + { + auto iter_0 = acl.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + + NextTest(); + } + + CHIP_ERROR TestWriteEntryTooManySubjects_13() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + chip::app::DataModel::List aclArgument; + + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].fabricIndex = 0; + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + + listHolder_0->mList[1].fabricIndex = 0; + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNonNull(); + + { + auto * listHolder_3 = new ListHolder(20); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = 1ULL; + listHolder_3->mList[1] = 2ULL; + listHolder_3->mList[2] = 3ULL; + listHolder_3->mList[3] = 4ULL; + listHolder_3->mList[4] = 5ULL; + listHolder_3->mList[5] = 6ULL; + listHolder_3->mList[6] = 7ULL; + listHolder_3->mList[7] = 8ULL; + listHolder_3->mList[8] = 9ULL; + listHolder_3->mList[9] = 10ULL; + listHolder_3->mList[10] = 11ULL; + listHolder_3->mList[11] = 12ULL; + listHolder_3->mList[12] = 13ULL; + listHolder_3->mList[13] = 14ULL; + listHolder_3->mList[14] = 15ULL; + listHolder_3->mList[15] = 16ULL; + listHolder_3->mList[16] = 17ULL; + listHolder_3->mList[17] = 18ULL; + listHolder_3->mList[18] = 19ULL; + listHolder_3->mList[19] = 20ULL; + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 20); + } + listHolder_0->mList[1].targets.SetNull(); + + aclArgument = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + + ReturnErrorOnFailure(cluster.WriteAttribute( + aclArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); + NextTest(); + } + + void OnSuccessResponse_13() { ThrowSuccessResponse(); } + + CHIP_ERROR TestVerify_14() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_14, OnFailureCallback_14, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_14(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_14( + const chip::app::DataModel::DecodableList & + acl) + { + { + auto iter_0 = acl.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + + NextTest(); + } + + CHIP_ERROR TestWriteEntryTooManyTargets_15() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + chip::app::DataModel::List aclArgument; + + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].fabricIndex = 0; + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + + listHolder_0->mList[1].fabricIndex = 0; + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNonNull(); + + { + auto * listHolder_3 = new ListHolder(20); + listFreer.add(listHolder_3); + + listHolder_3->mList[0].cluster.SetNull(); + listHolder_3->mList[0].endpoint.SetNonNull(); + listHolder_3->mList[0].endpoint.Value() = 1U; + listHolder_3->mList[0].deviceType.SetNull(); + + listHolder_3->mList[1].cluster.SetNull(); + listHolder_3->mList[1].endpoint.SetNonNull(); + listHolder_3->mList[1].endpoint.Value() = 2U; + listHolder_3->mList[1].deviceType.SetNull(); + + listHolder_3->mList[2].cluster.SetNull(); + listHolder_3->mList[2].endpoint.SetNonNull(); + listHolder_3->mList[2].endpoint.Value() = 3U; + listHolder_3->mList[2].deviceType.SetNull(); + + listHolder_3->mList[3].cluster.SetNull(); + listHolder_3->mList[3].endpoint.SetNonNull(); + listHolder_3->mList[3].endpoint.Value() = 4U; + listHolder_3->mList[3].deviceType.SetNull(); + + listHolder_3->mList[4].cluster.SetNull(); + listHolder_3->mList[4].endpoint.SetNonNull(); + listHolder_3->mList[4].endpoint.Value() = 5U; + listHolder_3->mList[4].deviceType.SetNull(); + + listHolder_3->mList[5].cluster.SetNull(); + listHolder_3->mList[5].endpoint.SetNonNull(); + listHolder_3->mList[5].endpoint.Value() = 6U; + listHolder_3->mList[5].deviceType.SetNull(); + + listHolder_3->mList[6].cluster.SetNull(); + listHolder_3->mList[6].endpoint.SetNonNull(); + listHolder_3->mList[6].endpoint.Value() = 7U; + listHolder_3->mList[6].deviceType.SetNull(); + + listHolder_3->mList[7].cluster.SetNull(); + listHolder_3->mList[7].endpoint.SetNonNull(); + listHolder_3->mList[7].endpoint.Value() = 8U; + listHolder_3->mList[7].deviceType.SetNull(); + + listHolder_3->mList[8].cluster.SetNull(); + listHolder_3->mList[8].endpoint.SetNonNull(); + listHolder_3->mList[8].endpoint.Value() = 9U; + listHolder_3->mList[8].deviceType.SetNull(); + + listHolder_3->mList[9].cluster.SetNull(); + listHolder_3->mList[9].endpoint.SetNonNull(); + listHolder_3->mList[9].endpoint.Value() = 10U; + listHolder_3->mList[9].deviceType.SetNull(); + + listHolder_3->mList[10].cluster.SetNull(); + listHolder_3->mList[10].endpoint.SetNonNull(); + listHolder_3->mList[10].endpoint.Value() = 11U; + listHolder_3->mList[10].deviceType.SetNull(); + + listHolder_3->mList[11].cluster.SetNull(); + listHolder_3->mList[11].endpoint.SetNonNull(); + listHolder_3->mList[11].endpoint.Value() = 12U; + listHolder_3->mList[11].deviceType.SetNull(); + + listHolder_3->mList[12].cluster.SetNull(); + listHolder_3->mList[12].endpoint.SetNonNull(); + listHolder_3->mList[12].endpoint.Value() = 13U; + listHolder_3->mList[12].deviceType.SetNull(); + + listHolder_3->mList[13].cluster.SetNull(); + listHolder_3->mList[13].endpoint.SetNonNull(); + listHolder_3->mList[13].endpoint.Value() = 14U; + listHolder_3->mList[13].deviceType.SetNull(); + + listHolder_3->mList[14].cluster.SetNull(); + listHolder_3->mList[14].endpoint.SetNonNull(); + listHolder_3->mList[14].endpoint.Value() = 15U; + listHolder_3->mList[14].deviceType.SetNull(); + + listHolder_3->mList[15].cluster.SetNull(); + listHolder_3->mList[15].endpoint.SetNonNull(); + listHolder_3->mList[15].endpoint.Value() = 16U; + listHolder_3->mList[15].deviceType.SetNull(); + + listHolder_3->mList[16].cluster.SetNull(); + listHolder_3->mList[16].endpoint.SetNonNull(); + listHolder_3->mList[16].endpoint.Value() = 17U; + listHolder_3->mList[16].deviceType.SetNull(); + + listHolder_3->mList[17].cluster.SetNull(); + listHolder_3->mList[17].endpoint.SetNonNull(); + listHolder_3->mList[17].endpoint.Value() = 18U; + listHolder_3->mList[17].deviceType.SetNull(); + + listHolder_3->mList[18].cluster.SetNull(); + listHolder_3->mList[18].endpoint.SetNonNull(); + listHolder_3->mList[18].endpoint.Value() = 19U; + listHolder_3->mList[18].deviceType.SetNull(); + + listHolder_3->mList[19].cluster.SetNull(); + listHolder_3->mList[19].endpoint.SetNonNull(); + listHolder_3->mList[19].endpoint.Value() = 20U; + listHolder_3->mList[19].deviceType.SetNull(); + + listHolder_0->mList[1].targets.Value() = + chip::app::DataModel::List(listHolder_3->mList, 20); + } + + aclArgument = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + + ReturnErrorOnFailure(cluster.WriteAttribute( + aclArgument, this, OnSuccessCallback_15, OnFailureCallback_15)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_15(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); + NextTest(); + } + + void OnSuccessResponse_15() { ThrowSuccessResponse(); } + + CHIP_ERROR TestVerify_16() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_16, OnFailureCallback_16, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_16(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_16( + const chip::app::DataModel::DecodableList & + acl) + { + { + auto iter_0 = acl.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + + NextTest(); + } + + CHIP_ERROR TestRestoreAcl_17() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + chip::app::DataModel::List aclArgument; + + { + auto * listHolder_0 = new ListHolder(1); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].fabricIndex = 0; + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + + aclArgument = chip::app::DataModel::List( + listHolder_0->mList, 1); + } + + ReturnErrorOnFailure(cluster.WriteAttribute( + aclArgument, this, OnSuccessCallback_17, OnFailureCallback_17)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_17(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_17() { NextTest(); } + + CHIP_ERROR TestVerify_18() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::AccessControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_18, OnFailureCallback_18, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_18(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_18( + const chip::app::DataModel::DecodableList & + acl) + { + { + auto iter_0 = acl.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + + NextTest(); + } }; class Test_TC_BI_1_1Suite : public TestCommand