From 3983419975adeb226ccffd16bc4ca36e720dafab Mon Sep 17 00:00:00 2001 From: jrhees-cae <61466710+jrhees-cae@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:37:15 -0400 Subject: [PATCH] TC-DRLK-2.2/2.3/2.12: Modify flow to allow for RequirePINforRemoteOperation to be TRUE or FALSE (#28523) * TC-DRLK-2.2/2.3/2.12: Modify flow to allow for RequirePINforRemoteOperation to be TRUE or FALSE - Modify flow to allow for RequirePINforRemoteOperation to be TRUE or FALSE - Reorder steps 7-9 to ensure subsequent test of WrongCodeEntryLimit doesn't already have existing failed entry attempts - Fix incorrect PICS (use .Write PICS) for writing WrongCodeEntryLimit and UserCodeTemporaryDisableTime Fixes #3263 Fixes #3265 Fixes #3266 * Restyled by autopep8 * Exclude .yaml tests from CI due to use of EqualityTests pseudo-cluster * Add zap-regen'd files * Exclude .yaml tests from CI linux due to use of EqualityTests pseudo-cluster --------- Co-authored-by: Restyled.io --- scripts/tests/chiptest/__init__.py | 3 + .../certification/Test_TC_DRLK_2_12.yaml | 117 +- .../certification/Test_TC_DRLK_2_2.yaml | 151 +- .../certification/Test_TC_DRLK_2_3.yaml | 176 +- src/app/tests/suites/ciTests.json | 5 +- .../chip-tool/zap-generated/test/Commands.h | 1846 ---- .../zap-generated/test/Commands.h | 8377 +++++------------ 7 files changed, 2541 insertions(+), 8134 deletions(-) diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index e3d2f25d2db368..29942b0a2e2ac4 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -170,6 +170,9 @@ def _GetChipReplUnsupportedTests() -> Set[str]: "Test_TC_DRLK_2_8.yaml", # Test fails only in chip-repl: Refer--> https://github.com/project-chip/connectedhomeip/pull/27011#issuecomment-1593339855 "Test_TC_ACE_1_6.yaml", # Test fails only in chip-repl: Refer--> https://github.com/project-chip/connectedhomeip/pull/27910#issuecomment-1632485584 "Test_TC_IDM_1_2.yaml", # chip-repl does not support AnyCommands (19/07/2023) + "Test_TC_DRLK_2_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster (08/04/2023) + "Test_TC_DRLK_2_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster (08/04/2023) + "Test_TC_DRLK_2_12.yaml", # chip-repl does not support EqualityCommands pseudo-cluster (08/04/2023) "TestGroupKeyManagementCluster.yaml", # chip-repl does not support EqualityCommands (2023-08-04) "Test_TC_S_2_2.yaml", # chip-repl does not support scenes cluster commands "Test_TC_S_2_3.yaml", # chip-repl does not support scenes cluster commands diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml index 2964d1c83b3bec..bbb2828c0784ef 100644 --- a/src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml @@ -21,6 +21,9 @@ config: nodeId: 0x12344321 cluster: "Door Lock" endpoint: 1 + requirePINIsTrue: + type: BOOLEAN + defaultValue: false tests: - label: "Wait for the commissioned device to be retrieved" @@ -152,13 +155,61 @@ tests: command: "readAttribute" attribute: "RequirePINforRemoteOperation" response: - value: false + saveAs: requirePINIsTrue + constraints: + type: boolean + minValue: 0 + maxValue: 1 + + - label: + "Step 2a: TH verifies the RequirePINforRemoteOperation attribute value + is now False on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + value: true + + - label: "Step 2b: Compute RequirePINforRemoteOperation" + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + saveAs: requirePINIsFalse + constraints: + type: boolean + minValue: 0 + maxValue: 1 - label: "Step 3: TH sends Ubolt Door Command to the DUT without PINCode" + runIf: requirePINIsFalse PICS: DRLK.S.C27.Rsp command: "UnboltDoor" timedInteractionTimeoutMs: 1000 + - label: "Step 3: TH sends Ubolt Door Command to the DUT without PINCode" + runIf: requirePINIsTrue + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + response: + error: FAILURE + - label: "Step 4: TH sends Ubolt Door Command to the DUT with PINCode" PICS: DRLK.S.C27.Rsp command: "UnboltDoor" @@ -195,19 +246,49 @@ tests: command: "readAttribute" attribute: "RequirePINforRemoteOperation" response: - value: true + saveAs: requirePINIsTrue + constraints: + type: boolean + minValue: 0 + maxValue: 1 - - label: "Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode" - PICS: DRLK.S.C27.Rsp - command: "UnboltDoor" - timedInteractionTimeoutMs: 1000 + - label: + "Step 6a: TH verifies the RequirePINforRemoteOperation attribute value + is now True on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + cluster: "EqualityCommands" + command: "BooleanEquals" arguments: values: - - name: "PINCode" - value: "123456" + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: true + response: + - values: + - name: "Equals" + value: true + + - label: "Step 6b: Compute RequirePINforRemoteOperation" + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + saveAs: requirePINIsFalse + constraints: + type: boolean + minValue: 0 + maxValue: 1 - label: - "Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode" + "Step 7: TH sends Unbolt Door Command to the DUT with Invalid PINCode" PICS: DRLK.S.C27.Rsp command: "UnboltDoor" timedInteractionTimeoutMs: 1000 @@ -218,13 +299,29 @@ tests: response: error: FAILURE - - label: "Step 9: TH sends Unbolt Door Command to the DUT without PINCode" + - label: "Step 8: TH sends Unbolt Door Command to the DUT without PINCode" + runIf: requirePINIsTrue PICS: DRLK.S.C27.Rsp command: "UnboltDoor" timedInteractionTimeoutMs: 1000 response: error: FAILURE + - label: "Step 8: TH sends Unbolt Door Command to the DUT without PINCode" + runIf: requirePINIsFalse + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + + - label: "Step 9: TH sends Ubolt Door Command to the DUT with valid PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + - label: "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT" diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_2.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_2.yaml index 4481532c0ca1af..c4e8dcb483e4e1 100644 --- a/src/app/tests/suites/certification/Test_TC_DRLK_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_2.yaml @@ -21,6 +21,9 @@ config: nodeId: 0x12344321 cluster: "Door Lock" endpoint: 1 + requirePINIsTrue: + type: BOOLEAN + defaultValue: false tests: - label: "Wait for the commissioned device to be retrieved" @@ -126,18 +129,18 @@ tests: value: null - label: - "Step 1a: TH writes the RequirePINforRemoteOperation attribute value - as False on the DUT" - PICS: DRLK.S.A0033 + "Step 1: TH writes the RequirePINforRemoteOperation attribute value as + False on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write command: "writeAttribute" attribute: "RequirePINforRemoteOperation" arguments: value: false - label: - "Step 1b: TH writes the RequirePINforRemoteOperation attribute value - as False on the DUT and Verify DUT responds with UNSUPPORTED_WRITE" - PICS: "!DRLK.S.A0033" + "Step 1: TH writes the RequirePINforRemoteOperation attribute value as + False on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write command: "writeAttribute" attribute: "RequirePINforRemoteOperation" arguments: @@ -152,12 +155,60 @@ tests: command: "readAttribute" attribute: "RequirePINforRemoteOperation" response: - value: false + saveAs: requirePINIsTrue + constraints: + type: boolean + minValue: 0 + maxValue: 1 + + - label: + "Step 2a: TH verifies the RequirePINforRemoteOperation attribute value + is now False on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + value: true + + - label: "Step 2b: Compute RequirePINforRemoteOperation" + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + saveAs: requirePINIsFalse + constraints: + type: boolean + minValue: 0 + maxValue: 1 + + - label: "Step 3: TH sends Lock Door Command to the DUT without PINCode" + runIf: requirePINIsFalse + PICS: DRLK.S.C00.Rsp + command: "LockDoor" + timedInteractionTimeoutMs: 1000 - label: "Step 3: TH sends Lock Door Command to the DUT without PINCode" + runIf: requirePINIsTrue PICS: DRLK.S.C00.Rsp command: "LockDoor" timedInteractionTimeoutMs: 1000 + response: + error: FAILURE - label: "Step 4: TH sends Lock Door Command to the DUT with valid PINCode" PICS: DRLK.S.C00.Rsp @@ -169,18 +220,18 @@ tests: value: "123456" - label: - "Step 5a: TH writes the RequirePINforRemoteOperation attribute value - as False on the DUT" - PICS: DRLK.S.A0033 + "Step 5: TH writes the RequirePINforRemoteOperation attribute value as + true on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write command: "writeAttribute" attribute: "RequirePINforRemoteOperation" arguments: value: true - label: - "Step 5b: TH writes the RequirePINforRemoteOperation attribute value - as False on the DUT and Verify DUT responds with UNSUPPORTED_WRITE" - PICS: "!DRLK.S.A0033" + "Step 5: TH writes the RequirePINforRemoteOperation attribute value as + true on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write command: "writeAttribute" attribute: "RequirePINforRemoteOperation" arguments: @@ -195,19 +246,49 @@ tests: command: "readAttribute" attribute: "RequirePINforRemoteOperation" response: - value: true + saveAs: requirePINIsTrue + constraints: + type: boolean + minValue: 0 + maxValue: 1 - - label: "Step 7: TH sends Lock Door Command to the DUT with valid PINCode" - PICS: DRLK.S.C00.Rsp && DRLK.S.A0033 - command: "LockDoor" - timedInteractionTimeoutMs: 1000 + - label: + "Step 6a: TH verifies the RequirePINforRemoteOperation attribute value + is now True on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + cluster: "EqualityCommands" + command: "BooleanEquals" arguments: values: - - name: "PINCode" - value: "123456" + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: true + response: + - values: + - name: "Equals" + value: true + + - label: "Step 6b: Compute RequirePINforRemoteOperation" + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + saveAs: requirePINIsFalse + constraints: + type: boolean + minValue: 0 + maxValue: 1 - label: - "Step 8: TH sends Lock Door Command to the DUT without valid PINCode" + "Step 7: TH sends Lock Door Command to the DUT without valid PINCode" PICS: DRLK.S.C00.Rsp && DRLK.S.A0033 command: "LockDoor" timedInteractionTimeoutMs: 1000 @@ -218,15 +299,29 @@ tests: response: error: FAILURE - - label: - "Step 9: TH sends Lock Door Command to the DUT without any argument - PINCode" + - label: "Step 8: TH sends Lock Door Command to the DUT without PINCode" + runIf: requirePINIsTrue PICS: DRLK.S.C00.Rsp && DRLK.S.A0033 command: "LockDoor" timedInteractionTimeoutMs: 1000 response: error: FAILURE + - label: "Step 8: TH sends Lock Door Command to the DUT without PINCode" + runIf: requirePINIsFalse + PICS: DRLK.S.C00.Rsp && DRLK.S.A0033 + command: "LockDoor" + timedInteractionTimeoutMs: 1000 + + - label: "Step 9: TH sends Lock Door Command to the DUT with valid PINCode" + PICS: DRLK.S.C00.Rsp && DRLK.S.A0033 + command: "LockDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + - label: "Step 10a: H reads the WrongCodeEntryLimit attribute from the DUT" PICS: DRLK.S.A0030 command: "readAttribute" @@ -355,7 +450,7 @@ tests: - label: "Step 10e: TH writes WrongCodeEntryLimit attribute value as between 1 and 255 on the DUT and Verify that the DUT sends Success response" - PICS: DRLK.S.A0030 + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write command: "writeAttribute" attribute: "WrongCodeEntryLimit" arguments: @@ -364,7 +459,7 @@ tests: - label: "Step 10e: TH writes WrongCodeEntryLimit attribute value as between 1 and 255 on the DUT and verify DUT responds with UNSUPPORTED_WRITE" - PICS: "!DRLK.S.A0030" + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write command: "writeAttribute" attribute: "WrongCodeEntryLimit" arguments: @@ -387,7 +482,7 @@ tests: "Step 12a: TH writes UserCodeTemporaryDisableTime attribute value as between 1 and 255 on the DUT and Verify that the DUT sends Success response" - PICS: DRLK.S.A0031 + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write command: "writeAttribute" attribute: "UserCodeTemporaryDisableTime" arguments: @@ -397,7 +492,7 @@ tests: "Step 12a: TH writes UserCodeTemporaryDisableTime attribute value as between 1 and 255 on the DUT and verify DUT responds with UNSUPPORTED_WRITE" - PICS: "!DRLK.S.A0031" + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write command: "writeAttribute" attribute: "UserCodeTemporaryDisableTime" arguments: diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_3.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_3.yaml index 644d59a39d146f..e8e0583619bde5 100644 --- a/src/app/tests/suites/certification/Test_TC_DRLK_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_3.yaml @@ -22,6 +22,9 @@ config: cluster: "Door Lock" endpoint: 1 timeout: 200 + requirePINIsTrue: + type: BOOLEAN + defaultValue: false tests: - label: "Wait for the commissioned device to be retrieved" @@ -127,18 +130,18 @@ tests: value: null - label: - "Step 1a: TH writes the RequirePINforRemoteOperation attribute value - as False on the DUT" - PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033 + "Step 1: TH writes the RequirePINforRemoteOperation attribute value as + False on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write command: "writeAttribute" attribute: "RequirePINforRemoteOperation" arguments: value: false - label: - "Step 1b: TH writes the RequirePINforRemoteOperation attribute value - as False on the DUT and Verify DUT responds with UNSUPPORTED_WRITE" - PICS: DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033 + "Step 1: TH writes the RequirePINforRemoteOperation attribute value as + False on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write command: "writeAttribute" attribute: "RequirePINforRemoteOperation" arguments: @@ -153,14 +156,63 @@ tests: command: "readAttribute" attribute: "RequirePINforRemoteOperation" response: - value: false + saveAs: requirePINIsTrue + constraints: + type: boolean + minValue: 0 + maxValue: 1 + + - label: + "Step 2a: TH verifies the RequirePINforRemoteOperation attribute value + is now False on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + value: true + + - label: "Step 2b: Compute RequirePINforRemoteOperation" + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + saveAs: requirePINIsFalse + constraints: + type: boolean + minValue: 0 + maxValue: 1 - label: "Step 3: TH sends the unlock Door command to the DUT without PINCode" + runIf: requirePINIsFalse PICS: DRLK.S.C01.Rsp command: "UnlockDoor" timedInteractionTimeoutMs: 1000 + - label: + "Step 3: TH sends the unlock Door command to the DUT without PINCode" + runIf: requirePINIsTrue + PICS: DRLK.S.C01.Rsp + command: "UnlockDoor" + timedInteractionTimeoutMs: 1000 + response: + error: FAILURE + - label: "Step 4: TH sends the unlock Door command to the DUT with valid PINCode" @@ -173,18 +225,18 @@ tests: value: "123456" - label: - "Step 5a: TH writes the RequirePINforRemoteOperation attribute value - as False on the DUT" - PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033 + "Step 5: TH writes the RequirePINforRemoteOperation attribute value as + true on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write command: "writeAttribute" attribute: "RequirePINforRemoteOperation" arguments: value: true - label: - "Step 5b: TH writes the RequirePINforRemoteOperation attribute value - as False on the DUT and Verify DUT responds with UNSUPPORTED_WRITE" - PICS: DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033 + "Step 5: TH writes the RequirePINforRemoteOperation attribute value as + true on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write command: "writeAttribute" attribute: "RequirePINforRemoteOperation" arguments: @@ -199,21 +251,49 @@ tests: command: "readAttribute" attribute: "RequirePINforRemoteOperation" response: - value: true + saveAs: requirePINIsTrue + constraints: + type: boolean + minValue: 0 + maxValue: 1 - label: - "Step 7: TH sends the unlock Door command to the DUT with valid - PINCode" - PICS: DRLK.S.C01.Rsp && DRLK.S.A0033 - command: "UnlockDoor" - timedInteractionTimeoutMs: 1000 + "Step 6a: TH verifies the RequirePINforRemoteOperation attribute value + is now True on the DUT" + PICS: DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + cluster: "EqualityCommands" + command: "BooleanEquals" arguments: values: - - name: "PINCode" - value: "123456" + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: true + response: + - values: + - name: "Equals" + value: true + + - label: "Step 6b: Compute RequirePINforRemoteOperation" + cluster: "EqualityCommands" + command: "BooleanEquals" + arguments: + values: + - name: "Value1" + value: requirePINIsTrue + - name: "Value2" + value: false + response: + - values: + - name: "Equals" + saveAs: requirePINIsFalse + constraints: + type: boolean + minValue: 0 + maxValue: 1 - label: - "Step 8: TH sends the unlock Door command to the DUT with invalid + "Step 7: TH sends the unlock Door command to the DUT with invalid PINCode" PICS: DRLK.S.C01.Rsp && DRLK.S.A0033 command: "UnlockDoor" @@ -226,7 +306,8 @@ tests: error: FAILURE - label: - "Step 9: TH sends the unlock Door command to the DUT without PINCode" + "Step 8: TH sends the unlock Door command to the DUT without PINCode" + runIf: requirePINIsTrue PICS: DRLK.S.C01.Rsp && DRLK.S.A0033 command: "UnlockDoor" timedInteractionTimeoutMs: 1000 @@ -234,18 +315,36 @@ tests: error: FAILURE - label: - "Step 10a: TH writes WrongCodeEntryLimit attribute value as 3 on the - DUT and Verify that the DUT sends Success response" - PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write + "Step 8: TH sends the unlock Door command to the DUT without PINCode" + runIf: requirePINIsFalse + PICS: DRLK.S.C01.Rsp && DRLK.S.A0033 + command: "UnlockDoor" + timedInteractionTimeoutMs: 1000 + + - label: + "Step 9: TH sends the unlock Door command to the DUT with valid + PINCode" + PICS: DRLK.S.C01.Rsp && DRLK.S.A0033 + command: "UnlockDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + + - label: + "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the + DUT" + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write command: "writeAttribute" attribute: "WrongCodeEntryLimit" arguments: value: 3 - label: - "Step 10b: TH writes WrongCodeEntryLimit attribute value as 3 on the - DUT and verify DUT responds with UNSUPPORTED_WRITE" - PICS: DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write + "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the + DUT" + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write command: "writeAttribute" attribute: "WrongCodeEntryLimit" arguments: @@ -254,18 +353,18 @@ tests: error: UNSUPPORTED_WRITE - label: - "Step 11a: TH writes UserCodeTemporaryDisableTime attribute value as - 15 Seconds on the DUT and Verify that the DUT sends Success response" - PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write + "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 + Seconds on the DUT and Verify that the DUT sends Success response" + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write command: "writeAttribute" attribute: "UserCodeTemporaryDisableTime" arguments: value: 15 - label: - "Step 11b: TH writes UserCodeTemporaryDisableTime attribute value as - 15 Seconds on the DUT and Verify that the DUT sends Success response" - PICS: DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write + "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 + Seconds on the DUT and Verify that the DUT sends Success response" + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write command: "writeAttribute" attribute: "UserCodeTemporaryDisableTime" arguments: @@ -326,9 +425,8 @@ tests: error: FAILURE - label: - "Step 13: TH reads the UserCodeTemporaryDisableTime attribute from the - DUT and check attribute is triggered" - PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031 + "Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT" + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031 command: "readAttribute" attribute: "UserCodeTemporaryDisableTime" response: @@ -350,7 +448,7 @@ tests: - label: "Wait for UserCodeTemporaryDisableTime expires" cluster: "DelayCommands" command: "WaitForMs" - PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031 + PICS: ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031 arguments: values: - name: "ms" diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 25ba9a6b338a2b..d3e92a4470dfa5 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -285,15 +285,12 @@ "DL_LockUnlock", "DL_Schedules", "Test_TC_DRLK_1_1", - "Test_TC_DRLK_2_2", - "Test_TC_DRLK_2_3", "Test_TC_DRLK_2_4", "Test_TC_DRLK_2_5", "Test_TC_DRLK_2_6", "Test_TC_DRLK_2_7", "Test_TC_DRLK_2_8", - "Test_TC_DRLK_2_11", - "Test_TC_DRLK_2_12" + "Test_TC_DRLK_2_11" ], "Groups": [ "TestGroupMessaging", diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index b64115bee8df00..c66cad9e1d95c8 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -310,15 +310,12 @@ class TestList : public Command printf("DL_LockUnlock\n"); printf("DL_Schedules\n"); printf("Test_TC_DRLK_1_1\n"); - printf("Test_TC_DRLK_2_2\n"); - printf("Test_TC_DRLK_2_3\n"); printf("Test_TC_DRLK_2_4\n"); printf("Test_TC_DRLK_2_5\n"); printf("Test_TC_DRLK_2_6\n"); printf("Test_TC_DRLK_2_7\n"); printf("Test_TC_DRLK_2_8\n"); printf("Test_TC_DRLK_2_11\n"); - printf("Test_TC_DRLK_2_12\n"); printf("TestGroupMessaging\n"); printf("TestGroupsCluster\n"); printf("Test_TC_G_1_1\n"); @@ -108954,1182 +108951,6 @@ class Test_TC_DRLK_1_1Suite : public TestCommand } }; -class Test_TC_DRLK_2_2Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_2", 27, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DRLK_2_2Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - - // - // Tests methods - // - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValueNonNull("userName", value.userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("xxx", 3))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 6452UL)); - VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("userType", value.userType)); - VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0U)); - VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0U)); - VerifyOrReturn(CheckValueNonNull("credentials", value.credentials)); - { - auto iter_1 = value.credentials.Value().begin(); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 0)); - } - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, true)); - VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("requirePINforRemoteOperation", value, false)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("requirePINforRemoteOperation", value, true)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - CHIP_ERROR DoTestStep(uint16_t testIndex) override - { - using namespace chip::app::Clusters; - switch (testIndex) - { - case 0: { - LogStep(0, "Wait for the commissioned device to be retrieved"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Create new user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 1U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("xxxgarbage: not in length on purpose", 3); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 6452UL; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(1); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(0); - value.credentialRule.SetNonNull(); - value.credentialRule.Value() = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Precondition: Read the user back and verify its fields"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Precondition: Create new PIN credential and lock/unlock user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 1U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Precondition: Verify created PIN credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 1a: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 1b: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT and Verify DUT " - "responds with UNSUPPORTED_WRITE"); - VerifyOrDo(!ShouldSkip("!DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3: TH sends Lock Door Command to the DUT without PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 4: TH sends Lock Door Command to the DUT with valid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 5a: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 5b: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT and Verify DUT " - "responds with UNSUPPORTED_WRITE"); - VerifyOrDo(!ShouldSkip("!DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 7: TH sends Lock Door Command to the DUT with valid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C00.Rsp && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Step 8: TH sends Lock Door Command to the DUT without valid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C00.Rsp && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("645321garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Step 9: TH sends Lock Door Command to the DUT without any argument PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C00.Rsp && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Step 10a: H reads the WrongCodeEntryLimit attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, - "Step 10b: TH sends an Unlock Door Command from the DUT with invalid PINCode. Repeat this step " - "PIXIT.DRLK.WrongCodeEntryLimit times and Verify that DUT sends failure response to the TH"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DRLK.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 18: { - LogStep(18, - "Step 10c: TH sends an Unlock Door Command from User1 to the DUT with the valid PINCode and verify the DUT " - "response"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DRLK.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 19: { - LogStep(19, - "Step 10d: Wait for PIXIT.DRLK.UserCodeTemporaryDisableTime.TH then sends an Unlock Door Command from User1 to " - "the DUT with the valid PINCode."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DRLK.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 20: { - LogStep(20, - "Step 10e: TH writes WrongCodeEntryLimit attribute value as between 1 and 255 on the DUT and Verify that the " - "DUT sends Success response"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 3U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 10e: TH writes WrongCodeEntryLimit attribute value as between 1 and 255 on the DUT and verify DUT " - "responds with UNSUPPORTED_WRITE"); - VerifyOrDo(!ShouldSkip("!DRLK.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 3U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 11a: TH reads the UserCodeTemporaryDisableTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 12a: TH writes UserCodeTemporaryDisableTime attribute value as between 1 and 255 on the DUT and Verify " - "that the DUT sends Success response"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 15U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 12a: TH writes UserCodeTemporaryDisableTime attribute value as between 1 and 255 on the DUT and verify " - "DUT responds with UNSUPPORTED_WRITE"); - VerifyOrDo(!ShouldSkip("!DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 15U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 25: { - LogStep(25, "Clean the created user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Cleanup the created credential"); - VerifyOrDo(!ShouldSkip("DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(1); - value.credential.Value().credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_3Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_3", 39, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DRLK_2_3Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(200)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - - // - // Tests methods - // - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValueNonNull("userName", value.userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("xxx", 3))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 6452UL)); - VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("userType", value.userType)); - VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0U)); - VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0U)); - VerifyOrReturn(CheckValueNonNull("credentials", value.credentials)); - { - auto iter_1 = value.credentials.Value().begin(); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 0)); - } - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, true)); - VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("requirePINforRemoteOperation", value, false)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("requirePINforRemoteOperation", value, true)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("userCodeTemporaryDisableTime", value, 15U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("autoRelockTime", value, 10UL)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("autoRelockTime", value, 60UL)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("lockState", value)); - VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - CHIP_ERROR DoTestStep(uint16_t testIndex) override - { - using namespace chip::app::Clusters; - switch (testIndex) - { - case 0: { - LogStep(0, "Wait for the commissioned device to be retrieved"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Create new user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 1U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("xxxgarbage: not in length on purpose", 3); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 6452UL; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(1); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(0); - value.credentialRule.SetNonNull(); - value.credentialRule.Value() = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Precondition: Read the user back and verify its fields"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Precondition: Create new PIN credential and lock/unlock user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 1U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Precondition: Verify created PIN credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 1a: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 1b: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT and Verify DUT " - "responds with UNSUPPORTED_WRITE"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3: TH sends the unlock Door command to the DUT without PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 4: TH sends the unlock Door command to the DUT with valid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 5a: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 5b: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT and Verify DUT " - "responds with UNSUPPORTED_WRITE"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 7: TH sends the unlock Door command to the DUT with valid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Step 8: TH sends the unlock Door command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("1234568garbage: not in length on purpose"), 7); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Step 9: TH sends the unlock Door command to the DUT without PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 16: { - LogStep(16, - "Step 10a: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and Verify that the DUT sends Success " - "response"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 3U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 17: { - LogStep(17, - "Step 10b: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and verify DUT responds with " - "UNSUPPORTED_WRITE"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 3U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, - "Step 11a: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the " - "DUT sends Success response"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 15U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 11b: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the " - "DUT sends Success response"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 15U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 20: { - LogStep(20, "Step 12a: TH sends the unlock Door command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("1234568garbage: not in length on purpose"), 7); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Step 12b: TH sends the unlock Door command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("1234568garbage: not in length on purpose"), 7); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Step 12c: TH sends the unlock Door command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("1234568garbage: not in length on purpose"), 7); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Step 12d: TH sends the unlock Door command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("1234568garbage: not in length on purpose"), 7); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 24: { - LogStep(24, - "Step 13: TH reads the UserCodeTemporaryDisableTime attribute from the DUT and check attribute is triggered"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 14: TH sends the unlock Door command to the DUT with valid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Wait for UserCodeTemporaryDisableTime expires"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 15000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "Step 15a: TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 10UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 15b: TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 60UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 15c: TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); - VerifyOrDo(!ShouldSkip(" !DRLK.S.A0023.Write && PICS_SDK_CI_ONLY "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 10UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 15d: TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip(" !DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 60UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 31: { - LogStep(31, "Step 16a: TH reads the AutoRelockTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Step 16b: TH reads the AutoRelockTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 17: TH sends the unlock Door command to the DUT with valid PINCode and Verify that DUT sends SUCCESS " - "response to the TH"); - VerifyOrDo(!ShouldSkip("DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Wait for AutoRelockTime Expires"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 35: { - LogStep(35, "Wait for AutoRelockTime Expires"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 60000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 36: { - LogStep(36, "Step 18: TH reads LockState attribute"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0000 && DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 37: { - LogStep(37, "Cleanup the created user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 38: { - LogStep(38, "Clean the created credential"); - VerifyOrDo(!ShouldSkip("DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(1); - value.credential.Value().credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - class Test_TC_DRLK_2_4Suite : public TestCommand { public: @@ -112523,670 +111344,6 @@ class Test_TC_DRLK_2_11Suite : public TestCommand } }; -class Test_TC_DRLK_2_12Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_12", 39, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DRLK_2_12Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - - // - // Tests methods - // - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValueNonNull("userName", value.userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("xxx", 3))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 6452UL)); - VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("userType", value.userType)); - VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0U)); - VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0U)); - VerifyOrReturn(CheckValueNonNull("credentials", value.credentials)); - { - auto iter_1 = value.credentials.Value().begin(); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 0)); - } - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, true)); - VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("requirePINforRemoteOperation", value, false)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("requirePINforRemoteOperation", value, true)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("userCodeTemporaryDisableTime", value, 15U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("autoRelockTime", value, 10UL)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("autoRelockTime", value, 60UL)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("lockState", value)); - VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - CHIP_ERROR DoTestStep(uint16_t testIndex) override - { - using namespace chip::app::Clusters; - switch (testIndex) - { - case 0: { - LogStep(0, "Wait for the commissioned device to be retrieved"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Create new user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 1U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("xxxgarbage: not in length on purpose", 3); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 6452UL; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(1); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(0); - value.credentialRule.SetNonNull(); - value.credentialRule.Value() = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Precondition: Read the user back and verify its fields"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Precondition: Create new PIN credential and lock/unlock user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 1U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Precondition: Verify created PIN credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3: TH sends Ubolt Door Command to the DUT without PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 4: TH sends Ubolt Door Command to the DUT with PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123458garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Step 9: TH sends Unbolt Door Command to the DUT without PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT"); - VerifyOrDo(!ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 3U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT"); - VerifyOrDo(!ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 3U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, - "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the " - "DUT sends Success response"); - VerifyOrDo(!ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 15U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the " - "DUT sends Success response"); - VerifyOrDo(!ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 15U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 20: { - LogStep(20, "Step 12a: TH sends Unbolt Door Command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123457garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Step 12b: TH sends Unbolt Door Command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123458garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Step 12c: TH sends Unbolt Door Command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123459garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Step 12d: TH sends Unbolt Door Command to the DUT with invalid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123460garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, true, chip::NullOptional); - } - case 25: { - LogStep( - 25, - "Step 14: TH sends Unbolt Door Command to the DUT with valid PINCode before UserCodeTemporaryDisableTime expires"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Wait for UserCodeTemporaryDisableTime expires"); - VerifyOrDo(!ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 15000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 10UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 60UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 15: TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY && !DRLK.S.A0023.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 10UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && !DRLK.S.A0023.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 60UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 31: { - LogStep(31, "Step 16: TH reads the AutoRelockTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Step 16: TH reads the AutoRelockTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, "Step 17: TH sends the Unbolt Door command to the DUT with valid PINCode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Wait for AutoRelockTime Expires"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 35: { - LogStep(35, "Wait for AutoRelockTime Expires"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 60000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 36: { - LogStep(36, "Step 18: TH reads LockState attribute"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0000 && DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 37: { - LogStep(37, "Cleanup the created user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 38: { - LogStep(38, "Clean the created credential"); - VerifyOrDo(!ShouldSkip("DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(1); - value.credential.Value().credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - class TestGroupMessagingSuite : public TestCommand { public: @@ -143884,15 +142041,12 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index bae08b8fa26891..feeeed0da0bc56 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -279,15 +279,12 @@ class TestList : public Command { printf("DL_UsersAndCredentials\n"); printf("DL_Schedules\n"); printf("Test_TC_DRLK_1_1\n"); - printf("Test_TC_DRLK_2_2\n"); - printf("Test_TC_DRLK_2_3\n"); printf("Test_TC_DRLK_2_4\n"); printf("Test_TC_DRLK_2_5\n"); printf("Test_TC_DRLK_2_6\n"); printf("Test_TC_DRLK_2_7\n"); printf("Test_TC_DRLK_2_8\n"); printf("Test_TC_DRLK_2_11\n"); - printf("Test_TC_DRLK_2_12\n"); printf("TestGroupsCluster\n"); printf("Test_TC_G_1_1\n"); printf("TestActivatedCarbonFilterMonitoring\n"); @@ -167999,11 +167996,11 @@ class Test_TC_DRLK_1_1 : public TestCommandBridge { } }; -class Test_TC_DRLK_2_2 : public TestCommandBridge { +class Test_TC_DRLK_2_4 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_2() - : TestCommandBridge("Test_TC_DRLK_2_2") + Test_TC_DRLK_2_4() + : TestCommandBridge("Test_TC_DRLK_2_4") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -168013,7 +168010,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DRLK_2_2() {} + ~Test_TC_DRLK_2_4() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -168021,11 +168018,11 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_4\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_4\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -168042,217 +168039,110 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Create new user\n"); - err = TestPreconditionCreateNewUser_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Create new user\n"); + err = TestCreateNewUser_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Read the user back and verify its fields\n"); - err = TestPreconditionReadTheUserBackAndVerifyItsFields_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the user back and verify its fields\n"); + err = TestReadTheUserBackAndVerifyItsFields_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Precondition: Create new PIN credential and lock/unlock user\n"); - err = TestPreconditionCreateNewPinCredentialAndLockUnlockUser_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Create new PIN credential and lock/unlock user\n"); + err = TestCreateNewPinCredentialAndLockUnlockUser_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Precondition: Verify created PIN credential\n"); - err = TestPreconditionVerifyCreatedPinCredential_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Verify created PIN credential\n"); + err = TestVerifyCreatedPinCredential_4(); break; case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : Step 1a: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); - if (ShouldSkip("DRLK.S.A0033")) { + ChipLogProgress( + chipTool, " ***** Test Step 5 : Step 1a: TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); + if (ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestStep1aThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5(); + err = TestStep1aThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_5(); break; case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Step 1b: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT and " - "Verify DUT responds with UNSUPPORTED_WRITE\n"); - if (ShouldSkip("!DRLK.S.A0033")) { + ChipLogProgress( + chipTool, " ***** Test Step 6 : Step 1b: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); + if (ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestStep1bThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDutAndVerifyDutRespondsWithUnsupportedWrite_6(); + err = TestStep1bThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_6(); break; case 7: ChipLogProgress( - chipTool, " ***** Test Step 7 : Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { + chipTool, " ***** Test Step 7 : Step 1c: TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); + if (ShouldSkip("PICS_SDK_CI_ONLY && !DRLK.S.A0023.Write")) { NextTest(); return; } - err = TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7(); + err = TestStep1cThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3: TH sends Lock Door Command to the DUT without PINCode\n"); - if (ShouldSkip("DRLK.S.C00.Rsp")) { + ChipLogProgress( + chipTool, " ***** Test Step 8 : Step 1d: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP && !DRLK.S.A0023.Write")) { NextTest(); return; } - err = TestStep3ThSendsLockDoorCommandToTheDutWithoutPINCode_8(); + err = TestStep1dThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 4: TH sends Lock Door Command to the DUT with valid PINCode\n"); - if (ShouldSkip("DRLK.S.C00.Rsp")) { + ChipLogProgress( + chipTool, " ***** Test Step 9 : Step 2a: TH sends the Unlock with Timeout argument value as 10 seconds\n"); + if (ShouldSkip("DRLK.S.C03.Rsp && PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestStep4ThSendsLockDoorCommandToTheDutWithValidPINCode_9(); + err = TestStep2aThSendsTheUnlockWithTimeoutArgumentValueAs10Seconds_9(); break; case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : Step 5a: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); - if (ShouldSkip("DRLK.S.A0033")) { + ChipLogProgress( + chipTool, " ***** Test Step 10 : Step 2b: TH sends the Unlock with Timeout argument value as 60 seconds\n"); + if (ShouldSkip("DRLK.S.C03.Rsp && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestStep5aThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_10(); + err = TestStep2bThSendsTheUnlockWithTimeoutArgumentValueAs60Seconds_10(); break; case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : Step 5b: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT and " - "Verify DUT responds with UNSUPPORTED_WRITE\n"); - if (ShouldSkip("!DRLK.S.A0033")) { + ChipLogProgress(chipTool, " ***** Test Step 11 : Wait for AutoRelockTime Expires\n"); + if (ShouldSkip("DRLK.S.C03.Rsp && PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestStep5bThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDutAndVerifyDutRespondsWithUnsupportedWrite_11(); + err = TestWaitForAutoRelockTimeExpires_11(); break; case 12: - ChipLogProgress( - chipTool, " ***** Test Step 12 : Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait for AutoRelockTime Expires\n"); + if (ShouldSkip("DRLK.S.C03.Rsp && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12(); + err = TestWaitForAutoRelockTimeExpires_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Step 7: TH sends Lock Door Command to the DUT with valid PINCode\n"); - if (ShouldSkip("DRLK.S.C00.Rsp && DRLK.S.A0033")) { + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 2c: TH reads LockState attribute\n"); + if (ShouldSkip("DRLK.S.A0000 && DRLK.S.C03.Rsp")) { NextTest(); return; } - err = TestStep7ThSendsLockDoorCommandToTheDutWithValidPINCode_13(); + err = TestStep2cThReadsLockStateAttribute_13(); break; case 14: - ChipLogProgress( - chipTool, " ***** Test Step 14 : Step 8: TH sends Lock Door Command to the DUT without valid PINCode\n"); - if (ShouldSkip("DRLK.S.C00.Rsp && DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep8ThSendsLockDoorCommandToTheDutWithoutValidPINCode_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : Cleanup the created user\n"); + err = TestCleanupTheCreatedUser_14(); break; case 15: - ChipLogProgress( - chipTool, " ***** Test Step 15 : Step 9: TH sends Lock Door Command to the DUT without any argument PINCode\n"); - if (ShouldSkip("DRLK.S.C00.Rsp && DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep9ThSendsLockDoorCommandToTheDutWithoutAnyArgumentPINCode_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Step 10a: H reads the WrongCodeEntryLimit attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.A0030")) { - NextTest(); - return; - } - err = TestStep10aHReadsTheWrongCodeEntryLimitAttributeFromTheDut_16(); - break; - case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : Step 10b: TH sends an Unlock Door Command from the DUT with invalid PINCode. Repeat this " - "step PIXIT.DRLK.WrongCodeEntryLimit times and Verify that DUT sends failure response to the TH\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.A0030")) { - NextTest(); - return; - } - err = TestStep10bThSendsAnUnlockDoorCommandFromTheDutWithInvalidPINCodeRepeatThisStepPIXITDRLKWrongCodeEntryLimitTimesAndVerifyThatDutSendsFailureResponseToTheTh_17(); - break; - case 18: - ChipLogProgress(chipTool, - " ***** Test Step 18 : Step 10c: TH sends an Unlock Door Command from User1 to the DUT with the valid PINCode and " - "verify the DUT response\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.A0030")) { - NextTest(); - return; - } - err = TestStep10cThSendsAnUnlockDoorCommandFromUser1ToTheDutWithTheValidPINCodeAndVerifyTheDutResponse_18(); - break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : Step 10d: Wait for PIXIT.DRLK.UserCodeTemporaryDisableTime.TH then sends an Unlock Door " - "Command from User1 to the DUT with the valid PINCode.\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.A0030")) { - NextTest(); - return; - } - err = TestStep10dWaitForPIXITDRLKUserCodeTemporaryDisableTimeTHThenSendsAnUnlockDoorCommandFromUser1ToTheDutWithTheValidPINCode_19(); - break; - case 20: - ChipLogProgress(chipTool, - " ***** Test Step 20 : Step 10e: TH writes WrongCodeEntryLimit attribute value as between 1 and 255 on the DUT and " - "Verify that the DUT sends Success response\n"); - if (ShouldSkip("DRLK.S.A0030")) { - NextTest(); - return; - } - err = TestStep10eThWritesWrongCodeEntryLimitAttributeValueAsBetween1And255OnTheDutAndVerifyThatTheDutSendsSuccessResponse_20(); - break; - case 21: - ChipLogProgress(chipTool, - " ***** Test Step 21 : Step 10e: TH writes WrongCodeEntryLimit attribute value as between 1 and 255 on the DUT and " - "verify DUT responds with UNSUPPORTED_WRITE\n"); - if (ShouldSkip("!DRLK.S.A0030")) { - NextTest(); - return; - } - err = TestStep10eThWritesWrongCodeEntryLimitAttributeValueAsBetween1And255OnTheDutAndVerifyDutRespondsWithUnsupportedWrite_21(); - break; - case 22: - ChipLogProgress( - chipTool, " ***** Test Step 22 : Step 11a: TH reads the UserCodeTemporaryDisableTime attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.A0031")) { - NextTest(); - return; - } - err = TestStep11aThReadsTheUserCodeTemporaryDisableTimeAttributeFromTheDut_22(); - break; - case 23: - ChipLogProgress(chipTool, - " ***** Test Step 23 : Step 12a: TH writes UserCodeTemporaryDisableTime attribute value as between 1 and 255 on " - "the DUT and Verify that the DUT sends Success response\n"); - if (ShouldSkip("DRLK.S.A0031")) { - NextTest(); - return; - } - err = TestStep12aThWritesUserCodeTemporaryDisableTimeAttributeValueAsBetween1And255OnTheDutAndVerifyThatTheDutSendsSuccessResponse_23(); - break; - case 24: - ChipLogProgress(chipTool, - " ***** Test Step 24 : Step 12a: TH writes UserCodeTemporaryDisableTime attribute value as between 1 and 255 on " - "the DUT and verify DUT responds with UNSUPPORTED_WRITE\n"); - if (ShouldSkip("!DRLK.S.A0031")) { - NextTest(); - return; - } - err = TestStep12aThWritesUserCodeTemporaryDisableTimeAttributeValueAsBetween1And255OnTheDutAndVerifyDutRespondsWithUnsupportedWrite_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Clean the created user\n"); - err = TestCleanTheCreatedUser_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Cleanup the created credential\n"); + ChipLogProgress(chipTool, " ***** Test Step 15 : Clean the created credential\n"); if (ShouldSkip("DRLK.S.C26.Rsp")) { NextTest(); return; } - err = TestCleanupTheCreatedCredential_26(); + err = TestCleanTheCreatedCredential_15(); break; } @@ -168284,13 +168174,13 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -168299,7 +168189,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -168308,42 +168198,9 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 25: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 26: + case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; } @@ -168359,7 +168216,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 27; + const uint16_t mTestCount = 16; chip::Optional mNodeId; chip::Optional mCluster; @@ -168374,7 +168231,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestPreconditionCreateNewUser_1() + CHIP_ERROR TestCreateNewUser_1() { MTRBaseDevice * device = GetDevice("alpha"); @@ -168391,7 +168248,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; [cluster setUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Precondition: Create new user Error: %@", err); + NSLog(@"Create new user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -168401,7 +168258,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionReadTheUserBackAndVerifyItsFields_2() + CHIP_ERROR TestReadTheUserBackAndVerifyItsFields_2() { MTRBaseDevice * device = GetDevice("alpha"); @@ -168412,7 +168269,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { params.userIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster getUserWithParams:params completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Precondition: Read the user back and verify its fields Error: %@", err); + NSLog(@"Read the user back and verify its fields Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -168480,7 +168337,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionCreateNewPinCredentialAndLockUnlockUser_3() + CHIP_ERROR TestCreateNewPinCredentialAndLockUnlockUser_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -168500,7 +168357,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { [cluster setCredentialWithParams:params completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Precondition: Create new PIN credential and lock/unlock user Error: %@", err); + NSLog(@"Create new PIN credential and lock/unlock user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -168526,7 +168383,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionVerifyCreatedPinCredential_4() + CHIP_ERROR TestVerifyCreatedPinCredential_4() { MTRBaseDevice * device = GetDevice("alpha"); @@ -168541,7 +168398,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { [cluster getCredentialStatusWithParams:params completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Precondition: Verify created PIN credential Error: %@", err); + NSLog(@"Verify created PIN credential Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -168579,386 +168436,185 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1aThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:false]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1a: TH writes the RequirePINforRemoteOperation " - @"attribute value as False on the DUT Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR - TestStep1bThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDutAndVerifyDutRespondsWithUnsupportedWrite_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:false]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1b: TH writes the RequirePINforRemoteOperation " - @"attribute value as False on the DUT and Verify DUT responds " - @"with UNSUPPORTED_WRITE Error: %@", - err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, false)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3ThSendsLockDoorCommandToTheDutWithoutPINCode_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - [cluster lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 3: TH sends Lock Door Command to the DUT without PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4ThSendsLockDoorCommandToTheDutWithValidPINCode_9() + CHIP_ERROR TestStep1aThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 4: TH sends Lock Door Command to the DUT with valid PINCode Error: %@", err); + id autoRelockTimeArgument; + autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; + [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 1a: TH writes AutoRelockTime attribute value as 10 seconds on the DUT " + @"Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep5aThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_10() + CHIP_ERROR TestStep1bThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_6() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:true]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5a: TH writes the RequirePINforRemoteOperation " - @"attribute value as False on the DUT Error: %@", - err); + id autoRelockTimeArgument; + autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; + [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 1b: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " + @"Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestStep5bThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDutAndVerifyDutRespondsWithUnsupportedWrite_11() + CHIP_ERROR TestStep1cThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_7() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:true]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5b: TH writes the RequirePINforRemoteOperation " - @"attribute value as False on the DUT and Verify DUT responds " - @"with UNSUPPORTED_WRITE Error: %@", - err); + id autoRelockTimeArgument; + autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; + [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 1c: TH writes AutoRelockTime attribute value as 10 seconds on the DUT " + @"Error: %@", + err); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12() + CHIP_ERROR TestStep1dThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, true)); - } + id autoRelockTimeArgument; + autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; + [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 1d: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " + @"Error: %@", + err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7ThSendsLockDoorCommandToTheDutWithValidPINCode_13() + CHIP_ERROR TestStep2aThSendsTheUnlockWithTimeoutArgumentValueAs10Seconds_9() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; + __auto_type * params = [[MTRDoorLockClusterUnlockWithTimeoutParams alloc] init]; + params.timeout = [NSNumber numberWithUnsignedShort:10U]; params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 7: TH sends Lock Door Command to the DUT with valid PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep8ThSendsLockDoorCommandToTheDutWithoutValidPINCode_14() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"645321" length:6]; [cluster - lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 8: TH sends Lock Door Command to the DUT without valid PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep9ThSendsLockDoorCommandToTheDutWithoutAnyArgumentPINCode_15() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + unlockWithTimeoutWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2a: TH sends the Unlock with Timeout argument value as 10 seconds Error: %@", err); - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - [cluster - lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 9: TH sends Lock Door Command to the DUT without any argument PINCode Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep10aHReadsTheWrongCodeEntryLimitAttributeFromTheDut_16() + CHIP_ERROR TestStep2bThSendsTheUnlockWithTimeoutArgumentValueAs60Seconds_10() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeWrongCodeEntryLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 10a: H reads the WrongCodeEntryLimit attribute from the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRDoorLockClusterUnlockWithTimeoutParams alloc] init]; + params.timeout = [NSNumber numberWithUnsignedShort:60U]; + params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; + [cluster + unlockWithTimeoutWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2b: TH sends the Unlock with Timeout argument value as 60 seconds Error: %@", err); - VerifyOrReturn(CheckConstraintMinValue("wrongCodeEntryLimit", [value unsignedCharValue], 1U)); - VerifyOrReturn(CheckConstraintMaxValue("wrongCodeEntryLimit", [value unsignedCharValue], 255U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestStep10bThSendsAnUnlockDoorCommandFromTheDutWithInvalidPINCodeRepeatThisStepPIXITDRLKWrongCodeEntryLimitTimesAndVerifyThatDutSendsFailureResponseToTheTh_17() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestStep10cThSendsAnUnlockDoorCommandFromUser1ToTheDutWithTheValidPINCodeAndVerifyTheDutResponse_18() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR - TestStep10dWaitForPIXITDRLKUserCodeTemporaryDisableTimeTHThenSendsAnUnlockDoorCommandFromUser1ToTheDutWithTheValidPINCode_19() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR - TestStep10eThWritesWrongCodeEntryLimitAttributeValueAsBetween1And255OnTheDutAndVerifyThatTheDutSendsSuccessResponse_20() + CHIP_ERROR TestWaitForAutoRelockTimeExpires_11() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id wrongCodeEntryLimitArgument; - wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; - [cluster - writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 10e: TH writes WrongCodeEntryLimit attribute value as between 1 and " - @"255 on the DUT and Verify that the DUT sends Success response Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 11000UL; + return WaitForMs("alpha", value); } - CHIP_ERROR - TestStep10eThWritesWrongCodeEntryLimitAttributeValueAsBetween1And255OnTheDutAndVerifyDutRespondsWithUnsupportedWrite_21() + CHIP_ERROR TestWaitForAutoRelockTimeExpires_12() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id wrongCodeEntryLimitArgument; - wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; - [cluster - writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 10e: TH writes WrongCodeEntryLimit attribute value as between 1 and " - @"255 on the DUT and verify DUT responds with UNSUPPORTED_WRITE Error: %@", - err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 70000UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestStep11aThReadsTheUserCodeTemporaryDisableTimeAttributeFromTheDut_22() + CHIP_ERROR TestStep2cThReadsLockStateAttribute_13() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 11a: TH reads the UserCodeTemporaryDisableTime attribute from the DUT Error: %@", err); + [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2c: TH reads LockState attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("userCodeTemporaryDisableTime", [value unsignedCharValue], 1U)); - VerifyOrReturn(CheckConstraintMaxValue("userCodeTemporaryDisableTime", [value unsignedCharValue], 255U)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); + VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); + } NextTest(); }]; @@ -168966,61 +168622,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR - TestStep12aThWritesUserCodeTemporaryDisableTimeAttributeValueAsBetween1And255OnTheDutAndVerifyThatTheDutSendsSuccessResponse_23() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id userCodeTemporaryDisableTimeArgument; - userCodeTemporaryDisableTimeArgument = [NSNumber numberWithUnsignedChar:15U]; - [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:userCodeTemporaryDisableTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12a: TH writes UserCodeTemporaryDisableTime attribute " - @"value as between 1 and 255 on the DUT and Verify that the " - @"DUT sends Success response Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR - TestStep12aThWritesUserCodeTemporaryDisableTimeAttributeValueAsBetween1And255OnTheDutAndVerifyDutRespondsWithUnsupportedWrite_24() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id userCodeTemporaryDisableTimeArgument; - userCodeTemporaryDisableTimeArgument = [NSNumber numberWithUnsignedChar:15U]; - [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:userCodeTemporaryDisableTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12a: TH writes UserCodeTemporaryDisableTime attribute " - @"value as between 1 and 255 on the DUT and verify DUT " - @"responds with UNSUPPORTED_WRITE Error: %@", - err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCleanTheCreatedUser_25() + CHIP_ERROR TestCleanupTheCreatedUser_14() { MTRBaseDevice * device = GetDevice("alpha"); @@ -169031,7 +168633,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { params.userIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster clearUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Clean the created user Error: %@", err); + NSLog(@"Cleanup the created user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -169041,7 +168643,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedCredential_26() + CHIP_ERROR TestCleanTheCreatedCredential_15() { MTRBaseDevice * device = GetDevice("alpha"); @@ -169055,7 +168657,7 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { [cluster clearCredentialWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created credential Error: %@", err); + NSLog(@"Clean the created credential Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -169066,11 +168668,11 @@ class Test_TC_DRLK_2_2 : public TestCommandBridge { } }; -class Test_TC_DRLK_2_3 : public TestCommandBridge { +class Test_TC_DRLK_2_5 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_3() - : TestCommandBridge("Test_TC_DRLK_2_3") + Test_TC_DRLK_2_5() + : TestCommandBridge("Test_TC_DRLK_2_5") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -169080,7 +168682,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DRLK_2_3() {} + ~Test_TC_DRLK_2_5() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -169088,11 +168690,11 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_5\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_5\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -169117,313 +168719,73 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { err = TestPreconditionReadTheUserBackAndVerifyItsFields_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Precondition: Create new PIN credential and lock/unlock user\n"); - err = TestPreconditionCreateNewPinCredentialAndLockUnlockUser_3(); + ChipLogProgress( + chipTool, " ***** Test Step 3 : Step 1: TH reads NumberOfWeekDay SchedulesSupportedPerUser attribute\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.A0014")) { + NextTest(); + return; + } + err = TestStep1ThReadsNumberOfWeekDaySchedulesSupportedPerUserAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Precondition: Verify created PIN credential\n"); - err = TestPreconditionVerifyCreatedPinCredential_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 2: TH reads NumberOfTotalUsers Supported attribute\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { + NextTest(); + return; + } + err = TestStep2ThReadsNumberOfTotalUsersSupportedAttribute_4(); break; case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : Step 1a: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 3: TH send Set Week Day Schedule Command\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0b.Rsp")) { NextTest(); return; } - err = TestStep1aThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5(); + err = TestStep3ThSendSetWeekDayScheduleCommand_5(); break; case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Step 1b: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT and " - "Verify DUT responds with UNSUPPORTED_WRITE\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4: TH send Get Week Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { NextTest(); return; } - err = TestStep1bThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDutAndVerifyDutRespondsWithUnsupportedWrite_6(); + err = TestStep4ThSendGetWeekDayScheduleCommandToDut_6(); break; case 7: - ChipLogProgress( - chipTool, " ***** Test Step 7 : Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 5: TH send Set Week Day Schedule Command\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0b.Rsp")) { NextTest(); return; } - err = TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7(); + err = TestStep5ThSendSetWeekDayScheduleCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3: TH sends the unlock Door command to the DUT without PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 6: TH send Get Week Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { NextTest(); return; } - err = TestStep3ThSendsTheUnlockDoorCommandToTheDutWithoutPINCode_8(); + err = TestStep6ThSendGetWeekDayScheduleCommandToDut_8(); break; case 9: - ChipLogProgress( - chipTool, " ***** Test Step 9 : Step 4: TH sends the unlock Door command to the DUT with valid PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 7: TH sends Clear Week Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0d.Rsp")) { NextTest(); return; } - err = TestStep4ThSendsTheUnlockDoorCommandToTheDutWithValidPINCode_9(); + err = TestStep7ThSendsClearWeekDayScheduleCommandToDut_9(); break; case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : Step 5a: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 8: TH sends Get Week Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { NextTest(); return; } - err = TestStep5aThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_10(); + err = TestStep8ThSendsGetWeekDayScheduleCommandToDut_10(); break; case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : Step 5b: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT and " - "Verify DUT responds with UNSUPPORTED_WRITE\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep5bThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDutAndVerifyDutRespondsWithUnsupportedWrite_11(); - break; - case 12: - ChipLogProgress( - chipTool, " ***** Test Step 12 : Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12(); - break; - case 13: - ChipLogProgress( - chipTool, " ***** Test Step 13 : Step 7: TH sends the unlock Door command to the DUT with valid PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp && DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep7ThSendsTheUnlockDoorCommandToTheDutWithValidPINCode_13(); - break; - case 14: - ChipLogProgress( - chipTool, " ***** Test Step 14 : Step 8: TH sends the unlock Door command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp && DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep8ThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_14(); - break; - case 15: - ChipLogProgress( - chipTool, " ***** Test Step 15 : Step 9: TH sends the unlock Door command to the DUT without PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp && DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep9ThSendsTheUnlockDoorCommandToTheDutWithoutPINCode_15(); - break; - case 16: - ChipLogProgress(chipTool, - " ***** Test Step 16 : Step 10a: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and Verify that the " - "DUT sends Success response\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write")) { - NextTest(); - return; - } - err = TestStep10aThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDutAndVerifyThatTheDutSendsSuccessResponse_16(); - break; - case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : Step 10b: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and verify DUT " - "responds with UNSUPPORTED_WRITE\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write")) { - NextTest(); - return; - } - err = TestStep10bThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDutAndVerifyDutRespondsWithUnsupportedWrite_17(); - break; - case 18: - ChipLogProgress(chipTool, - " ***** Test Step 18 : Step 11a: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT " - "and Verify that the DUT sends Success response\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write")) { - NextTest(); - return; - } - err = TestStep11aThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_18(); - break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : Step 11b: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT " - "and Verify that the DUT sends Success response\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write")) { - NextTest(); - return; - } - err = TestStep11bThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_19(); - break; - case 20: - ChipLogProgress( - chipTool, " ***** Test Step 20 : Step 12a: TH sends the unlock Door command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp")) { - NextTest(); - return; - } - err = TestStep12aThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_20(); - break; - case 21: - ChipLogProgress( - chipTool, " ***** Test Step 21 : Step 12b: TH sends the unlock Door command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp")) { - NextTest(); - return; - } - err = TestStep12bThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_21(); - break; - case 22: - ChipLogProgress( - chipTool, " ***** Test Step 22 : Step 12c: TH sends the unlock Door command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp")) { - NextTest(); - return; - } - err = TestStep12cThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_22(); - break; - case 23: - ChipLogProgress( - chipTool, " ***** Test Step 23 : Step 12d: TH sends the unlock Door command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp")) { - NextTest(); - return; - } - err = TestStep12dThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_23(); - break; - case 24: - ChipLogProgress(chipTool, - " ***** Test Step 24 : Step 13: TH reads the UserCodeTemporaryDisableTime attribute from the DUT and check " - "attribute is triggered\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031")) { - NextTest(); - return; - } - err = TestStep13ThReadsTheUserCodeTemporaryDisableTimeAttributeFromTheDutAndCheckAttributeIsTriggered_24(); - break; - case 25: - ChipLogProgress( - chipTool, " ***** Test Step 25 : Step 14: TH sends the unlock Door command to the DUT with valid PINCode\n"); - if (ShouldSkip("DRLK.S.C01.Rsp")) { - NextTest(); - return; - } - err = TestStep14ThSendsTheUnlockDoorCommandToTheDutWithValidPINCode_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Wait for UserCodeTemporaryDisableTime expires\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031")) { - NextTest(); - return; - } - err = TestWaitForUserCodeTemporaryDisableTimeExpires_26(); - break; - case 27: - ChipLogProgress( - chipTool, " ***** Test Step 27 : Step 15a: TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep15aThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_27(); - break; - case 28: - ChipLogProgress( - chipTool, " ***** Test Step 28 : Step 15b: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep15bThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_28(); - break; - case 29: - ChipLogProgress( - chipTool, " ***** Test Step 29 : Step 15c: TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip(" !DRLK.S.A0023.Write && PICS_SDK_CI_ONLY ")) { - NextTest(); - return; - } - err = TestStep15cThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_29(); - break; - case 30: - ChipLogProgress( - chipTool, " ***** Test Step 30 : Step 15d: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip(" !DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP ")) { - NextTest(); - return; - } - err = TestStep15dThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Step 16a: TH reads the AutoRelockTime attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep16aThReadsTheAutoRelockTimeAttributeFromTheDut_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Step 16b: TH reads the AutoRelockTime attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestStep16bThReadsTheAutoRelockTimeAttributeFromTheDut_32(); - break; - case 33: - ChipLogProgress(chipTool, - " ***** Test Step 33 : Step 17: TH sends the unlock Door command to the DUT with valid PINCode and Verify that DUT " - "sends SUCCESS response to the TH\n"); - if (ShouldSkip("DRLK.S.C01.Rsp")) { - NextTest(); - return; - } - err = TestStep17ThSendsTheUnlockDoorCommandToTheDutWithValidPINCodeAndVerifyThatDutSendsSuccessResponseToTheTh_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Wait for AutoRelockTime Expires\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestWaitForAutoRelockTimeExpires_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Wait for AutoRelockTime Expires\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestWaitForAutoRelockTimeExpires_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Step 18: TH reads LockState attribute\n"); - if (ShouldSkip("DRLK.S.A0000 && DRLK.S.C01.Rsp")) { - NextTest(); - return; - } - err = TestStep18ThReadsLockStateAttribute_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Cleanup the created user\n"); - err = TestCleanupTheCreatedUser_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Clean the created credential\n"); - if (ShouldSkip("DRLK.S.C26.Rsp")) { - NextTest(); - return; - } - err = TestCleanTheCreatedCredential_38(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Cleanup the created user\n"); + err = TestCleanupTheCreatedUser_11(); break; } @@ -169455,10 +168817,10 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); break; case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -169470,87 +168832,6 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 38: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; } @@ -169559,11 +168840,14 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ContinueOnChipMainThread(CHIP_NO_ERROR); } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(200)); } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 39; + const uint16_t mTestCount = 12; chip::Optional mNodeId; chip::Optional mCluster; @@ -169683,582 +168967,543 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull NumberOfWeekDaySchedulesSupportedPerUser; - CHIP_ERROR TestPreconditionCreateNewPinCredentialAndLockUnlockUser_3() + CHIP_ERROR TestStep1ThReadsNumberOfWeekDaySchedulesSupportedPerUserAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Precondition: Create new PIN credential and lock/unlock user Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + [cluster readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletion:^( + NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1: TH reads NumberOfWeekDay SchedulesSupportedPerUser attribute Error: %@", err); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + VerifyOrReturn( + CheckConstraintMinValue("numberOfWeekDaySchedulesSupportedPerUser", [value unsignedCharValue], 0U)); + VerifyOrReturn( + CheckConstraintMaxValue("numberOfWeekDaySchedulesSupportedPerUser", [value unsignedCharValue], 255U)); + { + NumberOfWeekDaySchedulesSupportedPerUser = value; + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } + NSNumber * _Nonnull NumberOfTotalUsersSupported; - CHIP_ERROR TestPreconditionVerifyCreatedPinCredential_4() + CHIP_ERROR TestStep2ThReadsNumberOfTotalUsersSupportedAttribute_4() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Precondition: Verify created PIN credential Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2: TH reads NumberOfTotalUsers Supported attribute Error: %@", err); - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65534U)); + { + NumberOfTotalUsersSupported = value; + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1aThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5() + CHIP_ERROR TestStep3ThSendSetWeekDayScheduleCommand_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:false]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1a: TH writes the RequirePINforRemoteOperation " - @"attribute value as False on the DUT Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterSetWeekDayScheduleParams alloc] init]; + params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.daysMask = [NSNumber numberWithUnsignedChar:2U]; + params.startHour = [NSNumber numberWithUnsignedChar:15U]; + params.startMinute = [NSNumber numberWithUnsignedChar:45U]; + params.endHour = [NSNumber numberWithUnsignedChar:16U]; + params.endMinute = [NSNumber numberWithUnsignedChar:55U]; + [cluster setWeekDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 3: TH send Set Week Day Schedule Command Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestStep1bThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDutAndVerifyDutRespondsWithUnsupportedWrite_6() + CHIP_ERROR TestStep4ThSendGetWeekDayScheduleCommandToDut_6() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:false]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1b: TH writes the RequirePINforRemoteOperation " - @"attribute value as False on the DUT and Verify DUT responds " - @"with UNSUPPORTED_WRITE Error: %@", - err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } + __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; + params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster + getWeekDayScheduleWithParams:params + completion:^( + MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 4: TH send Get Week Day Schedule Command to DUT Error: %@", err); - CHIP_ERROR TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7() - { + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.weekDayIndex; + VerifyOrReturn(CheckValue("WeekDayIndex", actualValue, 1U)); + } - [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, false)); - } + { + id actualValue = values.daysMask; + VerifyOrReturn(CheckValue("DaysMask", actualValue, 2U)); + } - NextTest(); - }]; + { + id actualValue = values.startHour; + VerifyOrReturn(CheckValue("StartHour", actualValue, 15U)); + } - return CHIP_NO_ERROR; - } + { + id actualValue = values.startMinute; + VerifyOrReturn(CheckValue("StartMinute", actualValue, 45U)); + } - CHIP_ERROR TestStep3ThSendsTheUnlockDoorCommandToTheDutWithoutPINCode_8() - { + VerifyOrReturn(CheckConstraintHasValue("endHour", values.endHour, true)); + if (values.endHour != nil) { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturn( + CheckConstraintMinValue("endHour", [values.endHour unsignedCharValue], 16U)); + } - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 3: TH sends the unlock Door command to the DUT without PINCode Error: %@", err); + VerifyOrReturn(CheckConstraintHasValue("endMinute", values.endMinute, true)); + if (values.endMinute != nil) { - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn( + CheckConstraintMinValue("endMinute", [values.endMinute unsignedCharValue], 55U)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4ThSendsTheUnlockDoorCommandToTheDutWithValidPINCode_9() + CHIP_ERROR TestStep5ThSendSetWeekDayScheduleCommand_7() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 4: TH sends the unlock Door command to the DUT with valid PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRDoorLockClusterSetWeekDayScheduleParams alloc] init]; + params.weekDayIndex = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.daysMask = [NSNumber numberWithUnsignedChar:7U]; + params.startHour = [NSNumber numberWithUnsignedChar:15U]; + params.startMinute = [NSNumber numberWithUnsignedChar:45U]; + params.endHour = [NSNumber numberWithUnsignedChar:16U]; + params.endMinute = [NSNumber numberWithUnsignedChar:55U]; + [cluster setWeekDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 5: TH send Set Week Day Schedule Command Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_INVALID_COMMAND)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep5aThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_10() + CHIP_ERROR TestStep6ThSendGetWeekDayScheduleCommandToDut_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:true]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5a: TH writes the RequirePINforRemoteOperation " - @"attribute value as False on the DUT Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR - TestStep5bThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDutAndVerifyDutRespondsWithUnsupportedWrite_11() - { + __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; + params.weekDayIndex = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster getWeekDayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 6: TH send Get Week Day Schedule Command to DUT Error: %@", err); - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:true]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5b: TH writes the RequirePINforRemoteOperation " - @"attribute value as False on the DUT and Verify DUT responds " - @"with UNSUPPORTED_WRITE Error: %@", - err); + { + id actualValue = values.weekDayIndex; + VerifyOrReturn(CheckValue("WeekDayIndex", actualValue, 0U)); + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - return CHIP_NO_ERROR; - } + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 133U)); + } - CHIP_ERROR TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12() - { + VerifyOrReturn(CheckConstraintHasValue("daysMask", values.daysMask, false)); + if (values.daysMask != nil) { + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturn(CheckConstraintHasValue("startHour", values.startHour, false)); + if (values.startHour != nil) { + } - [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); + VerifyOrReturn(CheckConstraintHasValue("startMinute", values.startMinute, false)); + if (values.startMinute != nil) { + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckConstraintHasValue("endHour", values.endHour, false)); + if (values.endHour != nil) { + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, true)); - } + VerifyOrReturn(CheckConstraintHasValue("endMinute", values.endMinute, false)); + if (values.endMinute != nil) { + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7ThSendsTheUnlockDoorCommandToTheDutWithValidPINCode_13() + CHIP_ERROR TestStep7ThSendsClearWeekDayScheduleCommandToDut_9() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 7: TH sends the unlock Door command to the DUT with valid PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep8ThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_14() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + __auto_type * params = [[MTRDoorLockClusterClearWeekDayScheduleParams alloc] init]; + params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster clearWeekDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 7: TH sends Clear Week Day Schedule Command to DUT Error: %@", err); - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"1234568" length:7]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 8: TH sends the unlock Door command to the DUT with invalid PINCode Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep9ThSendsTheUnlockDoorCommandToTheDutWithoutPINCode_15() + CHIP_ERROR TestStep8ThSendsGetWeekDayScheduleCommandToDut_10() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 9: TH sends the unlock Door command to the DUT without PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } + __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; + params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster getWeekDayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 8: TH sends Get Week Day Schedule Command to DUT Error: %@", err); - CHIP_ERROR TestStep10aThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDutAndVerifyThatTheDutSendsSuccessResponse_16() - { + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.weekDayIndex; + VerifyOrReturn(CheckValue("WeekDayIndex", actualValue, 1U)); + } - id wrongCodeEntryLimitArgument; - wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; - [cluster writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 10a: TH writes WrongCodeEntryLimit attribute value as 3 on the " - @"DUT and Verify that the DUT sends Success response Error: %@", - err); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); + } - NextTest(); - }]; + VerifyOrReturn(CheckConstraintHasValue("daysMask", values.daysMask, false)); + if (values.daysMask != nil) { + } - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintHasValue("startHour", values.startHour, false)); + if (values.startHour != nil) { + } - CHIP_ERROR TestStep10bThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDutAndVerifyDutRespondsWithUnsupportedWrite_17() - { + VerifyOrReturn(CheckConstraintHasValue("startMinute", values.startMinute, false)); + if (values.startMinute != nil) { + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturn(CheckConstraintHasValue("endHour", values.endHour, false)); + if (values.endHour != nil) { + } - id wrongCodeEntryLimitArgument; - wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; - [cluster writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 10b: TH writes WrongCodeEntryLimit attribute value as 3 on the " - @"DUT and verify DUT responds with UNSUPPORTED_WRITE Error: %@", - err); + VerifyOrReturn(CheckConstraintHasValue("endMinute", values.endMinute, false)); + if (values.endMinute != nil) { + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestStep11aThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_18() + CHIP_ERROR TestCleanupTheCreatedUser_11() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id userCodeTemporaryDisableTimeArgument; - userCodeTemporaryDisableTimeArgument = [NSNumber numberWithUnsignedChar:15U]; - [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:userCodeTemporaryDisableTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 11a: TH writes UserCodeTemporaryDisableTime attribute " - @"value as 15 Seconds on the DUT and Verify that the DUT sends " - @"Success response Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster clearUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Cleanup the created user Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR - TestStep11bThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_19() +class Test_TC_DRLK_2_6 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_DRLK_2_6() + : TestCommandBridge("Test_TC_DRLK_2_6") + , mTestIndex(0) { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id userCodeTemporaryDisableTimeArgument; - userCodeTemporaryDisableTimeArgument = [NSNumber numberWithUnsignedChar:15U]; - [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:userCodeTemporaryDisableTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 11b: TH writes UserCodeTemporaryDisableTime attribute " - @"value as 15 Seconds on the DUT and Verify that the DUT sends " - @"Success response Error: %@", - err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - CHIP_ERROR TestStep12aThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_20() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"1234568" length:7]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12a: TH sends the unlock Door command to the DUT with invalid PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } + ~Test_TC_DRLK_2_6() {} - CHIP_ERROR TestStep12bThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_21() + /////////// TestCommand Interface ///////// + void NextTest() override { + CHIP_ERROR err = CHIP_NO_ERROR; - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_6\n"); + } - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"1234568" length:7]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12b: TH sends the unlock Door command to the DUT with invalid PINCode Error: %@", err); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_6\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + Wait(); - return CHIP_NO_ERROR; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for commissionee\n"); + err = TestWaitForCommissionee_0(); + break; + case 1: + ChipLogProgress( + chipTool, " ***** Test Step 1 : Step 1: TH reads NumberOfHoliday SchedulesSupported and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F0b && DRLK.S.A0016")) { + NextTest(); + return; + } + err = TestStep1ThReadsNumberOfHolidaySchedulesSupportedAndSavesForFutureUse_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 2: Create Holiday schedule with 1 index\n"); + if (ShouldSkip("DRLK.S.F0b && DRLK.S.C11.Rsp")) { + NextTest(); + return; + } + err = TestStep2CreateHolidayScheduleWith1Index_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3a: Get Holiday Schedule with HolidayIndex as 1\n"); + if (ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx")) { + NextTest(); + return; + } + err = TestStep3aGetHolidayScheduleWithHolidayIndexAs1_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4: Create Holiday schedule with invalid operating mode\n"); + if (ShouldSkip("DRLK.S.C11.Rsp")) { + NextTest(); + return; + } + err = TestStep4CreateHolidayScheduleWithInvalidOperatingMode_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 5: Get Holiday Schedule with Invalid HolidayIndex 15.\n"); + if (ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx")) { + NextTest(); + return; + } + err = TestStep5GetHolidayScheduleWithInvalidHolidayIndex15_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 6: Get Holiday Schedule with the Non-scheduled HolidayIndex\n"); + if (ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx")) { + NextTest(); + return; + } + err = TestStep6GetHolidayScheduleWithTheNonScheduledHolidayIndex_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 7: Clear Holiday schedule with 1 index\n"); + if (ShouldSkip("DRLK.S.F0b && DRLK.S.C13.Rsp")) { + NextTest(); + return; + } + err = TestStep7ClearHolidayScheduleWith1Index_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 8: Make sure that holiday schedule was deleted\n"); + if (ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx")) { + NextTest(); + return; + } + err = TestStep8MakeSureThatHolidayScheduleWasDeleted_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Cleanup the created user\n"); + err = TestCleanupTheCreatedUser_9(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestStep12cThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_22() + void OnStatusUpdate(const chip::app::StatusIB & status) override { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"1234568" length:7]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12c: TH sends the unlock Door command to the DUT with invalid PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); } - CHIP_ERROR TestStep12dThSendsTheUnlockDoorCommandToTheDutWithInvalidPINCode_23() + chip::System::Clock::Timeout GetWaitDuration() const override { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 10; - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"1234568" length:7]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12d: TH sends the unlock Door command to the DUT with invalid PINCode Error: %@", err); + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + CHIP_ERROR TestWaitForCommissionee_0() + { - return CHIP_NO_ERROR; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); } + NSNumber * _Nonnull NumberOfHolidaySchedulesSupported; - CHIP_ERROR TestStep13ThReadsTheUserCodeTemporaryDisableTimeAttributeFromTheDutAndCheckAttributeIsTriggered_24() + CHIP_ERROR TestStep1ThReadsNumberOfHolidaySchedulesSupportedAndSavesForFutureUse_1() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 13: TH reads the UserCodeTemporaryDisableTime attribute from the DUT and check attribute is triggered " - @"Error: %@", - err); + [cluster readAttributeNumberOfHolidaySchedulesSupportedWithCompletion:^( + NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1: TH reads NumberOfHoliday SchedulesSupported and saves for future use. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckConstraintMinValue("numberOfHolidaySchedulesSupported", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("numberOfHolidaySchedulesSupported", [value unsignedCharValue], 255U)); { - id actualValue = value; - VerifyOrReturn(CheckValue("UserCodeTemporaryDisableTime", actualValue, 15U)); + NumberOfHolidaySchedulesSupported = value; } NextTest(); @@ -170267,248 +169512,228 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep14ThSendsTheUnlockDoorCommandToTheDutWithValidPINCode_25() + CHIP_ERROR TestStep2CreateHolidayScheduleWith1Index_2() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 14: TH sends the unlock Door command to the DUT with valid PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + __auto_type * params = [[MTRDoorLockClusterSetHolidayScheduleParams alloc] init]; + params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.localStartTime = [NSNumber numberWithUnsignedInt:20UL]; + params.localEndTime = [NSNumber numberWithUnsignedInt:30UL]; + params.operatingMode = [NSNumber numberWithUnsignedChar:0U]; + [cluster setHolidayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2: Create Holiday schedule with 1 index Error: %@", err); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - CHIP_ERROR TestWaitForUserCodeTemporaryDisableTimeExpires_26() - { + NextTest(); + }]; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 15000UL; - return WaitForMs("alpha", value); + return CHIP_NO_ERROR; } - CHIP_ERROR TestStep15aThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_27() + CHIP_ERROR TestStep3aGetHolidayScheduleWithHolidayIndexAs1_3() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 15a: TH writes AutoRelockTime attribute value as 10 seconds on the " - @"DUT Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep15bThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_28() - { + __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; + params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; + [cluster getHolidayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 3a: Get Holiday Schedule with HolidayIndex as 1 Error: %@", err); - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 15b: TH writes AutoRelockTime attribute value as 60 seconds on the " - @"DUT Error: %@", - err); + { + id actualValue = values.holidayIndex; + VerifyOrReturn(CheckValue("HolidayIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } - NextTest(); - }]; + { + id actualValue = values.localStartTime; + VerifyOrReturn(CheckValue("LocalStartTime", actualValue, 20UL)); + } - return CHIP_NO_ERROR; - } + { + id actualValue = values.localEndTime; + VerifyOrReturn(CheckValue("LocalEndTime", actualValue, 30UL)); + } - CHIP_ERROR TestStep15cThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_29() - { + if (values.localEndTime != nil) { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturn(CheckConstraintMinValue( + "localEndTime", [values.localEndTime unsignedIntValue], 21UL)); + } - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 15c: TH writes AutoRelockTime attribute value as 10 seconds on the " - @"DUT Error: %@", - err); + { + id actualValue = values.operatingMode; + VerifyOrReturn(CheckValue("OperatingMode", actualValue, 0U)); + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep15dThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_30() + CHIP_ERROR TestStep4CreateHolidayScheduleWithInvalidOperatingMode_4() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 15d: TH writes AutoRelockTime attribute value as 60 seconds on the " - @"DUT Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterSetHolidayScheduleParams alloc] init]; + params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.localStartTime = [NSNumber numberWithUnsignedInt:20UL]; + params.localEndTime = [NSNumber numberWithUnsignedInt:30UL]; + params.operatingMode = [NSNumber numberWithUnsignedChar:5U]; + [cluster setHolidayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 4: Create Holiday schedule with invalid operating mode Error: %@", err); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_INVALID_COMMAND)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep16aThReadsTheAutoRelockTimeAttributeFromTheDut_31() + CHIP_ERROR TestStep5GetHolidayScheduleWithInvalidHolidayIndex15_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 16a: TH reads the AutoRelockTime attribute from the DUT Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; + params.holidayIndex = [NSNumber numberWithUnsignedChar:15U]; + [cluster getHolidayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 5: Get Holiday Schedule with Invalid HolidayIndex 15. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("AutoRelockTime", actualValue, 10UL)); - } + { + id actualValue = values.holidayIndex; + VerifyOrReturn(CheckValue("HolidayIndex", actualValue, 15U)); + } - NextTest(); - }]; + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 133U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep16bThReadsTheAutoRelockTimeAttributeFromTheDut_32() + CHIP_ERROR TestStep6GetHolidayScheduleWithTheNonScheduledHolidayIndex_6() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 16b: TH reads the AutoRelockTime attribute from the DUT Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; + params.holidayIndex = [NSNumber numberWithUnsignedChar:10U]; + [cluster getHolidayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 6: Get Holiday Schedule with the Non-scheduled HolidayIndex Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("AutoRelockTime", actualValue, 60UL)); - } + { + id actualValue = values.holidayIndex; + VerifyOrReturn(CheckValue("HolidayIndex", actualValue, 10U)); + } - NextTest(); - }]; + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep17ThSendsTheUnlockDoorCommandToTheDutWithValidPINCodeAndVerifyThatDutSendsSuccessResponseToTheTh_33() + CHIP_ERROR TestStep7ClearHolidayScheduleWith1Index_7() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 17: TH sends the unlock Door command to the DUT with valid PINCode and Verify that DUT " - @"sends SUCCESS response to the TH Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterClearHolidayScheduleParams alloc] init]; + params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; + [cluster clearHolidayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 7: Clear Holiday schedule with 1 index Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWaitForAutoRelockTimeExpires_34() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestWaitForAutoRelockTimeExpires_35() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 60000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestStep18ThReadsLockStateAttribute_36() + CHIP_ERROR TestStep8MakeSureThatHolidayScheduleWasDeleted_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 18: TH reads LockState attribute Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; + params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; + [cluster getHolidayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 8: Make sure that holiday schedule was deleted Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); - } + { + id actualValue = values.holidayIndex; + VerifyOrReturn(CheckValue("HolidayIndex", actualValue, 1U)); + } - NextTest(); - }]; + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedUser_37() + CHIP_ERROR TestCleanupTheCreatedUser_9() { MTRBaseDevice * device = GetDevice("alpha"); @@ -170528,37 +169753,13 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - - CHIP_ERROR TestCleanTheCreatedCredential_38() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Clean the created credential Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } }; -class Test_TC_DRLK_2_4 : public TestCommandBridge { +class Test_TC_DRLK_2_7 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_4() - : TestCommandBridge("Test_TC_DRLK_2_4") + Test_TC_DRLK_2_7() + : TestCommandBridge("Test_TC_DRLK_2_7") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -170568,7 +169769,7 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DRLK_2_4() {} + ~Test_TC_DRLK_2_7() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -170576,11 +169777,11 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_4\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_7\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_4\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_7\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -170597,110 +169798,129 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Create new user\n"); - err = TestCreateNewUser_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Create new user\n"); + err = TestPreconditionCreateNewUser_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the user back and verify its fields\n"); - err = TestReadTheUserBackAndVerifyItsFields_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Read the user back and verify its fields\n"); + err = TestPreconditionReadTheUserBackAndVerifyItsFields_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Create new PIN credential and lock/unlock user\n"); - err = TestCreateNewPinCredentialAndLockUnlockUser_3(); + ChipLogProgress( + chipTool, " ***** Test Step 3 : Step 1: TH reads NumberOfYearDay SchedulesSupportedPerUser attribute\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.A0015")) { + NextTest(); + return; + } + err = TestStep1ThReadsNumberOfYearDaySchedulesSupportedPerUserAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Verify created PIN credential\n"); - err = TestVerifyCreatedPinCredential_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 2: TH reads NumberOfTotalUsers Supported attribute\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { + NextTest(); + return; + } + err = TestStep2ThReadsNumberOfTotalUsersSupportedAttribute_4(); break; case 5: - ChipLogProgress( - chipTool, " ***** Test Step 5 : Step 1a: TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 3: TH sends Set Year Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0e.Rsp")) { NextTest(); return; } - err = TestStep1aThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_5(); + err = TestStep3ThSendsSetYearDayScheduleCommandToDut_5(); break; case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Step 1b: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4a & 4b: TH sends Get Year Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { NextTest(); return; } - err = TestStep1bThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_6(); + err = TestStep4a4bThSendsGetYearDayScheduleCommandToDut_6(); break; case 7: - ChipLogProgress( - chipTool, " ***** Test Step 7 : Step 1c: TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY && !DRLK.S.A0023.Write")) { + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 5: TH send Set Year Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.C0e.Rsp")) { NextTest(); return; } - err = TestStep1cThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_7(); + err = TestStep5ThSendSetYearDayScheduleCommandToDut_7(); break; case 8: - ChipLogProgress( - chipTool, " ***** Test Step 8 : Step 1d: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP && !DRLK.S.A0023.Write")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 6: TH sends Get Year Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { NextTest(); return; } - err = TestStep1dThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_8(); + err = TestStep6ThSendsGetYearDayScheduleCommandToDut_8(); break; case 9: - ChipLogProgress( - chipTool, " ***** Test Step 9 : Step 2a: TH sends the Unlock with Timeout argument value as 10 seconds\n"); - if (ShouldSkip("DRLK.S.C03.Rsp && PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestStep2aThSendsTheUnlockWithTimeoutArgumentValueAs10Seconds_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 7a: Create a user with userIndex as 5\n"); + err = TestStep7aCreateAUserWithUserIndexAs5_9(); break; case 10: - ChipLogProgress( - chipTool, " ***** Test Step 10 : Step 2b: TH sends the Unlock with Timeout argument value as 60 seconds\n"); - if (ShouldSkip("DRLK.S.C03.Rsp && PICS_SKIP_SAMPLE_APP")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 7b: TH sends Get Year Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { NextTest(); return; } - err = TestStep2bThSendsTheUnlockWithTimeoutArgumentValueAs60Seconds_10(); + err = TestStep7bThSendsGetYearDayScheduleCommandToDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Wait for AutoRelockTime Expires\n"); - if (ShouldSkip("DRLK.S.C03.Rsp && PICS_SDK_CI_ONLY")) { + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 8: TH sends Clear Year Day Schedule to DUT\n"); + if (ShouldSkip("DRLK.S.C10.Rsp")) { NextTest(); return; } - err = TestWaitForAutoRelockTimeExpires_11(); + err = TestStep8ThSendsClearYearDayScheduleToDut_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait for AutoRelockTime Expires\n"); - if (ShouldSkip("DRLK.S.C03.Rsp && PICS_SKIP_SAMPLE_APP")) { + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 9: TH sends Get Year Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx && DRLK.S.C10.Rsp")) { NextTest(); return; } - err = TestWaitForAutoRelockTimeExpires_12(); + err = TestStep9ThSendsGetYearDayScheduleCommandToDut_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Step 2c: TH reads LockState attribute\n"); - if (ShouldSkip("DRLK.S.A0000 && DRLK.S.C03.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 10: TH sends Set Year Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.C0e.Rsp")) { NextTest(); return; } - err = TestStep2cThReadsLockStateAttribute_13(); + err = TestStep10ThSendsSetYearDayScheduleCommandToDut_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Cleanup the created user\n"); - err = TestCleanupTheCreatedUser_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 11: TH sends Get Year Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { + NextTest(); + return; + } + err = TestStep11ThSendsGetYearDayScheduleCommandToDut_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Clean the created credential\n"); - if (ShouldSkip("DRLK.S.C26.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 12: TH sends Clear Year Day Schedule to DUT\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp")) { NextTest(); return; } - err = TestCleanTheCreatedCredential_15(); + err = TestStep12ThSendsClearYearDayScheduleToDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Clear a year day schedule for the first user\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp")) { + NextTest(); + return; + } + err = TestClearAYearDayScheduleForTheFirstUser_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Cleanup the created user with UserIndex 1\n"); + err = TestCleanupTheCreatedUserWithUserIndex1_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Cleanup the created user with UserIndex 5\n"); + err = TestCleanupTheCreatedUserWithUserIndex5_18(); break; } @@ -170735,10 +169955,10 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); break; case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -170759,6 +169979,15 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; } @@ -170774,7 +170003,7 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; + const uint16_t mTestCount = 19; chip::Optional mNodeId; chip::Optional mCluster; @@ -170789,7 +170018,7 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestCreateNewUser_1() + CHIP_ERROR TestPreconditionCreateNewUser_1() { MTRBaseDevice * device = GetDevice("alpha"); @@ -170806,7 +170035,7 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; [cluster setUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Create new user Error: %@", err); + NSLog(@"Precondition: Create new user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -170816,7 +170045,7 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheUserBackAndVerifyItsFields_2() + CHIP_ERROR TestPreconditionReadTheUserBackAndVerifyItsFields_2() { MTRBaseDevice * device = GetDevice("alpha"); @@ -170827,7 +170056,7 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { params.userIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster getUserWithParams:params completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Read the user back and verify its fields Error: %@", err); + NSLog(@"Precondition: Read the user back and verify its fields Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -170894,293 +170123,480 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull NumberOfYearDaySchedulesSupportedPerUser; - CHIP_ERROR TestCreateNewPinCredentialAndLockUnlockUser_3() + CHIP_ERROR TestStep1ThReadsNumberOfYearDaySchedulesSupportedPerUserAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Create new PIN credential and lock/unlock user Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + [cluster readAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletion:^( + NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1: TH reads NumberOfYearDay SchedulesSupportedPerUser attribute Error: %@", err); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + VerifyOrReturn( + CheckConstraintMinValue("numberOfYearDaySchedulesSupportedPerUser", [value unsignedCharValue], 0U)); + VerifyOrReturn( + CheckConstraintMaxValue("numberOfYearDaySchedulesSupportedPerUser", [value unsignedCharValue], 255U)); + { + NumberOfYearDaySchedulesSupportedPerUser = value; + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } + NSNumber * _Nonnull NumberOfTotalUsersSupported; - CHIP_ERROR TestVerifyCreatedPinCredential_4() + CHIP_ERROR TestStep2ThReadsNumberOfTotalUsersSupportedAttribute_4() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Verify created PIN credential Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2: TH reads NumberOfTotalUsers Supported attribute Error: %@", err); - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65534U)); + { + NumberOfTotalUsersSupported = value; + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1aThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_5() + CHIP_ERROR TestStep3ThSendsSetYearDayScheduleCommandToDut_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1a: TH writes AutoRelockTime attribute value as 10 seconds on the DUT " - @"Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.localStartTime = [NSNumber numberWithUnsignedInt:960UL]; + params.localEndTime = [NSNumber numberWithUnsignedInt:1980UL]; + [cluster setYearDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 3: TH sends Set Year Day Schedule Command to DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1bThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_6() + CHIP_ERROR TestStep4a4bThSendsGetYearDayScheduleCommandToDut_6() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1b: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " - @"Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster getYearDayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 4a & 4b: TH sends Get Year Day Schedule Command to DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = values.yearDayIndex; + VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 1U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.localStartTime; + VerifyOrReturn(CheckValue("LocalStartTime", actualValue, 960UL)); + } + + { + id actualValue = values.localEndTime; + VerifyOrReturn(CheckValue("LocalEndTime", actualValue, 1980UL)); + } + + if (values.localEndTime != nil) { + + VerifyOrReturn(CheckConstraintMinValue( + "localEndTime", [values.localEndTime unsignedIntValue], 961UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1cThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_7() + CHIP_ERROR TestStep5ThSendSetYearDayScheduleCommandToDut_7() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1c: TH writes AutoRelockTime attribute value as 10 seconds on the DUT " - @"Error: %@", - err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + __auto_type * params = [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:15U]; + params.localStartTime = [NSNumber numberWithUnsignedInt:1020UL]; + params.localEndTime = [NSNumber numberWithUnsignedInt:2040UL]; + [cluster setYearDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 5: TH send Set Year Day Schedule Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_INVALID_COMMAND)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1dThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_8() + CHIP_ERROR TestStep6ThSendsGetYearDayScheduleCommandToDut_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1d: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " - @"Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:15U]; + [cluster getYearDayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 6: TH sends Get Year Day Schedule Command to DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.yearDayIndex; + VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 0U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 15U)); + } + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 133U)); + } + + VerifyOrReturn(CheckConstraintHasValue("localStartTime", values.localStartTime, false)); + if (values.localStartTime != nil) { + } + + VerifyOrReturn(CheckConstraintHasValue("localEndTime", values.localEndTime, false)); + if (values.localEndTime != nil) { + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep2aThSendsTheUnlockWithTimeoutArgumentValueAs10Seconds_9() + CHIP_ERROR TestStep7aCreateAUserWithUserIndexAs5_9() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnlockWithTimeoutParams alloc] init]; - params.timeout = [NSNumber numberWithUnsignedShort:10U]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster - unlockWithTimeoutWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 2a: TH sends the Unlock with Timeout argument value as 10 seconds Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:5U]; + params.userName = @"xxx"; + params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; + params.userStatus = [NSNumber numberWithUnsignedChar:1U]; + params.userType = [NSNumber numberWithUnsignedChar:0U]; + params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; + [cluster setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 7a: Create a user with userIndex as 5 Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep2bThSendsTheUnlockWithTimeoutArgumentValueAs60Seconds_10() + CHIP_ERROR TestStep7bThSendsGetYearDayScheduleCommandToDut_10() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnlockWithTimeoutParams alloc] init]; - params.timeout = [NSNumber numberWithUnsignedShort:60U]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster - unlockWithTimeoutWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 2b: TH sends the Unlock with Timeout argument value as 60 seconds Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NumberOfYearDaySchedulesSupportedPerUser copy]; + params.userIndex = [NSNumber numberWithUnsignedShort:5U]; + [cluster getYearDayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 7b: TH sends Get Year Day Schedule Command to DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = values.yearDayIndex; + VerifyOrReturn( + CheckValue("YearDayIndex", actualValue, NumberOfYearDaySchedulesSupportedPerUser)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 5U)); + } + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); + } + + VerifyOrReturn(CheckConstraintHasValue("localStartTime", values.localStartTime, false)); + if (values.localStartTime != nil) { + } + + VerifyOrReturn(CheckConstraintHasValue("localEndTime", values.localEndTime, false)); + if (values.localEndTime != nil) { + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWaitForAutoRelockTimeExpires_11() + CHIP_ERROR TestStep8ThSendsClearYearDayScheduleToDut_11() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 11000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster clearYearDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 8: TH sends Clear Year Day Schedule to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestWaitForAutoRelockTimeExpires_12() + CHIP_ERROR TestStep9ThSendsGetYearDayScheduleCommandToDut_12() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 70000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster getYearDayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 9: TH sends Get Year Day Schedule Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.yearDayIndex; + VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 1U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); + } + + VerifyOrReturn(CheckConstraintHasValue("localStartTime", values.localStartTime, false)); + if (values.localStartTime != nil) { + } + + VerifyOrReturn(CheckConstraintHasValue("localEndTime", values.localEndTime, false)); + if (values.localEndTime != nil) { + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestStep2cThReadsLockStateAttribute_13() + CHIP_ERROR TestStep10ThSendsSetYearDayScheduleCommandToDut_13() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 2c: TH reads LockState attribute Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.localStartTime = [NSNumber numberWithUnsignedInt:1080UL]; + params.localEndTime = [NSNumber numberWithUnsignedInt:2100UL]; + [cluster setYearDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 10: TH sends Set Year Day Schedule Command to DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); - } + NextTest(); + }]; - NextTest(); - }]; + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep11ThSendsGetYearDayScheduleCommandToDut_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster getYearDayScheduleWithParams:params + completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 11: TH sends Get Year Day Schedule Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.yearDayIndex; + VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 1U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.localStartTime; + VerifyOrReturn(CheckValue("LocalStartTime", actualValue, 1080UL)); + } + + { + id actualValue = values.localEndTime; + VerifyOrReturn(CheckValue("LocalEndTime", actualValue, 2100UL)); + } + + if (values.localEndTime != nil) { + + VerifyOrReturn(CheckConstraintMinValue( + "localEndTime", [values.localEndTime unsignedIntValue], 1081UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedUser_14() + CHIP_ERROR TestStep12ThSendsClearYearDayScheduleToDut_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:0U]; + [cluster + clearYearDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 12: TH sends Clear Year Day Schedule to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_INVALID_COMMAND)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestClearAYearDayScheduleForTheFirstUser_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster clearYearDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Clear a year day schedule for the first user Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex1_17() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171191,7 +170607,7 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { params.userIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster clearUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user Error: %@", err); + NSLog(@"Cleanup the created user with UserIndex 1 Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171201,36 +170617,33 @@ class Test_TC_DRLK_2_4 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanTheCreatedCredential_15() + CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex5_18() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Clean the created credential Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; + params.userIndex = [NSNumber numberWithUnsignedShort:5U]; + [cluster clearUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Cleanup the created user with UserIndex 5 Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } }; -class Test_TC_DRLK_2_5 : public TestCommandBridge { +class Test_TC_DRLK_2_8 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_5() - : TestCommandBridge("Test_TC_DRLK_2_5") + Test_TC_DRLK_2_8() + : TestCommandBridge("Test_TC_DRLK_2_8") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -171240,7 +170653,7 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DRLK_2_5() {} + ~Test_TC_DRLK_2_8() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -171248,11 +170661,11 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_5\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_8\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_5\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_8\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -171269,81 +170682,125 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Create new user\n"); - err = TestPreconditionCreateNewUser_1(); + ChipLogProgress(chipTool, + " ***** Test Step 1 : Step 1: TH reads NumberOfTotalUsers Supported attribute and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { + NextTest(); + return; + } + err = TestStep1ThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Read the user back and verify its fields\n"); - err = TestPreconditionReadTheUserBackAndVerifyItsFields_2(); + ChipLogProgress(chipTool, + " ***** Test Step 2 : Step 2: TH sends Set User Command to DUT with the following values: OperationType as 0 " + "UserIndex as 1 UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 0 CredentialRule as 0\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { + NextTest(); + return; + } + err = TestStep2ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs1UserNameAsXxxUserUniqueIDAs6452UserStatusAs1UserTypeAs0CredentialRuleAs0_2(); break; case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Step 1: TH reads NumberOfWeekDay SchedulesSupportedPerUser attribute\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.A0014")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3: TH sends Get User Command to DUT with UserIndex as 1\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { NextTest(); return; } - err = TestStep1ThReadsNumberOfWeekDaySchedulesSupportedPerUserAttribute_3(); + err = TestStep3ThSendsGetUserCommandToDutWithUserIndexAs1_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 2: TH reads NumberOfTotalUsers Supported attribute\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { + ChipLogProgress(chipTool, + " ***** Test Step 4 : Step 4: TH sends Set User Command to DUT with the following values: OperationType as 0 " + "UserIndex as 2 UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 10 (Invalid value) CredentialRule " + "as 3\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { NextTest(); return; } - err = TestStep2ThReadsNumberOfTotalUsersSupportedAttribute_4(); + err = TestStep4ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs2UserNameAsXxxUserUniqueIDAs6452UserStatusAs1UserTypeAs10InvalidValueCredentialRuleAs3_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 3: TH send Set Week Day Schedule Command\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0b.Rsp")) { + ChipLogProgress(chipTool, + " ***** Test Step 5 : Step 5: TH sends Set User Command to DUT with the following values: OperationType as 0 " + "UserIndex as 1 (Same as step 2) UserName as xxx UserUniqueID as 8965 UserStatus as 1 UserType as 0 CredentialRule " + "as 0\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { NextTest(); return; } - err = TestStep3ThSendSetWeekDayScheduleCommand_5(); + err = TestStep5ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs1SameAsStep2UserNameAsXxxUserUniqueIDAs8965UserStatusAs1UserTypeAs0CredentialRuleAs0_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4: TH send Get Week Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { + ChipLogProgress(chipTool, + " ***** Test Step 6 : Step 6a: TH sends Set User Command to DUT with the following values: OperationType as 0 " + "UserIndex as 2 UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL CredentialRule as " + "NULL\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { NextTest(); return; } - err = TestStep4ThSendGetWeekDayScheduleCommandToDut_6(); + err = TestStep6aThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs2UserNameAsNullUserUniqueIDAsNullUserStatusAsNullUserTypeAsNullCredentialRuleAsNull_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 5: TH send Set Week Day Schedule Command\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0b.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 6b: TH sends Get User Command to DUT with UserIndex as 2\n"); + if (ShouldSkip("DRLK.S.C1a.Rsp && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { NextTest(); return; } - err = TestStep5ThSendSetWeekDayScheduleCommand_7(); + err = TestStep6bThSendsGetUserCommandToDutWithUserIndexAs2_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 6: TH send Get Week Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { + ChipLogProgress(chipTool, + " ***** Test Step 8 : Step 7: TH sends Set User Command to DUT with the following values: OperationType as 2 " + "UserIndex as 2 UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL CredentialRule as " + "NULL\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { NextTest(); return; } - err = TestStep6ThSendGetWeekDayScheduleCommandToDut_8(); + err = TestStep7ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs2UserIndexAs2UserNameAsNullUserUniqueIDAsNullUserStatusAsNullUserTypeAsNullCredentialRuleAsNull_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 7: TH sends Clear Week Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0d.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 8: TH sends Get User Command to DUT with the UserIndex as 2\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { NextTest(); return; } - err = TestStep7ThSendsClearWeekDayScheduleCommandToDut_9(); + err = TestStep8ThSendsGetUserCommandToDutWithTheUserIndexAs2_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 8: TH sends Get Week Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 9: TH sends Clear User Command to DUT with the UserIndex as 1\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1d.Rsp")) { NextTest(); return; } - err = TestStep8ThSendsGetWeekDayScheduleCommandToDut_10(); + err = TestStep9ThSendsClearUserCommandToDutWithTheUserIndexAs1_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Cleanup the created user\n"); - err = TestCleanupTheCreatedUser_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 10: TH sends Get User Command to DUT with the UserIndex as 1\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { + NextTest(); + return; + } + err = TestStep10ThSendsGetUserCommandToDutWithTheUserIndexAs1_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Test cleanup: TH sends Clear User Command to DUT with the UserIndex as 2\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1d.Rsp")) { + NextTest(); + return; + } + err = TestTestCleanupThSendsClearUserCommandToDutWithTheUserIndexAs2_12(); + break; + case 13: + ChipLogProgress( + chipTool, " ***** Test Step 13 : Test cleanup: TH sends Get User Command to DUT with the UserIndex as 2\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { + NextTest(); + return; + } + err = TestTestCleanupThSendsGetUserCommandToDutWithTheUserIndexAs2_13(); break; } @@ -171369,16 +170826,18 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); break; case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + VerifyOrReturn(CheckValue("clusterStatus present", status.mClusterStatus.HasValue(), true)); + VerifyOrReturn(CheckValue("clusterStatus value", status.mClusterStatus.Value(), 3)); break; case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -171392,6 +170851,12 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -171405,7 +170870,7 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 14; chip::Optional mNodeId; chip::Optional mCluster; @@ -171419,8 +170884,34 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; return WaitForCommissionee("alpha", value); } + NSNumber * _Nonnull Current_NumberOfTotalUsersSupported; - CHIP_ERROR TestPreconditionCreateNewUser_1() + CHIP_ERROR TestStep1ThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1: TH reads NumberOfTotalUsers Supported attribute and saves for future use. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65534U)); + { + Current_NumberOfTotalUsersSupported = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestStep2ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs1UserNameAsXxxUserUniqueIDAs6452UserStatusAs1UserTypeAs0CredentialRuleAs0_2() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171435,19 +170926,22 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { params.userStatus = [NSNumber numberWithUnsignedChar:1U]; params.userType = [NSNumber numberWithUnsignedChar:0U]; params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; - [cluster setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Precondition: Create new user Error: %@", err); + [cluster + setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as " + @"1 UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 0 CredentialRule as 0 Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionReadTheUserBackAndVerifyItsFields_2() + CHIP_ERROR TestStep3ThSendsGetUserCommandToDutWithUserIndexAs1_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171458,7 +170952,7 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { params.userIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster getUserWithParams:params completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Precondition: Read the user back and verify its fields Error: %@", err); + NSLog(@"Step 3: TH sends Get User Command to DUT with UserIndex as 1 Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171525,324 +171019,385 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { return CHIP_NO_ERROR; } - NSNumber * _Nonnull NumberOfWeekDaySchedulesSupportedPerUser; - CHIP_ERROR TestStep1ThReadsNumberOfWeekDaySchedulesSupportedPerUserAttribute_3() + CHIP_ERROR + TestStep4ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs2UserNameAsXxxUserUniqueIDAs6452UserStatusAs1UserTypeAs10InvalidValueCredentialRuleAs3_4() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1: TH reads NumberOfWeekDay SchedulesSupportedPerUser attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn( - CheckConstraintMinValue("numberOfWeekDaySchedulesSupportedPerUser", [value unsignedCharValue], 0U)); - VerifyOrReturn( - CheckConstraintMaxValue("numberOfWeekDaySchedulesSupportedPerUser", [value unsignedCharValue], 255U)); - { - NumberOfWeekDaySchedulesSupportedPerUser = value; - } + __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + params.userName = @"xxx"; + params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; + params.userStatus = [NSNumber numberWithUnsignedChar:1U]; + params.userType = [NSNumber numberWithUnsignedChar:10U]; + params.credentialRule = [NSNumber numberWithUnsignedChar:3U]; + [cluster + setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 4: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as " + @"2 UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 10 (Invalid value) " + @"CredentialRule as 3 Error: %@", + err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) : 0, + EMBER_ZCL_STATUS_INVALID_COMMAND)); + NextTest(); + }]; return CHIP_NO_ERROR; } - NSNumber * _Nonnull NumberOfTotalUsersSupported; - CHIP_ERROR TestStep2ThReadsNumberOfTotalUsersSupportedAttribute_4() + CHIP_ERROR + TestStep5ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs1SameAsStep2UserNameAsXxxUserUniqueIDAs8965UserStatusAs1UserTypeAs0CredentialRuleAs0_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 2: TH reads NumberOfTotalUsers Supported attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65534U)); - { - NumberOfTotalUsersSupported = value; - } + __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userName = @"xxx"; + params.userUniqueID = [NSNumber numberWithUnsignedInt:8965UL]; + params.userStatus = [NSNumber numberWithUnsignedChar:1U]; + params.userType = [NSNumber numberWithUnsignedChar:0U]; + params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; + [cluster + setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 5: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as " + @"1 (Same as step 2) UserName as xxx UserUniqueID as 8965 UserStatus as 1 UserType as 0 " + @"CredentialRule as 0 Error: %@", + err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3ThSendSetWeekDayScheduleCommand_5() + CHIP_ERROR + TestStep6aThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs2UserNameAsNullUserUniqueIDAsNullUserStatusAsNullUserTypeAsNullCredentialRuleAsNull_6() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetWeekDayScheduleParams alloc] init]; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.daysMask = [NSNumber numberWithUnsignedChar:2U]; - params.startHour = [NSNumber numberWithUnsignedChar:15U]; - params.startMinute = [NSNumber numberWithUnsignedChar:45U]; - params.endHour = [NSNumber numberWithUnsignedChar:16U]; - params.endMinute = [NSNumber numberWithUnsignedChar:55U]; - [cluster setWeekDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 3: TH send Set Week Day Schedule Command Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + params.userName = nil; + params.userUniqueID = nil; + params.userStatus = nil; + params.userType = nil; + params.credentialRule = nil; + [cluster setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 6a: TH sends Set User Command to DUT with the following values: OperationType as 0 " + @"UserIndex as 2 UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL " + @"CredentialRule as NULL Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4ThSendGetWeekDayScheduleCommandToDut_6() + CHIP_ERROR TestStep6bThSendsGetUserCommandToDutWithUserIndexAs2_7() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster - getWeekDayScheduleWithParams:params - completion:^( - MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 4: TH send Get Week Day Schedule Command to DUT Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + [cluster getUserWithParams:params + completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 6b: TH sends Get User Command to DUT with UserIndex as 2 Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.weekDayIndex; - VerifyOrReturn(CheckValue("WeekDayIndex", actualValue, 1U)); - } + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + { + id actualValue = values.userName; + VerifyOrReturn(CheckValueNonNull("UserName", actualValue)); + VerifyOrReturn(CheckValueAsString("UserName", actualValue, @"")); + } - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + { + id actualValue = values.userUniqueID; + VerifyOrReturn(CheckValueNull("UserUniqueID", actualValue)); + } - { - id actualValue = values.daysMask; - VerifyOrReturn(CheckValue("DaysMask", actualValue, 2U)); - } + { + id actualValue = values.userStatus; + VerifyOrReturn(CheckValueNonNull("UserStatus", actualValue)); + VerifyOrReturn(CheckValue("UserStatus", actualValue, 1U)); + } - { - id actualValue = values.startHour; - VerifyOrReturn(CheckValue("StartHour", actualValue, 15U)); - } + { + id actualValue = values.userType; + VerifyOrReturn(CheckValueNonNull("UserType", actualValue)); + VerifyOrReturn(CheckValue("UserType", actualValue, 0U)); + } - { - id actualValue = values.startMinute; - VerifyOrReturn(CheckValue("StartMinute", actualValue, 45U)); - } + { + id actualValue = values.credentialRule; + VerifyOrReturn(CheckValueNonNull("CredentialRule", actualValue)); + VerifyOrReturn(CheckValue("CredentialRule", actualValue, 0U)); + } - VerifyOrReturn(CheckConstraintHasValue("endHour", values.endHour, true)); - if (values.endHour != nil) { + { + id actualValue = values.credentials; + VerifyOrReturn(CheckValueNonNull("Credentials", actualValue)); + VerifyOrReturn(CheckValue("Credentials", [actualValue count], static_cast(0))); + } - VerifyOrReturn( - CheckConstraintMinValue("endHour", [values.endHour unsignedCharValue], 16U)); - } + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckConstraintHasValue("endMinute", values.endMinute, true)); - if (values.endMinute != nil) { + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - VerifyOrReturn( - CheckConstraintMinValue("endMinute", [values.endMinute unsignedCharValue], 55U)); - } + { + id actualValue = values.nextUserIndex; + VerifyOrReturn(CheckValueNull("NextUserIndex", actualValue)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep5ThSendSetWeekDayScheduleCommand_7() + CHIP_ERROR + TestStep7ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs2UserIndexAs2UserNameAsNullUserUniqueIDAsNullUserStatusAsNullUserTypeAsNullCredentialRuleAsNull_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetWeekDayScheduleParams alloc] init]; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.daysMask = [NSNumber numberWithUnsignedChar:7U]; - params.startHour = [NSNumber numberWithUnsignedChar:15U]; - params.startMinute = [NSNumber numberWithUnsignedChar:45U]; - params.endHour = [NSNumber numberWithUnsignedChar:16U]; - params.endMinute = [NSNumber numberWithUnsignedChar:55U]; - [cluster setWeekDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5: TH send Set Week Day Schedule Command Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:2U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + params.userName = nil; + params.userUniqueID = nil; + params.userStatus = nil; + params.userType = nil; + params.credentialRule = nil; + [cluster setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 7: TH sends Set User Command to DUT with the following values: OperationType as 2 " + @"UserIndex as 2 UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL " + @"CredentialRule as NULL Error: %@", + err); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6ThSendGetWeekDayScheduleCommandToDut_8() + CHIP_ERROR TestStep8ThSendsGetUserCommandToDutWithTheUserIndexAs2_9() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getWeekDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 6: TH send Get Week Day Schedule Command to DUT Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + [cluster getUserWithParams:params + completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 8: TH sends Get User Command to DUT with the UserIndex as 2 Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.weekDayIndex; - VerifyOrReturn(CheckValue("WeekDayIndex", actualValue, 0U)); - } + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + { + id actualValue = values.userName; + VerifyOrReturn(CheckValueNonNull("UserName", actualValue)); + VerifyOrReturn(CheckValueAsString("UserName", actualValue, @"")); + } - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 133U)); - } + { + id actualValue = values.userUniqueID; + VerifyOrReturn(CheckValueNull("UserUniqueID", actualValue)); + } - VerifyOrReturn(CheckConstraintHasValue("daysMask", values.daysMask, false)); - if (values.daysMask != nil) { - } + { + id actualValue = values.userStatus; + VerifyOrReturn(CheckValueNonNull("UserStatus", actualValue)); + VerifyOrReturn(CheckValue("UserStatus", actualValue, 1U)); + } - VerifyOrReturn(CheckConstraintHasValue("startHour", values.startHour, false)); - if (values.startHour != nil) { - } + { + id actualValue = values.userType; + VerifyOrReturn(CheckValueNonNull("UserType", actualValue)); + VerifyOrReturn(CheckValue("UserType", actualValue, 0U)); + } - VerifyOrReturn(CheckConstraintHasValue("startMinute", values.startMinute, false)); - if (values.startMinute != nil) { - } + { + id actualValue = values.credentialRule; + VerifyOrReturn(CheckValueNonNull("CredentialRule", actualValue)); + VerifyOrReturn(CheckValue("CredentialRule", actualValue, 0U)); + } - VerifyOrReturn(CheckConstraintHasValue("endHour", values.endHour, false)); - if (values.endHour != nil) { - } + { + id actualValue = values.credentials; + VerifyOrReturn(CheckValueNonNull("Credentials", actualValue)); + VerifyOrReturn(CheckValue("Credentials", [actualValue count], static_cast(0))); + } - VerifyOrReturn(CheckConstraintHasValue("endMinute", values.endMinute, false)); - if (values.endMinute != nil) { - } + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - NextTest(); - }]; + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.nextUserIndex; + VerifyOrReturn(CheckValueNull("NextUserIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7ThSendsClearWeekDayScheduleCommandToDut_9() + CHIP_ERROR TestStep9ThSendsClearUserCommandToDutWithTheUserIndexAs1_10() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterClearWeekDayScheduleParams alloc] init]; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; + __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearWeekDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 7: TH sends Clear Week Day Schedule Command to DUT Error: %@", err); + [cluster clearUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 9: TH sends Clear User Command to DUT with the UserIndex as 1 Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep8ThSendsGetWeekDayScheduleCommandToDut_10() + CHIP_ERROR TestStep10ThSendsGetUserCommandToDutWithTheUserIndexAs1_11() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; - params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; + __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getWeekDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 8: TH sends Get Week Day Schedule Command to DUT Error: %@", err); + [cluster getUserWithParams:params + completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 10: TH sends Get User Command to DUT with the UserIndex as 1 Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.weekDayIndex; - VerifyOrReturn(CheckValue("WeekDayIndex", actualValue, 1U)); - } + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + { + id actualValue = values.userName; + VerifyOrReturn(CheckValueNull("UserName", actualValue)); + } - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 139U)); - } + { + id actualValue = values.userUniqueID; + VerifyOrReturn(CheckValueNull("UserUniqueID", actualValue)); + } - VerifyOrReturn(CheckConstraintHasValue("daysMask", values.daysMask, false)); - if (values.daysMask != nil) { - } + { + id actualValue = values.userStatus; + VerifyOrReturn(CheckValueNull("UserStatus", actualValue)); + } - VerifyOrReturn(CheckConstraintHasValue("startHour", values.startHour, false)); - if (values.startHour != nil) { - } + { + id actualValue = values.userType; + VerifyOrReturn(CheckValueNull("UserType", actualValue)); + } - VerifyOrReturn(CheckConstraintHasValue("startMinute", values.startMinute, false)); - if (values.startMinute != nil) { - } + { + id actualValue = values.credentialRule; + VerifyOrReturn(CheckValueNull("CredentialRule", actualValue)); + } - VerifyOrReturn(CheckConstraintHasValue("endHour", values.endHour, false)); - if (values.endHour != nil) { - } + { + id actualValue = values.credentials; + VerifyOrReturn(CheckValueNull("Credentials", actualValue)); + } - VerifyOrReturn(CheckConstraintHasValue("endMinute", values.endMinute, false)); - if (values.endMinute != nil) { - } + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + } - NextTest(); - }]; + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + } + + { + id actualValue = values.nextUserIndex; + VerifyOrReturn(CheckValueNonNull("NextUserIndex", actualValue)); + VerifyOrReturn(CheckValue("NextUserIndex", actualValue, 2U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedUser_11() + CHIP_ERROR TestTestCleanupThSendsClearUserCommandToDutWithTheUserIndexAs2_12() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171850,10 +171405,10 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; [cluster clearUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user Error: %@", err); + NSLog(@"Test cleanup: TH sends Clear User Command to DUT with the UserIndex as 2 Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171862,2618 +171417,65 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { return CHIP_NO_ERROR; } -}; -class Test_TC_DRLK_2_6 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_6() - : TestCommandBridge("Test_TC_DRLK_2_6") - , mTestIndex(0) + CHIP_ERROR TestTestCleanupThSendsGetUserCommandToDutWithTheUserIndexAs2_13() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_DRLK_2_6() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_6\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for commissionee\n"); - err = TestWaitForCommissionee_0(); - break; - case 1: - ChipLogProgress( - chipTool, " ***** Test Step 1 : Step 1: TH reads NumberOfHoliday SchedulesSupported and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F0b && DRLK.S.A0016")) { - NextTest(); - return; - } - err = TestStep1ThReadsNumberOfHolidaySchedulesSupportedAndSavesForFutureUse_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Step 2: Create Holiday schedule with 1 index\n"); - if (ShouldSkip("DRLK.S.F0b && DRLK.S.C11.Rsp")) { - NextTest(); - return; - } - err = TestStep2CreateHolidayScheduleWith1Index_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3a: Get Holiday Schedule with HolidayIndex as 1\n"); - if (ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx")) { - NextTest(); - return; - } - err = TestStep3aGetHolidayScheduleWithHolidayIndexAs1_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4: Create Holiday schedule with invalid operating mode\n"); - if (ShouldSkip("DRLK.S.C11.Rsp")) { - NextTest(); - return; - } - err = TestStep4CreateHolidayScheduleWithInvalidOperatingMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 5: Get Holiday Schedule with Invalid HolidayIndex 15.\n"); - if (ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx")) { - NextTest(); - return; - } - err = TestStep5GetHolidayScheduleWithInvalidHolidayIndex15_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 6: Get Holiday Schedule with the Non-scheduled HolidayIndex\n"); - if (ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx")) { - NextTest(); - return; - } - err = TestStep6GetHolidayScheduleWithTheNonScheduledHolidayIndex_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 7: Clear Holiday schedule with 1 index\n"); - if (ShouldSkip("DRLK.S.F0b && DRLK.S.C13.Rsp")) { - NextTest(); - return; - } - err = TestStep7ClearHolidayScheduleWith1Index_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 8: Make sure that holiday schedule was deleted\n"); - if (ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx")) { - NextTest(); - return; - } - err = TestStep8MakeSureThatHolidayScheduleWasDeleted_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Cleanup the created user\n"); - err = TestCleanupTheCreatedUser_9(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForCommissionee_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - NSNumber * _Nonnull NumberOfHolidaySchedulesSupported; - - CHIP_ERROR TestStep1ThReadsNumberOfHolidaySchedulesSupportedAndSavesForFutureUse_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeNumberOfHolidaySchedulesSupportedWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1: TH reads NumberOfHoliday SchedulesSupported and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("numberOfHolidaySchedulesSupported", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfHolidaySchedulesSupported", [value unsignedCharValue], 255U)); - { - NumberOfHolidaySchedulesSupported = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2CreateHolidayScheduleWith1Index_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetHolidayScheduleParams alloc] init]; - params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.localStartTime = [NSNumber numberWithUnsignedInt:20UL]; - params.localEndTime = [NSNumber numberWithUnsignedInt:30UL]; - params.operatingMode = [NSNumber numberWithUnsignedChar:0U]; - [cluster setHolidayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 2: Create Holiday schedule with 1 index Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3aGetHolidayScheduleWithHolidayIndexAs1_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; - params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; - [cluster getHolidayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 3a: Get Holiday Schedule with HolidayIndex as 1 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.holidayIndex; - VerifyOrReturn(CheckValue("HolidayIndex", actualValue, 1U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.localStartTime; - VerifyOrReturn(CheckValue("LocalStartTime", actualValue, 20UL)); - } - - { - id actualValue = values.localEndTime; - VerifyOrReturn(CheckValue("LocalEndTime", actualValue, 30UL)); - } - - if (values.localEndTime != nil) { - - VerifyOrReturn(CheckConstraintMinValue( - "localEndTime", [values.localEndTime unsignedIntValue], 21UL)); - } - - { - id actualValue = values.operatingMode; - VerifyOrReturn(CheckValue("OperatingMode", actualValue, 0U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4CreateHolidayScheduleWithInvalidOperatingMode_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetHolidayScheduleParams alloc] init]; - params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.localStartTime = [NSNumber numberWithUnsignedInt:20UL]; - params.localEndTime = [NSNumber numberWithUnsignedInt:30UL]; - params.operatingMode = [NSNumber numberWithUnsignedChar:5U]; - [cluster setHolidayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 4: Create Holiday schedule with invalid operating mode Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5GetHolidayScheduleWithInvalidHolidayIndex15_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; - params.holidayIndex = [NSNumber numberWithUnsignedChar:15U]; - [cluster getHolidayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 5: Get Holiday Schedule with Invalid HolidayIndex 15. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.holidayIndex; - VerifyOrReturn(CheckValue("HolidayIndex", actualValue, 15U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 133U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep6GetHolidayScheduleWithTheNonScheduledHolidayIndex_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; - params.holidayIndex = [NSNumber numberWithUnsignedChar:10U]; - [cluster getHolidayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 6: Get Holiday Schedule with the Non-scheduled HolidayIndex Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.holidayIndex; - VerifyOrReturn(CheckValue("HolidayIndex", actualValue, 10U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 139U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep7ClearHolidayScheduleWith1Index_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearHolidayScheduleParams alloc] init]; - params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; - [cluster clearHolidayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 7: Clear Holiday schedule with 1 index Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep8MakeSureThatHolidayScheduleWasDeleted_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; - params.holidayIndex = [NSNumber numberWithUnsignedChar:1U]; - [cluster getHolidayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 8: Make sure that holiday schedule was deleted Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.holidayIndex; - VerifyOrReturn(CheckValue("HolidayIndex", actualValue, 1U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 139U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCleanupTheCreatedUser_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_7 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_7() - : TestCommandBridge("Test_TC_DRLK_2_7") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_DRLK_2_7() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_7\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Create new user\n"); - err = TestPreconditionCreateNewUser_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Read the user back and verify its fields\n"); - err = TestPreconditionReadTheUserBackAndVerifyItsFields_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Step 1: TH reads NumberOfYearDay SchedulesSupportedPerUser attribute\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.A0015")) { - NextTest(); - return; - } - err = TestStep1ThReadsNumberOfYearDaySchedulesSupportedPerUserAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 2: TH reads NumberOfTotalUsers Supported attribute\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { - NextTest(); - return; - } - err = TestStep2ThReadsNumberOfTotalUsersSupportedAttribute_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 3: TH sends Set Year Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0e.Rsp")) { - NextTest(); - return; - } - err = TestStep3ThSendsSetYearDayScheduleCommandToDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4a & 4b: TH sends Get Year Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { - NextTest(); - return; - } - err = TestStep4a4bThSendsGetYearDayScheduleCommandToDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 5: TH send Set Year Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.C0e.Rsp")) { - NextTest(); - return; - } - err = TestStep5ThSendSetYearDayScheduleCommandToDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 6: TH sends Get Year Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { - NextTest(); - return; - } - err = TestStep6ThSendsGetYearDayScheduleCommandToDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 7a: Create a user with userIndex as 5\n"); - err = TestStep7aCreateAUserWithUserIndexAs5_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 7b: TH sends Get Year Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { - NextTest(); - return; - } - err = TestStep7bThSendsGetYearDayScheduleCommandToDut_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Step 8: TH sends Clear Year Day Schedule to DUT\n"); - if (ShouldSkip("DRLK.S.C10.Rsp")) { - NextTest(); - return; - } - err = TestStep8ThSendsClearYearDayScheduleToDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Step 9: TH sends Get Year Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx && DRLK.S.C10.Rsp")) { - NextTest(); - return; - } - err = TestStep9ThSendsGetYearDayScheduleCommandToDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Step 10: TH sends Set Year Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.C0e.Rsp")) { - NextTest(); - return; - } - err = TestStep10ThSendsSetYearDayScheduleCommandToDut_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Step 11: TH sends Get Year Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { - NextTest(); - return; - } - err = TestStep11ThSendsGetYearDayScheduleCommandToDut_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Step 12: TH sends Clear Year Day Schedule to DUT\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp")) { - NextTest(); - return; - } - err = TestStep12ThSendsClearYearDayScheduleToDut_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Clear a year day schedule for the first user\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp")) { - NextTest(); - return; - } - err = TestClearAYearDayScheduleForTheFirstUser_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Cleanup the created user with UserIndex 1\n"); - err = TestCleanupTheCreatedUserWithUserIndex1_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Cleanup the created user with UserIndex 5\n"); - err = TestCleanupTheCreatedUserWithUserIndex5_18(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestPreconditionCreateNewUser_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userName = @"xxx"; - params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; - params.userStatus = [NSNumber numberWithUnsignedChar:1U]; - params.userType = [NSNumber numberWithUnsignedChar:0U]; - params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; - [cluster setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Precondition: Create new user Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestPreconditionReadTheUserBackAndVerifyItsFields_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getUserWithParams:params - completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Precondition: Read the user back and verify its fields Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.userName; - VerifyOrReturn(CheckValueNonNull("UserName", actualValue)); - VerifyOrReturn(CheckValueAsString("UserName", actualValue, @"xxx")); - } - - { - id actualValue = values.userUniqueID; - VerifyOrReturn(CheckValueNonNull("UserUniqueID", actualValue)); - VerifyOrReturn(CheckValue("UserUniqueID", actualValue, 6452UL)); - } - - { - id actualValue = values.userStatus; - VerifyOrReturn(CheckValueNonNull("UserStatus", actualValue)); - VerifyOrReturn(CheckValue("UserStatus", actualValue, 1U)); - } - - { - id actualValue = values.userType; - VerifyOrReturn(CheckValueNonNull("UserType", actualValue)); - VerifyOrReturn(CheckValue("UserType", actualValue, 0U)); - } - - { - id actualValue = values.credentialRule; - VerifyOrReturn(CheckValueNonNull("CredentialRule", actualValue)); - VerifyOrReturn(CheckValue("CredentialRule", actualValue, 0U)); - } - - { - id actualValue = values.credentials; - VerifyOrReturn(CheckValueNonNull("Credentials", actualValue)); - VerifyOrReturn(CheckValue("Credentials", [actualValue count], static_cast(0))); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNull("NextUserIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - NSNumber * _Nonnull NumberOfYearDaySchedulesSupportedPerUser; - - CHIP_ERROR TestStep1ThReadsNumberOfYearDaySchedulesSupportedPerUserAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletion:^( - NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1: TH reads NumberOfYearDay SchedulesSupportedPerUser attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn( - CheckConstraintMinValue("numberOfYearDaySchedulesSupportedPerUser", [value unsignedCharValue], 0U)); - VerifyOrReturn( - CheckConstraintMaxValue("numberOfYearDaySchedulesSupportedPerUser", [value unsignedCharValue], 255U)); - { - NumberOfYearDaySchedulesSupportedPerUser = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - NSNumber * _Nonnull NumberOfTotalUsersSupported; - - CHIP_ERROR TestStep2ThReadsNumberOfTotalUsersSupportedAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 2: TH reads NumberOfTotalUsers Supported attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65534U)); - { - NumberOfTotalUsersSupported = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3ThSendsSetYearDayScheduleCommandToDut_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.localStartTime = [NSNumber numberWithUnsignedInt:960UL]; - params.localEndTime = [NSNumber numberWithUnsignedInt:1980UL]; - [cluster setYearDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 3: TH sends Set Year Day Schedule Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4a4bThSendsGetYearDayScheduleCommandToDut_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getYearDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 4a & 4b: TH sends Get Year Day Schedule Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.yearDayIndex; - VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 1U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.localStartTime; - VerifyOrReturn(CheckValue("LocalStartTime", actualValue, 960UL)); - } - - { - id actualValue = values.localEndTime; - VerifyOrReturn(CheckValue("LocalEndTime", actualValue, 1980UL)); - } - - if (values.localEndTime != nil) { - - VerifyOrReturn(CheckConstraintMinValue( - "localEndTime", [values.localEndTime unsignedIntValue], 961UL)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5ThSendSetYearDayScheduleCommandToDut_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:15U]; - params.localStartTime = [NSNumber numberWithUnsignedInt:1020UL]; - params.localEndTime = [NSNumber numberWithUnsignedInt:2040UL]; - [cluster setYearDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5: TH send Set Year Day Schedule Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep6ThSendsGetYearDayScheduleCommandToDut_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:15U]; - [cluster getYearDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 6: TH sends Get Year Day Schedule Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.yearDayIndex; - VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 0U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 15U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 133U)); - } - - VerifyOrReturn(CheckConstraintHasValue("localStartTime", values.localStartTime, false)); - if (values.localStartTime != nil) { - } - - VerifyOrReturn(CheckConstraintHasValue("localEndTime", values.localEndTime, false)); - if (values.localEndTime != nil) { - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep7aCreateAUserWithUserIndexAs5_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:5U]; - params.userName = @"xxx"; - params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; - params.userStatus = [NSNumber numberWithUnsignedChar:1U]; - params.userType = [NSNumber numberWithUnsignedChar:0U]; - params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; - [cluster setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 7a: Create a user with userIndex as 5 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep7bThSendsGetYearDayScheduleCommandToDut_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NumberOfYearDaySchedulesSupportedPerUser copy]; - params.userIndex = [NSNumber numberWithUnsignedShort:5U]; - [cluster getYearDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 7b: TH sends Get Year Day Schedule Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.yearDayIndex; - VerifyOrReturn( - CheckValue("YearDayIndex", actualValue, NumberOfYearDaySchedulesSupportedPerUser)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 5U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 139U)); - } - - VerifyOrReturn(CheckConstraintHasValue("localStartTime", values.localStartTime, false)); - if (values.localStartTime != nil) { - } - - VerifyOrReturn(CheckConstraintHasValue("localEndTime", values.localEndTime, false)); - if (values.localEndTime != nil) { - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep8ThSendsClearYearDayScheduleToDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearYearDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 8: TH sends Clear Year Day Schedule to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep9ThSendsGetYearDayScheduleCommandToDut_12() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getYearDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 9: TH sends Get Year Day Schedule Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.yearDayIndex; - VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 1U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 139U)); - } - - VerifyOrReturn(CheckConstraintHasValue("localStartTime", values.localStartTime, false)); - if (values.localStartTime != nil) { - } - - VerifyOrReturn(CheckConstraintHasValue("localEndTime", values.localEndTime, false)); - if (values.localEndTime != nil) { - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep10ThSendsSetYearDayScheduleCommandToDut_13() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.localStartTime = [NSNumber numberWithUnsignedInt:1080UL]; - params.localEndTime = [NSNumber numberWithUnsignedInt:2100UL]; - [cluster setYearDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 10: TH sends Set Year Day Schedule Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep11ThSendsGetYearDayScheduleCommandToDut_14() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getYearDayScheduleWithParams:params - completion:^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 11: TH sends Get Year Day Schedule Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.yearDayIndex; - VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 1U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.localStartTime; - VerifyOrReturn(CheckValue("LocalStartTime", actualValue, 1080UL)); - } - - { - id actualValue = values.localEndTime; - VerifyOrReturn(CheckValue("LocalEndTime", actualValue, 2100UL)); - } - - if (values.localEndTime != nil) { - - VerifyOrReturn(CheckConstraintMinValue( - "localEndTime", [values.localEndTime unsignedIntValue], 1081UL)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep12ThSendsClearYearDayScheduleToDut_15() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:0U]; - [cluster - clearYearDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12: TH sends Clear Year Day Schedule to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestClearAYearDayScheduleForTheFirstUser_16() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearYearDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Clear a year day schedule for the first user Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex1_17() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user with UserIndex 1 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex5_18() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:5U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user with UserIndex 5 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_8 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_8() - : TestCommandBridge("Test_TC_DRLK_2_8") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_DRLK_2_8() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_8\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : Step 1: TH reads NumberOfTotalUsers Supported attribute and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { - NextTest(); - return; - } - err = TestStep1ThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : Step 2: TH sends Set User Command to DUT with the following values: OperationType as 0 " - "UserIndex as 1 UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 0 CredentialRule as 0\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { - NextTest(); - return; - } - err = TestStep2ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs1UserNameAsXxxUserUniqueIDAs6452UserStatusAs1UserTypeAs0CredentialRuleAs0_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3: TH sends Get User Command to DUT with UserIndex as 1\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { - NextTest(); - return; - } - err = TestStep3ThSendsGetUserCommandToDutWithUserIndexAs1_3(); - break; - case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : Step 4: TH sends Set User Command to DUT with the following values: OperationType as 0 " - "UserIndex as 2 UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 10 (Invalid value) CredentialRule " - "as 3\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { - NextTest(); - return; - } - err = TestStep4ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs2UserNameAsXxxUserUniqueIDAs6452UserStatusAs1UserTypeAs10InvalidValueCredentialRuleAs3_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : Step 5: TH sends Set User Command to DUT with the following values: OperationType as 0 " - "UserIndex as 1 (Same as step 2) UserName as xxx UserUniqueID as 8965 UserStatus as 1 UserType as 0 CredentialRule " - "as 0\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { - NextTest(); - return; - } - err = TestStep5ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs1SameAsStep2UserNameAsXxxUserUniqueIDAs8965UserStatusAs1UserTypeAs0CredentialRuleAs0_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Step 6a: TH sends Set User Command to DUT with the following values: OperationType as 0 " - "UserIndex as 2 UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL CredentialRule as " - "NULL\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { - NextTest(); - return; - } - err = TestStep6aThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs2UserNameAsNullUserUniqueIDAsNullUserStatusAsNullUserTypeAsNullCredentialRuleAsNull_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 6b: TH sends Get User Command to DUT with UserIndex as 2\n"); - if (ShouldSkip("DRLK.S.C1a.Rsp && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { - NextTest(); - return; - } - err = TestStep6bThSendsGetUserCommandToDutWithUserIndexAs2_7(); - break; - case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : Step 7: TH sends Set User Command to DUT with the following values: OperationType as 2 " - "UserIndex as 2 UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL CredentialRule as " - "NULL\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { - NextTest(); - return; - } - err = TestStep7ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs2UserIndexAs2UserNameAsNullUserUniqueIDAsNullUserStatusAsNullUserTypeAsNullCredentialRuleAsNull_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 8: TH sends Get User Command to DUT with the UserIndex as 2\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { - NextTest(); - return; - } - err = TestStep8ThSendsGetUserCommandToDutWithTheUserIndexAs2_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 9: TH sends Clear User Command to DUT with the UserIndex as 1\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1d.Rsp")) { - NextTest(); - return; - } - err = TestStep9ThSendsClearUserCommandToDutWithTheUserIndexAs1_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Step 10: TH sends Get User Command to DUT with the UserIndex as 1\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { - NextTest(); - return; - } - err = TestStep10ThSendsGetUserCommandToDutWithTheUserIndexAs1_11(); - break; - case 12: - ChipLogProgress( - chipTool, " ***** Test Step 12 : Test cleanup: TH sends Clear User Command to DUT with the UserIndex as 2\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1d.Rsp")) { - NextTest(); - return; - } - err = TestTestCleanupThSendsClearUserCommandToDutWithTheUserIndexAs2_12(); - break; - case 13: - ChipLogProgress( - chipTool, " ***** Test Step 13 : Test cleanup: TH sends Get User Command to DUT with the UserIndex as 2\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx")) { - NextTest(); - return; - } - err = TestTestCleanupThSendsGetUserCommandToDutWithTheUserIndexAs2_13(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - VerifyOrReturn(CheckValue("clusterStatus present", status.mClusterStatus.HasValue(), true)); - VerifyOrReturn(CheckValue("clusterStatus value", status.mClusterStatus.Value(), 3)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - NSNumber * _Nonnull Current_NumberOfTotalUsersSupported; - - CHIP_ERROR TestStep1ThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1: TH reads NumberOfTotalUsers Supported attribute and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65534U)); - { - Current_NumberOfTotalUsersSupported = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR - TestStep2ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs1UserNameAsXxxUserUniqueIDAs6452UserStatusAs1UserTypeAs0CredentialRuleAs0_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userName = @"xxx"; - params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; - params.userStatus = [NSNumber numberWithUnsignedChar:1U]; - params.userType = [NSNumber numberWithUnsignedChar:0U]; - params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; - [cluster - setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 2: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as " - @"1 UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 0 CredentialRule as 0 Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3ThSendsGetUserCommandToDutWithUserIndexAs1_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getUserWithParams:params - completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 3: TH sends Get User Command to DUT with UserIndex as 1 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.userName; - VerifyOrReturn(CheckValueNonNull("UserName", actualValue)); - VerifyOrReturn(CheckValueAsString("UserName", actualValue, @"xxx")); - } - - { - id actualValue = values.userUniqueID; - VerifyOrReturn(CheckValueNonNull("UserUniqueID", actualValue)); - VerifyOrReturn(CheckValue("UserUniqueID", actualValue, 6452UL)); - } - - { - id actualValue = values.userStatus; - VerifyOrReturn(CheckValueNonNull("UserStatus", actualValue)); - VerifyOrReturn(CheckValue("UserStatus", actualValue, 1U)); - } - - { - id actualValue = values.userType; - VerifyOrReturn(CheckValueNonNull("UserType", actualValue)); - VerifyOrReturn(CheckValue("UserType", actualValue, 0U)); - } - - { - id actualValue = values.credentialRule; - VerifyOrReturn(CheckValueNonNull("CredentialRule", actualValue)); - VerifyOrReturn(CheckValue("CredentialRule", actualValue, 0U)); - } - - { - id actualValue = values.credentials; - VerifyOrReturn(CheckValueNonNull("Credentials", actualValue)); - VerifyOrReturn(CheckValue("Credentials", [actualValue count], static_cast(0))); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNull("NextUserIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR - TestStep4ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs2UserNameAsXxxUserUniqueIDAs6452UserStatusAs1UserTypeAs10InvalidValueCredentialRuleAs3_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - params.userName = @"xxx"; - params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; - params.userStatus = [NSNumber numberWithUnsignedChar:1U]; - params.userType = [NSNumber numberWithUnsignedChar:10U]; - params.credentialRule = [NSNumber numberWithUnsignedChar:3U]; - [cluster - setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 4: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as " - @"2 UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 10 (Invalid value) " - @"CredentialRule as 3 Error: %@", - err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) : 0, - EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR - TestStep5ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs1SameAsStep2UserNameAsXxxUserUniqueIDAs8965UserStatusAs1UserTypeAs0CredentialRuleAs0_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userName = @"xxx"; - params.userUniqueID = [NSNumber numberWithUnsignedInt:8965UL]; - params.userStatus = [NSNumber numberWithUnsignedChar:1U]; - params.userType = [NSNumber numberWithUnsignedChar:0U]; - params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; - [cluster - setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as " - @"1 (Same as step 2) UserName as xxx UserUniqueID as 8965 UserStatus as 1 UserType as 0 " - @"CredentialRule as 0 Error: %@", - err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR - TestStep6aThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs0UserIndexAs2UserNameAsNullUserUniqueIDAsNullUserStatusAsNullUserTypeAsNullCredentialRuleAsNull_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - params.userName = nil; - params.userUniqueID = nil; - params.userStatus = nil; - params.userType = nil; - params.credentialRule = nil; - [cluster setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 6a: TH sends Set User Command to DUT with the following values: OperationType as 0 " - @"UserIndex as 2 UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL " - @"CredentialRule as NULL Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep6bThSendsGetUserCommandToDutWithUserIndexAs2_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - [cluster getUserWithParams:params - completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 6b: TH sends Get User Command to DUT with UserIndex as 2 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); - } - - { - id actualValue = values.userName; - VerifyOrReturn(CheckValueNonNull("UserName", actualValue)); - VerifyOrReturn(CheckValueAsString("UserName", actualValue, @"")); - } - - { - id actualValue = values.userUniqueID; - VerifyOrReturn(CheckValueNull("UserUniqueID", actualValue)); - } - - { - id actualValue = values.userStatus; - VerifyOrReturn(CheckValueNonNull("UserStatus", actualValue)); - VerifyOrReturn(CheckValue("UserStatus", actualValue, 1U)); - } - - { - id actualValue = values.userType; - VerifyOrReturn(CheckValueNonNull("UserType", actualValue)); - VerifyOrReturn(CheckValue("UserType", actualValue, 0U)); - } - - { - id actualValue = values.credentialRule; - VerifyOrReturn(CheckValueNonNull("CredentialRule", actualValue)); - VerifyOrReturn(CheckValue("CredentialRule", actualValue, 0U)); - } - - { - id actualValue = values.credentials; - VerifyOrReturn(CheckValueNonNull("Credentials", actualValue)); - VerifyOrReturn(CheckValue("Credentials", [actualValue count], static_cast(0))); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNull("NextUserIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR - TestStep7ThSendsSetUserCommandToDutWithTheFollowingValuesOperationTypeAs2UserIndexAs2UserNameAsNullUserUniqueIDAsNullUserStatusAsNullUserTypeAsNullCredentialRuleAsNull_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:2U]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - params.userName = nil; - params.userUniqueID = nil; - params.userStatus = nil; - params.userType = nil; - params.credentialRule = nil; - [cluster setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 7: TH sends Set User Command to DUT with the following values: OperationType as 2 " - @"UserIndex as 2 UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL " - @"CredentialRule as NULL Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep8ThSendsGetUserCommandToDutWithTheUserIndexAs2_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - [cluster getUserWithParams:params - completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 8: TH sends Get User Command to DUT with the UserIndex as 2 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); - } - - { - id actualValue = values.userName; - VerifyOrReturn(CheckValueNonNull("UserName", actualValue)); - VerifyOrReturn(CheckValueAsString("UserName", actualValue, @"")); - } - - { - id actualValue = values.userUniqueID; - VerifyOrReturn(CheckValueNull("UserUniqueID", actualValue)); - } - - { - id actualValue = values.userStatus; - VerifyOrReturn(CheckValueNonNull("UserStatus", actualValue)); - VerifyOrReturn(CheckValue("UserStatus", actualValue, 1U)); - } - - { - id actualValue = values.userType; - VerifyOrReturn(CheckValueNonNull("UserType", actualValue)); - VerifyOrReturn(CheckValue("UserType", actualValue, 0U)); - } - - { - id actualValue = values.credentialRule; - VerifyOrReturn(CheckValueNonNull("CredentialRule", actualValue)); - VerifyOrReturn(CheckValue("CredentialRule", actualValue, 0U)); - } - - { - id actualValue = values.credentials; - VerifyOrReturn(CheckValueNonNull("Credentials", actualValue)); - VerifyOrReturn(CheckValue("Credentials", [actualValue count], static_cast(0))); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNull("NextUserIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep9ThSendsClearUserCommandToDutWithTheUserIndexAs1_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 9: TH sends Clear User Command to DUT with the UserIndex as 1 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep10ThSendsGetUserCommandToDutWithTheUserIndexAs1_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getUserWithParams:params - completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 10: TH sends Get User Command to DUT with the UserIndex as 1 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.userName; - VerifyOrReturn(CheckValueNull("UserName", actualValue)); - } - - { - id actualValue = values.userUniqueID; - VerifyOrReturn(CheckValueNull("UserUniqueID", actualValue)); - } - - { - id actualValue = values.userStatus; - VerifyOrReturn(CheckValueNull("UserStatus", actualValue)); - } - - { - id actualValue = values.userType; - VerifyOrReturn(CheckValueNull("UserType", actualValue)); - } - - { - id actualValue = values.credentialRule; - VerifyOrReturn(CheckValueNull("CredentialRule", actualValue)); - } - - { - id actualValue = values.credentials; - VerifyOrReturn(CheckValueNull("Credentials", actualValue)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); - } - - { - id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("NextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("NextUserIndex", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTestCleanupThSendsClearUserCommandToDutWithTheUserIndexAs2_12() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Test cleanup: TH sends Clear User Command to DUT with the UserIndex as 2 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTestCleanupThSendsGetUserCommandToDutWithTheUserIndexAs2_13() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - [cluster getUserWithParams:params - completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Test cleanup: TH sends Get User Command to DUT with the UserIndex as 2 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); - } - - { - id actualValue = values.userName; - VerifyOrReturn(CheckValueNull("UserName", actualValue)); - } - - { - id actualValue = values.userUniqueID; - VerifyOrReturn(CheckValueNull("UserUniqueID", actualValue)); - } - - { - id actualValue = values.userStatus; - VerifyOrReturn(CheckValueNull("UserStatus", actualValue)); - } - - { - id actualValue = values.userType; - VerifyOrReturn(CheckValueNull("UserType", actualValue)); - } - - { - id actualValue = values.credentialRule; - VerifyOrReturn(CheckValueNull("CredentialRule", actualValue)); - } - - { - id actualValue = values.credentials; - VerifyOrReturn(CheckValueNull("Credentials", actualValue)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); - } - - { - id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNull("NextUserIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_11 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_11() - : TestCommandBridge("Test_TC_DRLK_2_11") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("PINCredentialData", &mPINCredentialData); - AddArgument("RFIDCredentialData", &mRFIDCredentialData); - AddArgument("FingerVeinCredentialData", &mFingerVeinCredentialData); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_DRLK_2_11() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_11\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_11\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Create new user with default parameters\n"); - err = TestPreconditionCreateNewUserWithDefaultParameters_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Read the user back and verify its fields\n"); - err = TestPreconditionReadTheUserBackAndVerifyItsFields_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Step 1a: TH reads NumberOfTotalUsersSupported and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { - NextTest(); - return; - } - err = TestStep1aThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 1b: TH reads MinPINCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { - NextTest(); - return; - } - err = TestStep1bThReadsMinPINCodeLengthAndSavesForFutureUse_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 1c: TH reads MaxPINCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { - NextTest(); - return; - } - err = TestStep1cThReadsMaxPINCodeLengthAndSavesForFutureUse_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 1d: TH reads MinRFIDCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a")) { - NextTest(); - return; - } - err = TestStep1dThReadsMinRFIDCodeLengthAndSavesForFutureUse_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 1e: TH reads MaxRFIDCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019")) { - NextTest(); - return; - } - err = TestStep1eThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 2a: TH sends Set Credential Command to DUT with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { - NextTest(); - return; - } - err = TestStep2aThSendsSetCredentialCommandToDutWithTypePin_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 2b: TH sends Set Credential Command to DUT with type RFID\n"); - if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { - NextTest(); - return; - } - err = TestStep2bThSendsSetCredentialCommandToDutWithTypeRfid_9(); - break; - case 10: - ChipLogProgress( - chipTool, " ***** Test Step 10 : Step 2c: TH sends Set Credential Command to DUT with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { - NextTest(); - return; - } - err = TestStep2cThSendsSetCredentialCommandToDutWithTypeFingerVein_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Step 3a: TH sends Get Credential Status Command with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep3aThSendsGetCredentialStatusCommandWithTypePin_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Step 3b: TH sends Get Credential Status Command with type RFID\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep3bThSendsGetCredentialStatusCommandWithTypeRfid_12(); - break; - case 13: - ChipLogProgress( - chipTool, " ***** Test Step 13 : Step 3c: TH sends Get Credential Status Command with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep3cThSendsGetCredentialStatusCommandWithTypeFingerVein_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Step 4a: TH sends Clear Credential Command to DUT with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { - NextTest(); - return; - } - err = TestStep4aThSendsClearCredentialCommandToDutWithTypePin_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Step 4b: TH sends Get Credential Status Command with type RFID\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep4bThSendsGetCredentialStatusCommandWithTypeRfid_15(); - break; - case 16: - ChipLogProgress( - chipTool, " ***** Test Step 16 : Step 4c: TH sends Get Credential Status Command with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep4cThSendsGetCredentialStatusCommandWithTypeFingerVein_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Step 4d: TH sends Clear Credential Command to DUT with type RFID\n"); - if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { - NextTest(); - return; - } - err = TestStep4dThSendsClearCredentialCommandToDutWithTypeRfid_17(); - break; - case 18: - ChipLogProgress( - chipTool, " ***** Test Step 18 : Step 4e: TH sends Get Credential Status Command with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep4eThSendsGetCredentialStatusCommandWithTypeFingerVein_18(); - break; - case 19: - ChipLogProgress( - chipTool, " ***** Test Step 19 : Step 4f: TH sends Clear Credential Command to DUT with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { - NextTest(); - return; - } - err = TestStep4fThSendsClearCredentialCommandToDutWithTypeFingerVein_19(); - break; - case 20: - ChipLogProgress( - chipTool, " ***** Test Step 20 : Step 5a: TH sends Get Credential Status Command to DUT with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep5aThSendsGetCredentialStatusCommandToDutWithTypePin_20(); - break; - case 21: - ChipLogProgress( - chipTool, " ***** Test Step 21 : Step 5b: TH sends Get Credential Status Command to DUT with type RFID\n"); - if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep5bThSendsGetCredentialStatusCommandToDutWithTypeRfid_21(); - break; - case 22: - ChipLogProgress( - chipTool, " ***** Test Step 22 : Step 5c: TH sends Get Credential Status Command to DUT with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { - NextTest(); - return; - } - err = TestStep5cThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 23; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mPINCredentialData; - chip::Optional mRFIDCredentialData; - chip::Optional mFingerVeinCredentialData; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestPreconditionCreateNewUserWithDefaultParameters_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userName = @"xxx"; - params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; - params.userStatus = [NSNumber numberWithUnsignedChar:1U]; - params.userType = [NSNumber numberWithUnsignedChar:0U]; - params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; - [cluster setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Precondition: Create new user with default parameters Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestPreconditionReadTheUserBackAndVerifyItsFields_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; [cluster getUserWithParams:params completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Precondition: Read the user back and verify its fields Error: %@", err); + NSLog(@"Test cleanup: TH sends Get User Command to DUT with the UserIndex as 2 Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = values.userIndex; - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); } { id actualValue = values.userName; - VerifyOrReturn(CheckValueNonNull("UserName", actualValue)); - VerifyOrReturn(CheckValueAsString("UserName", actualValue, @"xxx")); + VerifyOrReturn(CheckValueNull("UserName", actualValue)); } { id actualValue = values.userUniqueID; - VerifyOrReturn(CheckValueNonNull("UserUniqueID", actualValue)); - VerifyOrReturn(CheckValue("UserUniqueID", actualValue, 6452UL)); + VerifyOrReturn(CheckValueNull("UserUniqueID", actualValue)); } { id actualValue = values.userStatus; - VerifyOrReturn(CheckValueNonNull("UserStatus", actualValue)); - VerifyOrReturn(CheckValue("UserStatus", actualValue, 1U)); + VerifyOrReturn(CheckValueNull("UserStatus", actualValue)); } { id actualValue = values.userType; - VerifyOrReturn(CheckValueNonNull("UserType", actualValue)); - VerifyOrReturn(CheckValue("UserType", actualValue, 0U)); + VerifyOrReturn(CheckValueNull("UserType", actualValue)); } { id actualValue = values.credentialRule; - VerifyOrReturn(CheckValueNonNull("CredentialRule", actualValue)); - VerifyOrReturn(CheckValue("CredentialRule", actualValue, 0U)); + VerifyOrReturn(CheckValueNull("CredentialRule", actualValue)); } { id actualValue = values.credentials; - VerifyOrReturn(CheckValueNonNull("Credentials", actualValue)); - VerifyOrReturn(CheckValue("Credentials", [actualValue count], static_cast(0))); + VerifyOrReturn(CheckValueNull("Credentials", actualValue)); } { id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); } { id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); } { @@ -174486,825 +171488,26 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { return CHIP_NO_ERROR; } - - CHIP_ERROR TestStep1aThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1a: TH reads NumberOfTotalUsersSupported and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65535U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep1bThReadsMinPINCodeLengthAndSavesForFutureUse_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1b: TH reads MinPINCodeLength and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("minPINCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("minPINCodeLength", [value unsignedCharValue], 255U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep1cThReadsMaxPINCodeLengthAndSavesForFutureUse_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1c: TH reads MaxPINCodeLength and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("maxPINCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("maxPINCodeLength", [value unsignedCharValue], 255U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep1dThReadsMinRFIDCodeLengthAndSavesForFutureUse_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1d: TH reads MinRFIDCodeLength and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("minRFIDCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("minRFIDCodeLength", [value unsignedCharValue], 255U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep1eThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 1e: TH reads MaxRFIDCodeLength and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintMinValue("maxRFIDCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("maxRFIDCodeLength", [value unsignedCharValue], 255U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2aThSendsSetCredentialCommandToDutWithTypePin_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - params.credentialData = mPINCredentialData.HasValue() - ? [NSData dataWithBytes:mPINCredentialData.Value().data() length:mPINCredentialData.Value().size()] - : [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 2a: TH sends Set Credential Command to DUT with type PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2bThSendsSetCredentialCommandToDutWithTypeRfid_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - params.credentialData = mRFIDCredentialData.HasValue() - ? [NSData dataWithBytes:mRFIDCredentialData.Value().data() length:mRFIDCredentialData.Value().size()] - : [[NSData alloc] initWithBytes:"123456789A" length:10]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 2b: TH sends Set Credential Command to DUT with type RFID Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep2cThSendsSetCredentialCommandToDutWithTypeFingerVein_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - params.credentialData = mFingerVeinCredentialData.HasValue() - ? [NSData dataWithBytes:mFingerVeinCredentialData.Value().data() length:mFingerVeinCredentialData.Value().size()] - : [[NSData alloc] initWithBytes:"123456789A" length:10]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 2c: TH sends Set Credential Command to DUT with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3aThSendsGetCredentialStatusCommandWithTypePin_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 3a: TH sends Get Credential Status Command with type PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3bThSendsGetCredentialStatusCommandWithTypeRfid_12() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 3b: TH sends Get Credential Status Command with type RFID Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3cThSendsGetCredentialStatusCommandWithTypeFingerVein_13() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster - getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 3c: TH sends Get Credential Status Command with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4aThSendsClearCredentialCommandToDutWithTypePin_14() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 4a: TH sends Clear Credential Command to DUT with type PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4bThSendsGetCredentialStatusCommandWithTypeRfid_15() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 4b: TH sends Get Credential Status Command with type RFID Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4cThSendsGetCredentialStatusCommandWithTypeFingerVein_16() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster - getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 4c: TH sends Get Credential Status Command with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4dThSendsClearCredentialCommandToDutWithTypeRfid_17() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 4d: TH sends Clear Credential Command to DUT with type RFID Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4eThSendsGetCredentialStatusCommandWithTypeFingerVein_18() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster - getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 4e: TH sends Get Credential Status Command with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4fThSendsClearCredentialCommandToDutWithTypeFingerVein_19() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 4f: TH sends Clear Credential Command to DUT with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5aThSendsGetCredentialStatusCommandToDutWithTypePin_20() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster - getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 5a: TH sends Get Credential Status Command to DUT with type PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5bThSendsGetCredentialStatusCommandToDutWithTypeRfid_21() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster - getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 5b: TH sends Get Credential Status Command to DUT with type RFID Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5cThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster - getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Step 5c: TH sends Get Credential Status Command to DUT with type FingerVein Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } }; -class Test_TC_DRLK_2_12 : public TestCommandBridge { +class Test_TC_DRLK_2_11 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_12() - : TestCommandBridge("Test_TC_DRLK_2_12") + Test_TC_DRLK_2_11() + : TestCommandBridge("Test_TC_DRLK_2_11") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("PINCredentialData", &mPINCredentialData); + AddArgument("RFIDCredentialData", &mRFIDCredentialData); + AddArgument("FingerVeinCredentialData", &mFingerVeinCredentialData); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DRLK_2_12() {} + ~Test_TC_DRLK_2_11() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -175312,11 +171515,11 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_12\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_11\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_12\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_11\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -175333,312 +171536,181 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Create new user\n"); - err = TestPreconditionCreateNewUser_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Create new user with default parameters\n"); + err = TestPreconditionCreateNewUserWithDefaultParameters_1(); break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Read the user back and verify its fields\n"); err = TestPreconditionReadTheUserBackAndVerifyItsFields_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Precondition: Create new PIN credential and lock/unlock user\n"); - err = TestPreconditionCreateNewPinCredentialAndLockUnlockUser_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Precondition: Verify created PIN credential\n"); - err = TestPreconditionVerifyCreatedPinCredential_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write")) { - NextTest(); - return; - } - err = TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write")) { - NextTest(); - return; - } - err = TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_6(); - break; - case 7: - ChipLogProgress( - chipTool, " ***** Test Step 7 : Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3: TH sends Ubolt Door Command to the DUT without PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { - NextTest(); - return; - } - err = TestStep3ThSendsUboltDoorCommandToTheDutWithoutPINCode_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 4: TH sends Ubolt Door Command to the DUT with PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { - NextTest(); - return; - } - err = TestStep4ThSendsUboltDoorCommandToTheDutWithPINCode_9(); - break; - case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write")) { - NextTest(); - return; - } - err = TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_10(); - break; - case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write")) { - NextTest(); - return; - } - err = TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_11(); - break; - case 12: - ChipLogProgress( - chipTool, " ***** Test Step 12 : Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { - NextTest(); - return; - } - err = TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { - NextTest(); - return; - } - err = TestStep7ThSendsUboltDoorCommandToTheDutWithValidPINCode_13(); - break; - case 14: - ChipLogProgress( - chipTool, " ***** Test Step 14 : Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { - NextTest(); - return; - } - err = TestStep8ThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Step 9: TH sends Unbolt Door Command to the DUT without PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { - NextTest(); - return; - } - err = TestStep9ThSendsUnboltDoorCommandToTheDutWithoutPINCode_15(); - break; - case 16: ChipLogProgress( - chipTool, " ***** Test Step 16 : Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT\n"); - if (ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write")) { + chipTool, " ***** Test Step 3 : Step 1a: TH reads NumberOfTotalUsersSupported and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { NextTest(); return; } - err = TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_16(); + err = TestStep1aThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3(); break; - case 17: - ChipLogProgress( - chipTool, " ***** Test Step 17 : Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT\n"); - if (ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write")) { + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 1b: TH reads MinPINCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { NextTest(); return; } - err = TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_17(); + err = TestStep1bThReadsMinPINCodeLengthAndSavesForFutureUse_4(); break; - case 18: - ChipLogProgress(chipTool, - " ***** Test Step 18 : Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT " - "and Verify that the DUT sends Success response\n"); - if (ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write")) { + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 1c: TH reads MaxPINCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { NextTest(); return; } - err = TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_18(); + err = TestStep1cThReadsMaxPINCodeLengthAndSavesForFutureUse_5(); break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT " - "and Verify that the DUT sends Success response\n"); - if (ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write")) { + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 1d: TH reads MinRFIDCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a")) { NextTest(); return; } - err = TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_19(); + err = TestStep1dThReadsMinRFIDCodeLengthAndSavesForFutureUse_6(); break; - case 20: - ChipLogProgress( - chipTool, " ***** Test Step 20 : Step 12a: TH sends Unbolt Door Command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 1e: TH reads MaxRFIDCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019")) { NextTest(); return; } - err = TestStep12aThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_20(); + err = TestStep1eThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7(); break; - case 21: - ChipLogProgress( - chipTool, " ***** Test Step 21 : Step 12b: TH sends Unbolt Door Command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 2a: TH sends Set Credential Command to DUT with type PIN\n"); + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { NextTest(); return; } - err = TestStep12bThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_21(); + err = TestStep2aThSendsSetCredentialCommandToDutWithTypePin_8(); break; - case 22: - ChipLogProgress( - chipTool, " ***** Test Step 22 : Step 12c: TH sends Unbolt Door Command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 2b: TH sends Set Credential Command to DUT with type RFID\n"); + if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { NextTest(); return; } - err = TestStep12cThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_22(); + err = TestStep2bThSendsSetCredentialCommandToDutWithTypeRfid_9(); break; - case 23: + case 10: ChipLogProgress( - chipTool, " ***** Test Step 23 : Step 12d: TH sends Unbolt Door Command to the DUT with invalid PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { - NextTest(); - return; - } - err = TestStep12dThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT\n"); - if (ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031")) { - NextTest(); - return; - } - err = TestStep13ThReadsUserCodedTemporaryDisableTimeAttributeFromDut_24(); - break; - case 25: - ChipLogProgress(chipTool, - " ***** Test Step 25 : Step 14: TH sends Unbolt Door Command to the DUT with valid PINCode before " - "UserCodeTemporaryDisableTime expires\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { + chipTool, " ***** Test Step 10 : Step 2c: TH sends Set Credential Command to DUT with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { NextTest(); return; } - err = TestStep14ThSendsUnboltDoorCommandToTheDutWithValidPINCodeBeforeUserCodeTemporaryDisableTimeExpires_25(); + err = TestStep2cThSendsSetCredentialCommandToDutWithTypeFingerVein_10(); break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Wait for UserCodeTemporaryDisableTime expires\n"); - if (ShouldSkip("( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031")) { + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 3a: TH sends Get Credential Status Command with type PIN\n"); + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestWaitForUserCodeTemporaryDisableTimeExpires_26(); + err = TestStep3aThSendsGetCredentialStatusCommandWithTypePin_11(); break; - case 27: - ChipLogProgress( - chipTool, " ***** Test Step 27 : Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY")) { + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 3b: TH sends Get Credential Status Command with type RFID\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_27(); + err = TestStep3bThSendsGetCredentialStatusCommandWithTypeRfid_12(); break; - case 28: + case 13: ChipLogProgress( - chipTool, " ***** Test Step 28 : Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP")) { + chipTool, " ***** Test Step 13 : Step 3c: TH sends Get Credential Status Command with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_28(); + err = TestStep3cThSendsGetCredentialStatusCommandWithTypeFingerVein_13(); break; - case 29: - ChipLogProgress( - chipTool, " ***** Test Step 29 : Step 15: TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY && !DRLK.S.A0023.Write")) { + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 4a: TH sends Clear Credential Command to DUT with type PIN\n"); + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { NextTest(); return; } - err = TestStep15ThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_29(); + err = TestStep4aThSendsClearCredentialCommandToDutWithTypePin_14(); break; - case 30: - ChipLogProgress( - chipTool, " ***** Test Step 30 : Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP && !DRLK.S.A0023.Write")) { + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 4b: TH sends Get Credential Status Command with type RFID\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_30(); + err = TestStep4bThSendsGetCredentialStatusCommandWithTypeRfid_15(); break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Step 16: TH reads the AutoRelockTime attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { + case 16: + ChipLogProgress( + chipTool, " ***** Test Step 16 : Step 4c: TH sends Get Credential Status Command with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_31(); + err = TestStep4cThSendsGetCredentialStatusCommandWithTypeFingerVein_16(); break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Step 16: TH reads the AutoRelockTime attribute from the DUT\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Step 4d: TH sends Clear Credential Command to DUT with type RFID\n"); + if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { NextTest(); return; } - err = TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_32(); + err = TestStep4dThSendsClearCredentialCommandToDutWithTypeRfid_17(); break; - case 33: + case 18: ChipLogProgress( - chipTool, " ***** Test Step 33 : Step 17: TH sends the Unbolt Door command to the DUT with valid PINCode\n"); - if (ShouldSkip("DRLK.S.C27.Rsp")) { + chipTool, " ***** Test Step 18 : Step 4e: TH sends Get Credential Status Command with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestStep17ThSendsTheUnboltDoorCommandToTheDutWithValidPINCode_33(); + err = TestStep4eThSendsGetCredentialStatusCommandWithTypeFingerVein_18(); break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Wait for AutoRelockTime Expires\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { + case 19: + ChipLogProgress( + chipTool, " ***** Test Step 19 : Step 4f: TH sends Clear Credential Command to DUT with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { NextTest(); return; } - err = TestWaitForAutoRelockTimeExpires_34(); + err = TestStep4fThSendsClearCredentialCommandToDutWithTypeFingerVein_19(); break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Wait for AutoRelockTime Expires\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { + case 20: + ChipLogProgress( + chipTool, " ***** Test Step 20 : Step 5a: TH sends Get Credential Status Command to DUT with type PIN\n"); + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestWaitForAutoRelockTimeExpires_35(); + err = TestStep5aThSendsGetCredentialStatusCommandToDutWithTypePin_20(); break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Step 18: TH reads LockState attribute\n"); - if (ShouldSkip("DRLK.S.A0000 && DRLK.S.C01.Rsp")) { + case 21: + ChipLogProgress( + chipTool, " ***** Test Step 21 : Step 5b: TH sends Get Credential Status Command to DUT with type RFID\n"); + if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestStep18ThReadsLockStateAttribute_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Cleanup the created user\n"); - err = TestCleanupTheCreatedUser_37(); + err = TestStep5bThSendsGetCredentialStatusCommandToDutWithTypeRfid_21(); break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Clean the created credential\n"); - if (ShouldSkip("DRLK.S.C26.Rsp")) { + case 22: + ChipLogProgress( + chipTool, " ***** Test Step 22 : Step 5c: TH sends Get Credential Status Command to DUT with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestCleanTheCreatedCredential_38(); + err = TestStep5cThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22(); break; } @@ -175670,7 +171742,7 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -175685,7 +171757,7 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -175694,78 +171766,30 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 35: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 36: + case 20: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 37: + case 21: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 38: + case 22: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; } @@ -175781,11 +171805,14 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 39; + const uint16_t mTestCount = 23; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mPINCredentialData; + chip::Optional mRFIDCredentialData; + chip::Optional mFingerVeinCredentialData; chip::Optional mTimeout; CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() @@ -175796,7 +171823,7 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestPreconditionCreateNewUser_1() + CHIP_ERROR TestPreconditionCreateNewUserWithDefaultParameters_1() { MTRBaseDevice * device = GetDevice("alpha"); @@ -175813,7 +171840,7 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; [cluster setUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Precondition: Create new user Error: %@", err); + NSLog(@"Precondition: Create new user with default parameters Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -175902,171 +171929,83 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionCreateNewPinCredentialAndLockUnlockUser_3() + CHIP_ERROR TestStep1aThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Precondition: Create new PIN credential and lock/unlock user Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1a: TH reads NumberOfTotalUsersSupported and saves for future use. Error: %@", err); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65535U)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionVerifyCreatedPinCredential_4() + CHIP_ERROR TestStep1bThReadsMinPINCodeLengthAndSavesForFutureUse_4() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"Precondition: Verify created PIN credential Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + [cluster readAttributeMinPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1b: TH reads MinPINCodeLength and saves for future use. Error: %@", err); - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckConstraintMinValue("minPINCodeLength", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minPINCodeLength", [value unsignedCharValue], 255U)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5() + CHIP_ERROR TestStep1cThReadsMaxPINCodeLengthAndSavesForFutureUse_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:false]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1: TH writes the RequirePINforRemoteOperation attribute " - @"value as False on the DUT Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_6() - { + [cluster readAttributeMaxPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1c: TH reads MaxPINCodeLength and saves for future use. Error: %@", err); - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:false]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 1: TH writes the RequirePINforRemoteOperation attribute " - @"value as False on the DUT Error: %@", - err); + VerifyOrReturn(CheckConstraintMinValue("maxPINCodeLength", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("maxPINCodeLength", [value unsignedCharValue], 255U)); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7() + CHIP_ERROR TestStep1dThReadsMinRFIDCodeLengthAndSavesForFutureUse_6() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); + [cluster readAttributeMinRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1d: TH reads MinRFIDCodeLength and saves for future use. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, false)); - } + VerifyOrReturn(CheckConstraintMinValue("minRFIDCodeLength", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minRFIDCodeLength", [value unsignedCharValue], 255U)); NextTest(); }]; @@ -176074,693 +172013,720 @@ class Test_TC_DRLK_2_12 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3ThSendsUboltDoorCommandToTheDutWithoutPINCode_8() + CHIP_ERROR TestStep1eThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - [cluster unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 3: TH sends Ubolt Door Command to the DUT without PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4ThSendsUboltDoorCommandToTheDutWithPINCode_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + [cluster readAttributeMaxRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1e: TH reads MaxRFIDCodeLength and saves for future use. Error: %@", err); - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 4: TH sends Ubolt Door Command to the DUT with PINCode Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckConstraintMinValue("maxRFIDCodeLength", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("maxRFIDCodeLength", [value unsignedCharValue], 255U)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_10() + CHIP_ERROR TestStep2aThSendsSetCredentialCommandToDutWithTypePin_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:true]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5: TH writes the RequirePINforRemoteOperation attribute " - @"value as true on the DUT Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - NextTest(); - }]; + params.credentialData = mPINCredentialData.HasValue() + ? [NSData dataWithBytes:mPINCredentialData.Value().data() length:mPINCredentialData.Value().size()] + : [[NSData alloc] initWithBytes:"123456" length:6]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 2a: TH sends Set Credential Command to DUT with type PIN Error: %@", err); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - CHIP_ERROR TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_11() - { + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } - id requirePINforRemoteOperationArgument; - requirePINforRemoteOperationArgument = [NSNumber numberWithBool:true]; - [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 5: TH writes the RequirePINforRemoteOperation attribute " - @"value as true on the DUT Error: %@", - err); + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); + VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12() + CHIP_ERROR TestStep2bThSendsSetCredentialCommandToDutWithTypeRfid_9() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, true)); - } - - NextTest(); - }]; + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - return CHIP_NO_ERROR; - } + params.credentialData = mRFIDCredentialData.HasValue() + ? [NSData dataWithBytes:mRFIDCredentialData.Value().data() length:mRFIDCredentialData.Value().size()] + : [[NSData alloc] initWithBytes:"123456789A" length:10]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 2b: TH sends Set Credential Command to DUT with type RFID Error: %@", err); - CHIP_ERROR TestStep7ThSendsUboltDoorCommandToTheDutWithValidPINCode_13() - { + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode Error: %@", err); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); + VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep8ThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_14() + CHIP_ERROR TestStep2cThSendsSetCredentialCommandToDutWithTypeFingerVein_10() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123458" length:6]; - [cluster - unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + params.credentialData = mFingerVeinCredentialData.HasValue() + ? [NSData dataWithBytes:mFingerVeinCredentialData.Value().data() length:mFingerVeinCredentialData.Value().size()] + : [[NSData alloc] initWithBytes:"123456789A" length:10]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 2c: TH sends Set Credential Command to DUT with type FingerVein Error: %@", err); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - CHIP_ERROR TestStep9ThSendsUnboltDoorCommandToTheDutWithoutPINCode_15() - { + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - [cluster - unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 9: TH sends Unbolt Door Command to the DUT without PINCode Error: %@", err); + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); + VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_16() + CHIP_ERROR TestStep3aThSendsGetCredentialStatusCommandWithTypePin_11() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id wrongCodeEntryLimitArgument; - wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; - [cluster writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the " - @"DUT Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 3a: TH sends Get Credential Status Command with type PIN Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - return CHIP_NO_ERROR; - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - CHIP_ERROR TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_17() - { + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - id wrongCodeEntryLimitArgument; - wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; - [cluster writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the " - @"DUT Error: %@", - err); + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_18() + CHIP_ERROR TestStep3bThSendsGetCredentialStatusCommandWithTypeRfid_12() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id userCodeTemporaryDisableTimeArgument; - userCodeTemporaryDisableTimeArgument = [NSNumber numberWithUnsignedChar:15U]; - [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:userCodeTemporaryDisableTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 11: TH writes UserCodeTemporaryDisableTime attribute " - @"value as 15 Seconds on the DUT and Verify that the DUT sends " - @"Success response Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 3b: TH sends Get Credential Status Command with type RFID Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - return CHIP_NO_ERROR; - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - CHIP_ERROR - TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_19() - { + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - id userCodeTemporaryDisableTimeArgument; - userCodeTemporaryDisableTimeArgument = [NSNumber numberWithUnsignedChar:15U]; - [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:userCodeTemporaryDisableTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 11: TH writes UserCodeTemporaryDisableTime attribute " - @"value as 15 Seconds on the DUT and Verify that the DUT sends " - @"Success response Error: %@", - err); + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep12aThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_20() + CHIP_ERROR TestStep3cThSendsGetCredentialStatusCommandWithTypeFingerVein_13() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123457" length:6]; + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster - unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12a: TH sends Unbolt Door Command to the DUT with invalid PINCode Error: %@", err); + getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 3c: TH sends Get Credential Status Command with type FingerVein Error: %@", err); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - return CHIP_NO_ERROR; - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - CHIP_ERROR TestStep12bThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_21() - { + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123458" length:6]; - [cluster - unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12b: TH sends Unbolt Door Command to the DUT with invalid PINCode Error: %@", err); + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep12cThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_22() + CHIP_ERROR TestStep4aThSendsClearCredentialCommandToDutWithTypePin_14() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123459" length:6]; - [cluster - unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12c: TH sends Unbolt Door Command to the DUT with invalid PINCode Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep12dThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_23() - { + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 4a: TH sends Clear Credential Command to DUT with type PIN Error: %@", err); - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123460" length:6]; - [cluster - unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 12d: TH sends Unbolt Door Command to the DUT with invalid PINCode Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep13ThReadsUserCodedTemporaryDisableTimeAttributeFromDut_24() + CHIP_ERROR TestStep4bThSendsGetCredentialStatusCommandWithTypeRfid_15() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 4b: TH sends Get Credential Status Command with type RFID Error: %@", err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("UserCodeTemporaryDisableTime", actualValue, 15U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - CHIP_ERROR TestStep14ThSendsUnboltDoorCommandToTheDutWithValidPINCodeBeforeUserCodeTemporaryDisableTimeExpires_25() - { + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster - unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 14: TH sends Unbolt Door Command to the DUT with valid PINCode before " - @"UserCodeTemporaryDisableTime expires Error: %@", - err); + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWaitForUserCodeTemporaryDisableTimeExpires_26() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 15000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_27() + CHIP_ERROR TestStep4cThSendsGetCredentialStatusCommandWithTypeFingerVein_16() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " - @"Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster + getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 4c: TH sends Get Credential Status Command with type FingerVein Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - return CHIP_NO_ERROR; - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_28() - { + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " - @"Error: %@", - err); + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_29() + CHIP_ERROR TestStep4dThSendsClearCredentialCommandToDutWithTypeRfid_17() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 15: TH writes AutoRelockTime attribute value as 10 seconds on the DUT " - @"Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 4d: TH sends Clear Credential Command to DUT with type RFID Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_30() + CHIP_ERROR TestStep4eThSendsGetCredentialStatusCommandWithTypeFingerVein_18() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id autoRelockTimeArgument; - autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; - [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " - @"Error: %@", - err); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] - ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + [cluster + getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 4e: TH sends Get Credential Status Command with type FingerVein Error: %@", err); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - CHIP_ERROR TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_31() - { + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - [cluster readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 16: TH reads the AutoRelockTime attribute from the DUT Error: %@", err); + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("AutoRelockTime", actualValue, 10UL)); - } + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_32() + CHIP_ERROR TestStep4fThSendsClearCredentialCommandToDutWithTypeFingerVein_19() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 16: TH reads the AutoRelockTime attribute from the DUT Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 4f: TH sends Clear Credential Command to DUT with type FingerVein Error: %@", err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("AutoRelockTime", actualValue, 60UL)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestStep17ThSendsTheUnboltDoorCommandToTheDutWithValidPINCode_33() + CHIP_ERROR TestStep5aThSendsGetCredentialStatusCommandToDutWithTypePin_20() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unboltDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Step 17: TH sends the Unbolt Door command to the DUT with valid PINCode Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster + getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 5a: TH sends Get Credential Status Command to DUT with type PIN Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - return CHIP_NO_ERROR; - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); + } - CHIP_ERROR TestWaitForAutoRelockTimeExpires_34() - { + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs("alpha", value); - } + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + } - CHIP_ERROR TestWaitForAutoRelockTimeExpires_35() - { + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + } - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 60000UL; - return WaitForMs("alpha", value); + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestStep18ThReadsLockStateAttribute_36() + CHIP_ERROR TestStep5bThSendsGetCredentialStatusCommandToDutWithTypeRfid_21() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 18: TH reads LockState attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); - } + [cluster + getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 5b: TH sends Get Credential Status Command to DUT with type RFID Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - return CHIP_NO_ERROR; - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); + } - CHIP_ERROR TestCleanupTheCreatedUser_37() - { + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + } - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user Error: %@", err); + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanTheCreatedCredential_38() + CHIP_ERROR TestStep5cThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Clean the created credential Error: %@", err); + [cluster + getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Step 5c: TH sends Get Credential Status Command to DUT with type FingerVein Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } @@ -180525,15 +176491,12 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(),