diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 67ce7560c7456c..4c45ae86d767c6 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -2637,6 +2637,84 @@ PICS: - label: "Does the DUT(server) support the ExpiringUserTimeOut attribute?" id: DRLK.S.A0035 + # + #Server ReadOnly attribute + # + - label: + "Does the DUT(server) support the EnableLocalProgramming attribute and + is ReadOnly" + id: DRLK.S.A0028.ReadOnly + + - label: + "Does the DUT(server) support the LocalProgrammingFeatures attribute + and is ReadOnly" + id: DRLK.S.A002c.ReadOnly + + # + # Server write attributes + # + + - label: "Does the DUT(server) support the DoorOpen Events attribute?" + id: DRLK.S.A0004.Write + + - label: "Does the DUT(server) support the DoorClosedEvents attribute?" + id: DRLK.S.A0005.Write + + - label: "Does the DUT(server) support the OpenPeriod attribute?" + id: DRLK.S.A0006.Write + + - label: "Does the DUT(server) support the Language attribute?" + id: DRLK.S.A0021.Write + + - label: "Does the DUT(server) support the LEDSettings attribute?" + id: DRLK.S.A0022.Write + + - label: "Does the DUT(server) support the AutoRelockTime attribute?" + id: DRLK.S.A0023.Write + + - label: "Does the DUT(server) support the SoundVolume attribute?" + id: DRLK.S.A0024.Write + + - label: "Does the DUT(server) support the OperatingMode attribute?" + id: DRLK.S.A0025.Write + + - label: + "Does the DUT(server) support the EnableLocalProgramming attribute?" + id: DRLK.S.A0028.Write + + - label: "Does the DUT(server) support the EnableOneTouchLocking attribute?" + id: DRLK.S.A0029.Write + + - label: "Does the DUT(server) support the EnableInsideStatusLED attribute?" + id: DRLK.S.A002a.Write + + - label: + "Does the DUT(server) support the EnablePrivacyModeButton attribute?" + id: DRLK.S.A002b.Write + + - label: + "Does the DUT(server) support the LocalProgrammingFeatures attribute?" + id: DRLK.S.A002c.Write + + - label: "Does the DUT(server) support the WrongCodeEntryLimit attribute?" + id: DRLK.S.A0030.Write + + - label: + "Does the DUT(server) support the UserCodedTemporaryDisableTime + attribute?" + id: DRLK.S.A0031.Write + + - label: "Does the DUT(server) support the SendPINOverTheAir attribute?" + id: DRLK.S.A0032.Write + + - label: + "Does the DUT(server) support the RequirePINForRemoteOperation + attribute?" + id: DRLK.S.A0033.Write + + - label: "Does the DUT(server) support the ExpiringUserTimeOut attribute?" + id: DRLK.S.A0035.Write + # # server / commandsReceived # @@ -9301,3 +9379,69 @@ PICS: - label: "Does the device implement the (0xFFFD) ClusterRevision attribute ?" id: RNCONC.S.Afffd + + ## Fan control + + # Features + - label: "Does the device support multiple speeds from 0-100" + id: FAN.S.F00 + + - label: "Does the device support automatic mode" + id: FAN.S.F01 + + - label: "Does the device support rocking movement" + id: FAN.S.F02 + + - label: "Does the device support wind emulation" + id: FAN.S.F03 + + - label: "Does the device support the step command" + id: FAN.S.F04 + + - label: "Does the device support the direction attribute" + id: FAN.S.F05 + + # + # Server Attributes + # + - label: "Does the device implement the FanMode attribute?" + id: FAN.S.A0000 + + - label: "Does the device implement the FanModeSequence attribute?" + id: FAN.S.A0001 + + - label: "Does the device implement the PercentSetting attribute?" + id: FAN.S.A0002 + + - label: "Does the device implement the PercentCurrent attribute?" + id: FAN.S.A0003 + + - label: "Does the device implement the SpeedMax attribute?" + id: FAN.S.A0004 + + - label: "Does the device implement the SpeedSetting attribute?" + id: FAN.S.A0005 + + - label: "Does the device implement the SpeedCurrent attribute?" + id: FAN.S.A0006 + + - label: "Does the device implement the RockSupport attribute?" + id: FAN.S.A0007 + + - label: "Does the device implement the RockSetting attribute?" + id: FAN.S.A0008 + + - label: "Does the device implement the WindSupport attribute?" + id: FAN.S.A0009 + + - label: "Does the device implement the WindSetting attribute?" + id: FAN.S.A000A + + - label: "Does the device implement the AirflowDirection attribute?" + id: FAN.S.A000B + + # + #Server commands + # + - label: "Does the device implement receiving the Step command?" + id: FAN.S.C00.Rsp 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 new file mode 100644 index 00000000000000..1436be10bff296 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml @@ -0,0 +1,455 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 121.3.2. [TC-DRLK-2.12] Verification for Ubolt Door command [DUT-Server] + +PICS: + - DRLK.S + +config: + nodeId: 0x12344321 + cluster: "Door Lock" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Create new user" + command: "SetUser" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "OperationType" + value: 0 + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "xxx" + - name: "UserUniqueID" + value: 6452 + - name: "UserStatus" + value: 1 + - name: "UserType" + value: 0 + - name: "CredentialRule" + value: 0 + + - label: "Read the user back and verify its fields" + command: "GetUser" + arguments: + values: + - name: "UserIndex" + value: 1 + response: + values: + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "xxx" + - name: "UserUniqueID" + value: 6452 + - name: "UserStatus" + value: 1 + - name: "UserType" + value: 0 + - name: "CredentialRule" + value: 0 + - name: "Credentials" + value: [] + - name: "CreatorFabricIndex" + value: 1 + - name: "LastModifiedFabricIndex" + value: 1 + - name: "NextUserIndex" + value: null + + - label: "Create new PIN credential and lock/unlock user" + command: "SetCredential" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "OperationType" + value: 0 + - name: "Credential" + value: { CredentialType: 1, CredentialIndex: 1 } + - name: "CredentialData" + value: "123456" + - name: "UserIndex" + value: 1 + - name: "UserStatus" + value: null + - name: "UserType" + value: null + response: + values: + - name: "Status" + value: 0 + - name: "UserIndex" + value: null + - name: "NextCredentialIndex" + value: 2 + + - label: "Verify created PIN credential" + command: "GetCredentialStatus" + arguments: + values: + - name: "Credential" + value: { CredentialType: 1, CredentialIndex: 1 } + response: + values: + - name: "CredentialExists" + value: true + - name: "UserIndex" + value: 1 + - name: "CreatorFabricIndex" + value: 1 + - name: "LastModifiedFabricIndex" + value: 1 + - name: "NextCredentialIndex" + value: null + + - label: + "Step 1: TH writes the RequirePINforRemoteOperation attribute value as + False on the DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + command: "writeAttribute" + attribute: "RequirePINforRemoteOperation" + arguments: + value: false + + - label: + "Step 1: TH writes the RequirePINforRemoteOperation attribute value as + False on the DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write + command: "writeAttribute" + attribute: "RequirePINforRemoteOperation" + arguments: + value: false + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 2: TH reads the RequirePINforRemoteOperation attribute from the + DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033 + command: "readAttribute" + attribute: "RequirePINforRemoteOperation" + response: + value: false + + - label: "Step 3: TH sends Ubolt Door Command to the DUT without PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + + - label: "Step 4: TH sends Ubolt Door Command to the DUT with PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + + - label: + "Step 5: TH writes the RequirePINforRemoteOperation attribute value as + true on the DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + command: "writeAttribute" + attribute: "RequirePINforRemoteOperation" + arguments: + value: true + + - label: + "Step 5: TH writes the RequirePINforRemoteOperation attribute value as + true on the DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write + command: "writeAttribute" + attribute: "RequirePINforRemoteOperation" + arguments: + value: true + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 6: TH reads the RequirePINforRemoteOperation attribute from the + DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033 + command: "readAttribute" + attribute: "RequirePINforRemoteOperation" + response: + value: true + + - label: "Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + + - label: + "Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123458" + response: + error: FAILURE + + - label: "Step 9: TH sends Unbolt Door Command to the DUT without PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + response: + error: FAILURE + + - label: + "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the + DUT" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write + command: "writeAttribute" + attribute: "WrongCodeEntryLimit" + arguments: + value: 3 + + - label: + "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the + DUT" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write + command: "writeAttribute" + attribute: "WrongCodeEntryLimit" + arguments: + value: 3 + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 + Seconds on the DUT and Verify that the DUT sends Success response" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write + command: "writeAttribute" + attribute: "UserCodeTemporaryDisableTime" + arguments: + value: 15 + + - label: + "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 + Seconds on the DUT and Verify that the DUT sends Success response" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write + command: "writeAttribute" + attribute: "UserCodeTemporaryDisableTime" + arguments: + value: 15 + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 12a: TH sends Unbolt Door Command to the DUT with invalid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123457" + response: + error: FAILURE + + - label: + "Step 12b: TH sends Unbolt Door Command to the DUT with invalid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123458" + response: + error: FAILURE + + - label: + "Step 12c: TH sends Unbolt Door Command to the DUT with invalid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123459" + response: + error: FAILURE + + - label: + "Step 12d: TH sends Unbolt Door Command to the DUT with invalid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123460" + response: + error: FAILURE + + - label: + "Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031 + command: "readAttribute" + attribute: "UserCodeTemporaryDisableTime" + response: + value: 15 + + - label: + "Step 14: TH sends Unbolt Door Command to the DUT with valid PINCode + before UserCodeTemporaryDisableTime expires" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + response: + error: FAILURE + + - label: "Wait for UserCodeTemporaryDisableTime expires" + cluster: "DelayCommands" + command: "WaitForMs" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031 + arguments: + values: + - name: "ms" + value: 15000 + + - label: + "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on + the DUT" + PICS: DRLK.S.A0023.Write && PICS_SDK_CI_ONLY + command: "writeAttribute" + attribute: "AutoRelockTime" + arguments: + value: 10 + + - label: + "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on + the DUT" + PICS: DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP + command: "writeAttribute" + attribute: "AutoRelockTime" + arguments: + value: 60 + + - label: + "Step 15: TH writes AutoRelockTime attribute value as 10 seconds on + the DUT" + PICS: PICS_SDK_CI_ONLY && !DRLK.S.A0023.Write + command: "writeAttribute" + attribute: "AutoRelockTime" + arguments: + value: 10 + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on + the DUT" + PICS: PICS_SKIP_SAMPLE_APP && !DRLK.S.A0023.Write + command: "writeAttribute" + attribute: "AutoRelockTime" + arguments: + value: 60 + response: + error: UNSUPPORTED_WRITE + + - label: "Step 16: TH reads the AutoRelockTime attribute from the DUT" + PICS: DRLK.S.A0023 && PICS_SDK_CI_ONLY + command: "readAttribute" + attribute: "AutoRelockTime" + response: + value: 10 + + - label: "Step 16: TH reads the AutoRelockTime attribute from the DUT" + PICS: DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP + command: "readAttribute" + attribute: "AutoRelockTime" + response: + value: 60 + + - label: + "Step 17: TH sends the Unbolt Door command to the DUT with valid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + + - label: "Wait for AutoRelockTime Expires" + cluster: "DelayCommands" + command: "WaitForMs" + PICS: DRLK.S.A0023 && PICS_SDK_CI_ONLY + arguments: + values: + - name: "ms" + value: 10000 + + - label: "Wait for AutoRelockTime Expires" + cluster: "DelayCommands" + command: "WaitForMs" + PICS: DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP + arguments: + values: + - name: "ms" + value: 60000 + + - label: "Step 18: TH reads LockState attribute" + PICS: DRLK.S.A0000 && DRLK.S.C01.Rsp + command: "readAttribute" + attribute: "LockState" + response: + value: 1 + + - label: "Cleanup the created user" + command: "ClearUser" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "UserIndex" + value: 1 + + - label: "Clean the created credential" + PICS: DRLK.S.C26.Rsp + command: "ClearCredential" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "Credential" + value: { CredentialType: 1, CredentialIndex: 1 } 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 45df632606a5e3..10720a900e55e4 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 @@ -224,7 +224,7 @@ tests: - label: "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 + PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write command: "writeAttribute" attribute: "WrongCodeEntryLimit" arguments: @@ -233,7 +233,7 @@ tests: - label: "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 + PICS: DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write command: "writeAttribute" attribute: "WrongCodeEntryLimit" arguments: @@ -244,7 +244,7 @@ tests: - label: "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 + PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write command: "writeAttribute" attribute: "UserCodeTemporaryDisableTime" arguments: @@ -253,7 +253,7 @@ tests: - label: "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 + PICS: DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write command: "writeAttribute" attribute: "UserCodeTemporaryDisableTime" arguments: @@ -335,21 +335,21 @@ tests: value: 15000 - label: "TH writes AutoRelockTime attribute value as 10 seconds on the DUT" - PICS: DRLK.S.A0023 && PICS_SDK_CI_ONLY + PICS: DRLK.S.A0023.Write && PICS_SDK_CI_ONLY command: "writeAttribute" attribute: "AutoRelockTime" arguments: value: 10 - label: "TH writes AutoRelockTime attribute value as 60 seconds on the DUT" - PICS: DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP + PICS: DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP command: "writeAttribute" attribute: "AutoRelockTime" arguments: value: 60 - label: "TH writes AutoRelockTime attribute value as 10 seconds on the DUT" - PICS: "!DRLK.S.A0023 && PICS_SDK_CI_ONLY" + PICS: " !DRLK.S.A0023.Write && PICS_SDK_CI_ONLY " command: "writeAttribute" attribute: "AutoRelockTime" arguments: @@ -358,7 +358,7 @@ tests: error: UNSUPPORTED_WRITE - label: "TH writes AutoRelockTime attribute value as 60 seconds on the DUT" - PICS: "!DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP" + PICS: " !DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP " command: "writeAttribute" attribute: "AutoRelockTime" arguments: diff --git a/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml b/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml new file mode 100644 index 00000000000000..eabed515952248 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml @@ -0,0 +1,188 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.1.1. [TC-FAN-1.1] Global attributes with DUT as Server + +PICS: + - FAN.S + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + #Issue : https://github.com/project-chip/connectedhomeip/issues/27320 + - label: "Read the global attribute: ClusterRevision" + verification: | + ./chip-tool fancontrol read cluster-revision 1 1 + + On TH(chip-tool), Verify the ClusterRevision attribute value as 3: + + [1685097285.665923][29977:29979] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0202 Attribute 0x0000_FFFD DataVersion: 2714837972 + [1685097285.666069][29977:29979] CHIP:TOO: ClusterRevision: 2 + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: + " !FAN.S.F00 && !FAN.S.F01 && !FAN.S.F02 && !FAN.S.F03 && !FAN.S.F04 + && !FAN.S.F05 " + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given FAN.S.F00(Condition) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given FAN.S.F01(Warning) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given FAN.S.F02(Condition) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4] + + - label: + "Given FAN.S.F03(Warning) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8] + + - label: + "Given FAN.S.F04(Warning) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10] + + - label: + "Given FAN.S.F05(Warning) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1, 2, 3, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent FAN.S.F00 (SPD) attribute in AttributeList" + PICS: FAN.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [4, 5, 6] + + - label: + "Read the feature dependent FAN.S.F02(RCK) attribute in AttributeList" + PICS: FAN.S.F02 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [7, 8] + + - label: + "Read the feature dependent FAN.S.F03(WND) attribute in AttributeList" + PICS: FAN.S.F03 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [9, 10] + + - label: + "Read the feature dependent FAN.S.F05(DIR) attribute in AttributeList" + PICS: FAN.S.F05 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [11] + + - label: "Read the global attribute: AcceptedCommandList" + PICS: " !FAN.S.C00.Rsp " + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + value: [] + constraints: + type: list + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: FAN.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] diff --git a/src/app/tests/suites/certification/Test_TC_FAN_2_1.yaml b/src/app/tests/suites/certification/Test_TC_FAN_2_1.yaml new file mode 100644 index 00000000000000..e9575ba38acbb7 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_2_1.yaml @@ -0,0 +1,72 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.1. [TC-FAN-2.1] Mandatory Attributes with DUT as Server + +PICS: + - FAN.S + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the the FanMode attribute" + PICS: FAN.S.A0000 + command: "readAttribute" + attribute: "FanMode" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 6 + + - label: "TH reads from the DUT the the FanModeSequence attribute" + PICS: FAN.S.A0001 + command: "readAttribute" + attribute: "FanModeSequence" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 5 + + - label: "TH reads from the DUT the the PercentSetting attribute" + PICS: FAN.S.A0002 + command: "readAttribute" + attribute: "PercentSetting" + response: + constraints: + type: int8u + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the the PercentCurrent attribute" + PICS: FAN.S.A0003 + command: "readAttribute" + attribute: "PercentCurrent" + response: + constraints: + type: int8u + minValue: 0 + maxValue: 100 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_2_2.yaml b/src/app/tests/suites/certification/Test_TC_FAN_2_2.yaml new file mode 100644 index 00000000000000..9c7bf546a44ae3 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_2_2.yaml @@ -0,0 +1,64 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.2. [TC-FAN-2.2] Optional speed attributes with DUT as Server + +PICS: + - FAN.S + - FAN.S.F00 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the the SpeedMax attribute" + PICS: FAN.S.A0004 + command: "readAttribute" + attribute: "SpeedMax" + response: + saveAs: SpeedMaxValue + constraints: + type: int8u + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the the SpeedSetting attribute" + PICS: FAN.S.A0005 && FAN.S.A0004 + command: "readAttribute" + attribute: "SpeedSetting" + response: + constraints: + type: int8u + minValue: 0 + maxValue: SpeedMaxValue + + - label: "TH reads from the DUT the the SpeedCurrent attribute" + PICS: FAN.S.A0006 && FAN.S.A0004 + command: "readAttribute" + attribute: "SpeedCurrent" + response: + constraints: + type: int8u + minValue: 0 + maxValue: SpeedMaxValue diff --git a/src/app/tests/suites/certification/Test_TC_FAN_2_3.yaml b/src/app/tests/suites/certification/Test_TC_FAN_2_3.yaml new file mode 100644 index 00000000000000..0c6141c77e41f6 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_2_3.yaml @@ -0,0 +1,49 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.3. [TC-FAN-2.3] Optional rock attributes with DUT as Server + +PICS: + - FAN.S + - FAN.S.F02 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the the RockSupport attribute" + PICS: FAN.S.A0007 + command: "readAttribute" + attribute: "RockSupport" + response: + constraints: + type: bitmap8 + + - label: "TH reads from the DUT the the RockSetting attribute" + PICS: FAN.S.A0008 + command: "readAttribute" + attribute: "RockSetting" + response: + constraints: + type: bitmap8 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_2_4.yaml b/src/app/tests/suites/certification/Test_TC_FAN_2_4.yaml new file mode 100644 index 00000000000000..d73f364456fcec --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_2_4.yaml @@ -0,0 +1,49 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.4. [TC-FAN-2.4] Optional wind attributes with DUT as Server + +PICS: + - FAN.S + - FAN.S.F03 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the the WindSupport attribute" + PICS: FAN.S.A0009 + command: "readAttribute" + attribute: "WindSupport" + response: + constraints: + type: bitmap8 + + - label: "TH reads from the DUT the the WindSetting attribute" + PICS: FAN.S.A000A + command: "readAttribute" + attribute: "WindSetting" + response: + constraints: + type: bitmap8 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml b/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml new file mode 100644 index 00000000000000..217821b5aebbeb --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml @@ -0,0 +1,144 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.6. [TC-FAN-3.1] Mandatory functionality with DUT as Server + +PICS: + - FAN.S + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + ConfigPercentSetting: + type: int8u + defaultValue: 30 + +tests: + - label: "Step 1: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: + "Step 2a: TH writes a supported FanMode attribute that is other than + off to DUT" + PICS: FAN.S.A0000 + command: "writeAttribute" + attribute: "FanMode" + arguments: + value: 3 + + - label: "Wait 1000ms" + PICS: FAN.S.A0000 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 2b: TH reads from the DUT the the FanMode attribute" + PICS: FAN.S.A0000 + command: "readAttribute" + attribute: "FanMode" + response: + value: 3 + + - label: "Step 2.1a: TH writes the Off value of FanMode attribute to DUT" + PICS: FAN.S.A0000 + command: "writeAttribute" + attribute: "FanMode" + arguments: + value: 0 + + - label: "Wait 1000ms" + PICS: FAN.S.A0000 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 2.1b: TH reads from the DUT the PercentSetting attribute" + PICS: FAN.S.A0002 + command: "readAttribute" + attribute: "PercentSetting" + response: + value: 0 + + - label: "Step 2.1c: TH reads from the DUT the PercentCurrent attribute" + PICS: FAN.S.A0003 + command: "readAttribute" + attribute: "PercentCurrent" + response: + value: 0 + + - label: + "Step 3a: TH writes PercentSetting attribute a non-zero value to DUT" + PICS: FAN.S.A0002 + command: "writeAttribute" + attribute: "PercentSetting" + arguments: + value: ConfigPercentSetting + + - label: "Wait 1000ms" + PICS: FAN.S.A0002 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 3b: TH reads from the DUT the PercentCurrent attribute" + PICS: FAN.S.A0003 + command: "readAttribute" + attribute: "PercentCurrent" + response: + value: ConfigPercentSetting + + - label: "Step 3c: TH reads from the DUT the PercentSetting attribute" + PICS: FAN.S.A0002 + command: "readAttribute" + attribute: "PercentSetting" + response: + value: ConfigPercentSetting + + - label: "Step 3.1a: TH writes PercentSetting attribute a zero value to DUT" + PICS: FAN.S.A0002 + command: "writeAttribute" + attribute: "PercentSetting" + arguments: + value: 0 + + - label: "Wait 1000ms" + PICS: FAN.S.A0002 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 3.1b: TH reads from the DUT the the FanMode attribute" + PICS: FAN.S.A0000 + command: "readAttribute" + attribute: "FanMode" + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml b/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml new file mode 100644 index 00000000000000..d2130d7fcf1216 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml @@ -0,0 +1,66 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.7. [TC-FAN-3.2] Optional speed functionality with DUT as Server + +PICS: + - FAN.S + - FAN.S.F00 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + ConfigSpeedSetting: + type: int8u + defaultValue: 50 + +tests: + - label: "Step 1: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 2: TH writes SpeedSetting attribute a valid value to DUT" + PICS: FAN.S.A0005 + command: "writeAttribute" + attribute: "SpeedSetting" + arguments: + value: ConfigSpeedSetting + + - label: "Wait 1000ms" + PICS: FAN.S.A0005 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 3: TH reads from the DUT the the SpeedSetting attribute" + PICS: FAN.S.A0005 + command: "readAttribute" + attribute: "SpeedSetting" + response: + value: ConfigSpeedSetting + + - label: "Step 4: TH reads from the DUT the the SpeedCurrent attribute" + PICS: FAN.S.A0006 + command: "readAttribute" + attribute: "SpeedCurrent" + response: + value: ConfigSpeedSetting diff --git a/src/app/tests/suites/certification/Test_TC_FAN_3_4.yaml b/src/app/tests/suites/certification/Test_TC_FAN_3_4.yaml new file mode 100644 index 00000000000000..3b38aa97f30495 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_3_4.yaml @@ -0,0 +1,59 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.9. [TC-FAN-3.4] Optional wind functionality with DUT as Server + +PICS: + - FAN.S + - FAN.S.F03 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + ConfigWindSetting: + type: bitmap8 + defaultValue: 1 + +tests: + - label: "Step 1: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 2: TH writes WindSetting attribute a valid value to DUT" + PICS: FAN.S.A0008 + command: "writeAttribute" + attribute: "WindSetting" + arguments: + value: ConfigWindSetting + + - label: "Wait 1000ms" + PICS: FAN.S.A0008 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 3: TH reads from the DUT the the WindSetting attribute" + PICS: FAN.S.A0008 + command: "readAttribute" + attribute: "WindSetting" + response: + value: ConfigWindSetting diff --git a/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml index 907eae64ca7980..e23342eade6a4b 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml @@ -16,6 +16,7 @@ name: 24.6.1. [TC-LVL-6.1] Stop Verification (DUT as Server) PICS: - LVL.S + - LVL.S.M.VarRate config: nodeId: 0x12344321 diff --git a/src/app/tests/suites/certification/Test_TC_LVL_7_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_7_1.yaml index 31aedbdc90904e..05fed1f640e8c3 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_7_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_7_1.yaml @@ -23,204 +23,213 @@ PICS: config: nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 + cluster: "Level Control" + endpoint: 1 + RandomLevelValue: + type: int8u + defaultValue: 100 + RandomFrequencyValue: + type: int16u + defaultValue: 30000 tests: - - label: "TH writes 0x00 to the Options attribute" + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + #Adding below step resolve the issue https://github.com/CHIP-Specifications/chip-certification-tool/issues/499 + - label: + "Precondition: write default value of OnOffTransitionTime attribute" + PICS: LVL.S.A0010 + command: "writeAttribute" + attribute: "OnOffTransitionTime" + arguments: + value: 0 + + - label: "Step 0a: TH writes 0 to the Options attribute" PICS: LVL.S.A000f - verification: | - ./chip-tool levelcontrol write options 0x00 1 1 - verify that DUT sends a success response On TH(chip-tool) - [1658732283.094610][3087:3092] CHIP:DMG: WriteResponseMessage = - [1658732283.094656][3087:3092] CHIP:DMG: { - [1658732283.094696][3087:3092] CHIP:DMG: AttributeStatusIBs = - [1658732283.094863][3087:3092] CHIP:DMG: [ - [1658732283.094914][3087:3092] CHIP:DMG: AttributeStatusIB = - [1658732283.094965][3087:3092] CHIP:DMG: { - [1658732283.095012][3087:3092] CHIP:DMG: AttributePathIB = - [1658732283.095068][3087:3092] CHIP:DMG: { - [1658732283.095129][3087:3092] CHIP:DMG: Endpoint = 0x1, - [1658732283.095197][3087:3092] CHIP:DMG: Cluster = 0x8, - [1658732283.095259][3087:3092] CHIP:DMG: Attribute = 0x0000_000F, - [1658732283.095322][3087:3092] CHIP:DMG: } - [1658732283.095385][3087:3092] CHIP:DMG: - [1658732283.095446][3087:3092] CHIP:DMG: StatusIB = - [1658732283.095505][3087:3092] CHIP:DMG: { - [1658732283.095564][3087:3092] CHIP:DMG: status = 0x00 (SUCCESS), - [1658732283.095626][3087:3092] CHIP:DMG: }, - [1658732283.095682][3087:3092] CHIP:DMG: - [1658732283.095731][3087:3092] CHIP:DMG: }, - [1658732283.095786][3087:3092] CHIP:DMG: - [1658732283.095830][3087:3092] CHIP:DMG: ], - [1658732283.095883][3087:3092] CHIP:DMG: - [1658732283.095927][3087:3092] CHIP:DMG: InteractionModelRevision = 1 - [1658732283.095970][3087:3092] CHIP:DMG: } - disabled: true - - - label: "TH sends On command to DUT" - PICS: OO.S.C01.Rsp - verification: | - ./chip-tool onoff on 1 1 - verify that DUT sends a success response On TH(chip-tool) - [1658731148.428641][2894:2899] CHIP:DMG: InteractionModelRevision = 1 - [1658731148.428665][2894:2899] CHIP:DMG: }, - [1658731148.428723][2894:2899] CHIP:DMG: Received Command Response Status for Endpoint=1 Cluster=0x0000_0006 Command=0x0000_0001 Status=0x0 - [1658731148.428766][2894:2899] CHIP:DMG: ICR moving to [AwaitingDe] - [1658731148.428828][2894:2899] CHIP:EM: Sending Standalone Ack for MessageCounter:77812182 on exchange 38946i - disabled: true - - - label: "TH reads the MinLevel attribute from the DUT" - PICS: LVL.S.A0002 - verification: | - ./chip-tool levelcontrol read min-level 1 1 - - Record the MinLevel attribute value for usage in later steps, this is optional attribute implemented in RPI, may vary based on DUT implementation on TH(chip-tool) log + command: "writeAttribute" + attribute: "Options" + arguments: + value: 0 - [1658919507.800574][3717:3722] CHIP:DMG: } - [1658919507.800774][3717:3722] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0002 DataVersion: 3233313015 - [1658919507.800931][3717:3722] CHIP:TOO: min level: 1 - [1658919507.801058][3717:3722] CHIP:EM: Sending Standalone Ack for MessageCounter:165803473 on exchange 38651i - disabled: true + - label: "Step 0b: TH sends On command to DUT" + cluster: "On/Off" + PICS: OO.S.C01.Rsp + command: "On" - - label: "TH reads the MaxLevel attribute from the DUT" + - label: "Step 1a: TH reads the MinLevel attribute from the DUT" + PICS: LVL.S.A0002 + command: "readAttribute" + attribute: "MinLevel" + response: + saveAs: minLevelValue + constraints: + type: int8u + minValue: 0 + maxValue: 254 + + - label: "Step 1b: TH reads the MaxLevel attribute from the DUT" PICS: LVL.S.A0003 - verification: | - ./chip-tool levelcontrol read max-level 1 1 - Record the MaxLevel attribute value for usage in later steps, this is optional attribute implemented in RPI, may vary based on DUT implementation on TH(chip-tool) log - - - [1654065684.869569][10048:10053] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0003 DataVersion: 540248549 - [1654065684.869621][10048:10053] CHIP:TOO: max level: 254 - [1654065684.869737][10048:10053] CHIP:EM: Sending Standalone Ack for MessageCounter:9018536 on exchange 12814i - disabled: true + command: "readAttribute" + attribute: "MaxLevel" + response: + saveAs: maxLevelValue + constraints: + type: int8u + minValue: 0 + maxValue: 254 - label: - "TH sends a MoveToLevel command to DUT, with the Level field set to a - value between the MinLevel and MaxLevel values (if present, otherwise - between 0x01 and 0xFE) and the TransitionTime field set to 0x0000 - (move immediately)." + "Step 1c: TH sends a MoveToLevel command to DUT, with the Level field + set to a value between the MinLevel and MaxLevel values (if present, + otherwise between 0x01 and 0xFE) and the TransitionTime field set to + 0x0000 (move immediately)." PICS: LVL.S.C00.Rsp - verification: | - ./chip-tool levelcontrol move-to-level 253 0 0 0 1 1 - verify that DUT sends a successful (value 0x00) status response on TH(chip-tool) log - - - [1661759404.121731][104632:104637] CHIP:DMG: InvokeResponseMessage = - [1661759404.121739][104632:104637] CHIP:DMG: { - [1661759404.121750][104632:104637] CHIP:DMG: suppressResponse = false, - [1661759404.121759][104632:104637] CHIP:DMG: InvokeResponseIBs = - [1661759404.121774][104632:104637] CHIP:DMG: [ - [1661759404.121782][104632:104637] CHIP:DMG: InvokeResponseIB = - [1661759404.121797][104632:104637] CHIP:DMG: { - [1661759404.121805][104632:104637] CHIP:DMG: CommandStatusIB = - [1661759404.121817][104632:104637] CHIP:DMG: { - [1661759404.121826][104632:104637] CHIP:DMG: CommandPathIB = - [1661759404.121838][104632:104637] CHIP:DMG: { - [1661759404.121849][104632:104637] CHIP:DMG: EndpointId = 0x1, - [1661759404.121862][104632:104637] CHIP:DMG: ClusterId = 0x8, - [1661759404.121871][104632:104637] CHIP:DMG: CommandId = 0x0, - [1661759404.121878][104632:104637] CHIP:DMG: }, - [1661759404.121889][104632:104637] CHIP:DMG: - [1661759404.121896][104632:104637] CHIP:DMG: StatusIB = - [1661759404.121906][104632:104637] CHIP:DMG: { - [1661759404.121914][104632:104637] CHIP:DMG: status = 0x00 (SUCCESS), - [1661759404.121922][104632:104637] CHIP:DMG: }, - [1661759404.121930][104632:104637] CHIP:DMG: - [1661759404.121937][104632:104637] CHIP:DMG: }, - [1661759404.121947][104632:104637] CHIP:DMG: - [1661759404.121954][104632:104637] CHIP:DMG: }, - [1661759404.121964][104632:104637] CHIP:DMG: - [1661759404.121970][104632:104637] CHIP:DMG: ], - [1661759404.121981][104632:104637] CHIP:DMG: - [1661759404.121988][104632:104637] CHIP:DMG: InteractionModelRevision = 1 - [1661759404.121995][104632:104637] CHIP:DMG: }, - [1661759404.122021][104632:104637] CHIP:DMG: Received Command Response Status for Endpoint=1 Cluster=0x0000_0008 Command=0x0000_0000 Status=0x0 - [1661759404.122040][104632:104637] CHIP:DMG: ICR moving to [AwaitingDe] - disabled: true - - - label: "TH reads CurrentLevel attribute from DUT" + command: "MoveToLevel" + arguments: + values: + - name: "Level" + value: RandomLevelValue + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Step 1d: TH reads CurrentLevel attribute from DUT" PICS: LVL.S.C00.Rsp && LVL.S.A0000 - verification: | - ./chip-tool levelcontrol read current-level 1 1 - verify that the CurrentLevel attribute has the value given in 1c On TH(chip-tool) + command: "readAttribute" + attribute: "CurrentLevel" + response: + value: RandomLevelValue - [1654065859.401140][10188:10193] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0000 DataVersion: 540248551 - [1654065859.401197][10188:10193] CHIP:TOO: current level: 253 - [1654065859.401268][10188:10193] CHIP:EM: Sending Standalone Ack for MessageCounter:2942065 on exchange 21982i - disabled: true - - - label: "TH reads the CurrentFrequency attribute." + - label: "Step 2a: TH reads the CurrentFrequency attribute." PICS: LVL.S.A0004 - verification: | - ./chip-tool levelcontrol read current-frequency 1 1 - verify the CurrentFrequency attribute value On TH(chip-tool) - [1654065889.927185][10196:10201] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0004 DataVersion: 540248551 - [1654065889.927213][10196:10201] CHIP:TOO: current frequency: 0 - [1654065889.927247][10196:10201] CHIP:EM: Sending Standalone Ack for MessageCounter:9499985 on exchange 53579i - disabled: true - - - label: "TH reads the MinFrequency attribute." + command: "readAttribute" + attribute: "CurrentFrequency" + response: + saveAs: CurrentFrequencyValue + constraints: + type: int16u + minValue: 0 + maxValue: 65535 + + - label: "Step 2b: TH reads the MinFrequency attribute." PICS: LVL.S.A0005 - verification: | - ./chip-tool levelcontrol read min-frequency 1 1 - verify the MinFrequency attribute value On TH(chip-tool) - - [1654066011.412756][10228:10233] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0005 DataVersion: 540248551 - [1654066011.412814][10228:10233] CHIP:TOO: min frequency: 0 - [1654066011.412890][10228:10233] CHIP:EM: Sending Standalone Ack for MessageCounter:4631273 on exchange 37550i - disabled: true + command: "readAttribute" + attribute: "MinFrequency" + response: + saveAs: MinFrequencyValue + constraints: + type: int16u + minValue: 0 + maxValue: 65535 - - label: "TH reads the MaxFrequency attribute." + - label: + "Step 2c: TH reads the MaxFrequency attribute and check, if fmax < + fmin, FAIL the test." PICS: LVL.S.A0006 - verification: | - ./chip-tool levelcontrol read max-frequency 1 1 - verify the MaxFrequency attribute value On TH(chip-tool) - - [1654066035.586373][10241:10246] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0006 DataVersion: 540248551 - [1654066035.586435][10241:10246] CHIP:TOO: max frequency: 0 - [1654066035.586512][10241:10246] CHIP:EM: Sending Standalone Ack for MessageCounter:13631899 on exchange 38194i - disabled: true + command: "readAttribute" + attribute: "MaxFrequency" + response: + saveAs: MaxFrequencyValue + constraints: + type: int16u + minValue: MinFrequencyValue + maxValue: 65535 - label: - "TH sends a MoveToClosestFrequency command to DUT, with the frequency - field set to a random value frand, chosen such that: fmin < frand < - fmax" - PICS: LVL.S.C08.Rsp - verification: | - Frequency feature is Optional & is not verifiable at this moment. Please skip this step - disabled: true - - - label: "TH reads the CurrentFrequency attribute." - PICS: LVL.S.C08.Rsp && LVL.S.A0004 - verification: | - ./chip-tool levelcontrol read current-frequency 1 1 - disabled: true + "Step 2d: sanity check on values read in steps 2a..2c, if fc < fmin, + FAIL the test and fc > fmax, FAIL the test" + PICS: LVL.S.A0004 + command: "readAttribute" + attribute: "CurrentFrequency" + response: + constraints: + type: int16u + minValue: MinFrequencyValue + maxValue: MaxFrequencyValue - label: - "TH sends a MoveToClosestFrequency command to DUT, with the frequency - field set to fmax + 1" + "Step 3a: TH sends a MoveToClosestFrequency command to DUT, with the + frequency field set to a random value frand, chosen such that: fmin < + frand < fmax" PICS: LVL.S.C08.Rsp - verification: | - Optional command based on Feature support - disabled: true - - - label: "TH reads the CurrentFrequency attribute." + command: "MoveToClosestFrequency" + arguments: + values: + - name: "Frequency" + value: RandomFrequencyValue + + - label: "Wait 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Step 3b: TH reads the CurrentFrequency attribute." PICS: LVL.S.C08.Rsp && LVL.S.A0004 - verification: | - ./chip-tool levelcontrol read current-frequency 1 1 - disabled: true + command: "readAttribute" + attribute: "CurrentFrequency" + response: + value: RandomFrequencyValue - label: - "TH sends a MoveToClosestFrequency command to DUT, with the frequency - field set to fmin - 1" - PICS: LVL.S.C08.Rsp + "Step 4a: TH sends a MoveToClosestFrequency command to DUT, with the + frequency field set to fmax + 1" + PICS: LVL.S.C08.Rsp && PICS_USER_PROMPT verification: | Frequency feature is Optional & is not verifiable at this moment. Please skip this step - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Step 4b: TH reads the CurrentFrequency attribute." + PICS: LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT + command: "readAttribute" + attribute: "CurrentFrequency" + response: + value: RandomFrequencyValue - - label: "TH reads the CurrentFrequency attribute." - PICS: LVL.S.C08.Rsp && LVL.S.A0004 + - label: + "Step 5a: TH sends a MoveToClosestFrequency command to DUT, with the + frequency field set to fmin - 1" + PICS: LVL.S.C08.Rsp && PICS_USER_PROMPT verification: | - ./chip-tool levelcontrol read current-frequency 1 1 - disabled: true + Frequency feature is Optional & is not verifiable at this moment. Please skip this step + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Step 5b: TH reads the CurrentFrequency attribute." + PICS: LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT + command: "readAttribute" + attribute: "CurrentFrequency" + response: + value: RandomFrequencyValue diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index bc2daf1bc488b6..52ca1f4b04899a 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -490,7 +490,7 @@ LVL.S.C04.Rsp=1 LVL.S.C05.Rsp=1 LVL.S.C06.Rsp=1 LVL.S.C07.Rsp=1 -LVL.S.C08.Rsp=1 +LVL.S.C08.Rsp=0 LVL.S.M.VarRate=1 LVL.C=1 @@ -1467,6 +1467,30 @@ DRLK.S.A0032=1 DRLK.S.A0033=1 DRLK.S.A0035=1 +#ReadOnly attributes +DRLK.S.A0028.ReadOnly=1 +DRLK.S.A002c.ReadOnly=1 + +#write attributes +DRLK.S.A0004.Write=0 +DRLK.S.A0005.Write=0 +DRLK.S.A0006.Write=0 +DRLK.S.A0021.Write=1 +DRLK.S.A0022.Write=0 +DRLK.S.A0023.Write=1 +DRLK.S.A0024.Write=1 +DRLK.S.A0025.Write=1 +DRLK.S.A0028.Write=0 +DRLK.S.A0029.Write=1 +DRLK.S.A002a.Write=1 +DRLK.S.A002b.Write=1 +DRLK.S.A002c.Write=1 +DRLK.S.A0030.Write=1 +DRLK.S.A0031.Write=1 +DRLK.S.A0032.Write=1 +DRLK.S.A0033.Write=1 +DRLK.S.A0035.Write=0 + DRLK.C=1 DRLK.C.F0a=0 DRLK.C.F0b=0 @@ -2529,3 +2553,30 @@ RNCONC.S.Afffa=1 RNCONC.S.Afffb=1 RNCONC.S.Afffc=1 RNCONC.S.Afffd=1 + +# Fan Control + +#Features +FAN.S.F00=1 +FAN.S.F01=1 +FAN.S.F02=0 +FAN.S.F03=0 +FAN.S.F04=0 +FAN.S.F05=0 + +#Server Attributes +FAN.S.A0000=1 +FAN.S.A0001=1 +FAN.S.A0002=1 +FAN.S.A0003=1 +FAN.S.A0004=1 +FAN.S.A0005=1 +FAN.S.A0006=1 +FAN.S.A0007=1 +FAN.S.A0008=1 +FAN.S.A0009=1 +FAN.S.A000A=1 +FAN.S.A000B=1 + +#Server commands +FAN.S.C00.Rsp=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 156d22d600efe8..b0c40ab16561f4 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -57,6 +57,16 @@ "DiagnosticsLogs": ["Test_TC_DLOG_1_1"], "FlowMeasurement": ["Test_TC_FLW_1_1", "Test_TC_FLW_2_1"], "FixedLabel": ["Test_TC_FLABEL_1_1", "Test_TC_FLABEL_2_1"], + "FanControl": [ + "Test_TC_FAN_1_1", + "Test_TC_FAN_2_1", + "Test_TC_FAN_2_2", + "Test_TC_FAN_2_3", + "Test_TC_FAN_2_4", + "Test_TC_FAN_3_1", + "Test_TC_FAN_3_2", + "Test_TC_FAN_3_4" + ], "GeneralCommissioning": ["Test_TC_CGEN_1_1", "Test_TC_CGEN_2_1"], "GeneralDiagnostics": ["Test_TC_DGGEN_1_1", "Test_TC_DGGEN_2_1"], "Identify": [ @@ -82,7 +92,8 @@ "Test_TC_LVL_3_1", "Test_TC_LVL_4_1", "Test_TC_LVL_5_1", - "Test_TC_LVL_6_1" + "Test_TC_LVL_6_1", + "Test_TC_LVL_7_1" ], "LocalizationConfiguration": ["Test_TC_LCFG_1_1"], "TimeFormatLocalization": ["Test_TC_LTIME_1_2"], @@ -264,7 +275,8 @@ "Test_TC_DRLK_2_6", "Test_TC_DRLK_2_7", "Test_TC_DRLK_2_9", - "Test_TC_DRLK_2_11" + "Test_TC_DRLK_2_11", + "Test_TC_DRLK_2_12" ], "Groups": [ "TestGroupMessaging", @@ -339,6 +351,7 @@ "EthernetNetworkDiagnostics", "FlowMeasurement", "FixedLabel", + "FanControl", "GeneralCommissioning", "GeneralDiagnostics", "Identify", diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index ad01f9f5eb80ec..215812bfef9f43 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -264,7 +264,7 @@ "Test_TC_DRLK_3_3" ], "LocalizationConfiguration": ["Test_TC_LCFG_2_1"], - "LevelControl": ["Test_TC_LVL_7_1", "Test_TC_LVL_8_1"], + "LevelControl": ["Test_TC_LVL_8_1"], "OnOff": ["Test_TC_OO_2_3"], "RelativeHumidityMeasurement": ["Test_TC_RH_2_2"], "Switch": ["Test_TC_SWTCH_2_2", "Test_TC_SWTCH_3_2"], diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 676f52894f4490..9e921715689829 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -109,6 +109,14 @@ class TestList : public Command printf("Test_TC_FLW_2_1\n"); printf("Test_TC_FLABEL_1_1\n"); printf("Test_TC_FLABEL_2_1\n"); + printf("Test_TC_FAN_1_1\n"); + printf("Test_TC_FAN_2_1\n"); + printf("Test_TC_FAN_2_2\n"); + printf("Test_TC_FAN_2_3\n"); + printf("Test_TC_FAN_2_4\n"); + printf("Test_TC_FAN_3_1\n"); + printf("Test_TC_FAN_3_2\n"); + printf("Test_TC_FAN_3_4\n"); printf("Test_TC_CGEN_1_1\n"); printf("Test_TC_CGEN_2_1\n"); printf("Test_TC_DGGEN_1_1\n"); @@ -127,6 +135,7 @@ class TestList : public Command printf("Test_TC_LVL_4_1\n"); printf("Test_TC_LVL_5_1\n"); printf("Test_TC_LVL_6_1\n"); + printf("Test_TC_LVL_7_1\n"); printf("Test_TC_LCFG_1_1\n"); printf("Test_TC_LUNIT_1_2\n"); printf("Test_TC_LUNIT_3_1\n"); @@ -290,6 +299,7 @@ class TestList : public Command printf("Test_TC_DRLK_2_7\n"); printf("Test_TC_DRLK_2_9\n"); printf("Test_TC_DRLK_2_11\n"); + printf("Test_TC_DRLK_2_12\n"); printf("TestGroupMessaging\n"); printf("TestGroupsCluster\n"); printf("TestGroupKeyManagementCluster\n"); @@ -562,7 +572,6 @@ class ManualTestList : public Command printf("Test_TC_DRLK_3_2\n"); printf("Test_TC_DRLK_3_3\n"); printf("Test_TC_LCFG_2_1\n"); - printf("Test_TC_LVL_7_1\n"); printf("Test_TC_LVL_8_1\n"); printf("Test_TC_OO_2_3\n"); printf("Test_TC_RH_2_2\n"); @@ -35459,10 +35468,10 @@ class Test_TC_FLABEL_2_1Suite : public TestCommand } }; -class Test_TC_CGEN_1_1Suite : public TestCommand +class Test_TC_FAN_1_1Suite : public TestCommand { public: - Test_TC_CGEN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_1_1", 7, credsIssuerConfig) + Test_TC_FAN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_1_1", 16, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -35470,7 +35479,7 @@ class Test_TC_CGEN_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CGEN_1_1Suite() {} + ~Test_TC_FAN_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -35501,12 +35510,7 @@ class Test_TC_CGEN_1_1Suite : public TestCommand break; case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - } + shouldContinue = true; break; case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -35518,6 +35522,60 @@ class Test_TC_CGEN_1_1Suite : public TestCommand } break; case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + } + break; + case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList value; @@ -35527,7 +35585,6 @@ class Test_TC_CGEN_1_1Suite : public TestCommand VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); @@ -35536,38 +35593,65 @@ class Test_TC_CGEN_1_1Suite : public TestCommand VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); } break; - case 4: + case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); } break; - case 5: + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 11UL)); + } + break; + case 14: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); } break; - case 6: + case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); } break; default: @@ -35594,43 +35678,107 @@ class Test_TC_CGEN_1_1Suite : public TestCommand } case 1: { LogStep(1, "Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::ClusterRevision::Id, true, chip::NullOptional); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT"), 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 2: { LogStep(2, "Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); + VerifyOrDo(!ShouldSkip(" !FAN.S.F00 && !FAN.S.F01 && !FAN.S.F02 && !FAN.S.F03 && !FAN.S.F04 && !FAN.S.F05 "), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); } case 3: { - LogStep(3, "Read the global attribute: AttributeList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); + LogStep(3, "Given FAN.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); } case 4: { - LogStep(4, "Read the global attribute: EventList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::EventList::Id, true, chip::NullOptional); + LogStep(4, "Given FAN.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); } case 5: { - LogStep(5, "Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + LogStep(5, "Given FAN.S.F02(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); } case 6: { - LogStep(6, "Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + LogStep(6, "Given FAN.S.F03(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "Given FAN.S.F04(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "Given FAN.S.F05(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 9: { + LogStep(9, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 10: { + LogStep(10, "Read the feature dependent FAN.S.F00 (SPD) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FAN.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 11: { + LogStep(11, "Read the feature dependent FAN.S.F02(RCK) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FAN.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 12: { + LogStep(12, "Read the feature dependent FAN.S.F03(WND) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FAN.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 13: { + LogStep(13, "Read the feature dependent FAN.S.F05(DIR) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FAN.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip(" !FAN.S.C00.Rsp "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AcceptedCommandList::Id, + true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("FAN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AcceptedCommandList::Id, + true, chip::NullOptional); } } return CHIP_NO_ERROR; } }; -class Test_TC_CGEN_2_1Suite : public TestCommand +class Test_TC_FAN_2_1Suite : public TestCommand { public: - Test_TC_CGEN_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_2_1", 8, credsIssuerConfig) + Test_TC_FAN_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_1", 5, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -35638,7 +35786,7 @@ class Test_TC_CGEN_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CGEN_2_1Suite() {} + ~Test_TC_FAN_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -35670,53 +35818,41 @@ class Test_TC_CGEN_2_1Suite : public TestCommand case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint64_t value; + chip::app::Clusters::FanControl::FanModeType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int64u", "int64u")); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 6U)); } break; case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 1ULL)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; + chip::app::Clusters::FanControl::FanModeSequenceType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); } break; - case 5: + case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; + chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfo::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); } break; - case 7: + case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - bool value; + uint8_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); } break; default: @@ -35742,61 +35878,38 @@ class Test_TC_CGEN_2_1Suite : public TestCommand return WaitForCommissionee(kIdentityAlpha, value); } case 1: { - LogStep(1, "TH1 reads the BreadCrumb Attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); + LogStep(1, "TH reads from the DUT the the FanMode attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, true, + chip::NullOptional); } case 2: { - LogStep(2, "TH1 writes the BreadCrumb attribute as 1 to the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint64_t value; - value = 1ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, value, chip::NullOptional, chip::NullOptional); + LogStep(2, "TH reads from the DUT the the FanModeSequence attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanModeSequence::Id, true, + chip::NullOptional); } case 3: { - LogStep(3, "TH1 reads the BreadCrumb attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); + LogStep(3, "TH reads from the DUT the the PercentSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, + chip::NullOptional); } case 4: { - LogStep(4, "TH1 reads the RegulatoryConfig attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::RegulatoryConfig::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "TH1 reads the LocationCapability attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::LocationCapability::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, - "TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the BasicCommissioningInfo attribute has " - "the following field: FailSafeExpiryLengthSeconds field value is within a duration range of 0 to 65535"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::BasicCommissioningInfo::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "TH1 reads SupportsConcurrentConnection attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id, true, chip::NullOptional); + LogStep(4, "TH reads from the DUT the the PercentCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentCurrent::Id, true, + chip::NullOptional); } } return CHIP_NO_ERROR; } }; -class Test_TC_DGGEN_1_1Suite : public TestCommand +class Test_TC_FAN_2_2Suite : public TestCommand { public: - Test_TC_DGGEN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGGEN_1_1", 19, credsIssuerConfig) + Test_TC_FAN_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_2", 4, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -35804,7 +35917,1136 @@ class Test_TC_DGGEN_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DGGEN_1_1Suite() {} + ~Test_TC_FAN_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; + + uint8_t SpeedMaxValue; + + 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)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + SpeedMaxValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, SpeedMaxValue)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, SpeedMaxValue)); + } + 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, "TH reads from the DUT the the SpeedMax attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedMax::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the the SpeedSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0005 && FAN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the the SpeedCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0006 && FAN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedCurrent::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_2_3Suite : public TestCommand +{ +public: + Test_TC_FAN_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_3", 3, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_2_3Suite() {} + + 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)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); + } + 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, "TH reads from the DUT the the RockSupport attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::RockSupport::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the the RockSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::RockSetting::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_2_4Suite : public TestCommand +{ +public: + Test_TC_FAN_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_4", 3, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_2_4Suite() {} + + 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)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); + } + 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, "TH reads from the DUT the the WindSupport attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::WindSupport::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the the WindSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A000A"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::WindSetting::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_3_1Suite : public TestCommand +{ +public: + Test_TC_FAN_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_3_1", 15, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigPercentSetting", 0, UINT8_MAX, &mConfigPercentSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_3_1Suite() {} + + 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 mConfigPercentSetting; + 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)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FanControl::FanModeType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("fanMode", value, 3U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("percentSetting", value)); + VerifyOrReturn(CheckValue("percentSetting.Value()", value.Value(), 0U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("percentCurrent", value, 0U)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValue("percentCurrent", value, mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("percentSetting", value)); + VerifyOrReturn(CheckValue("percentSetting.Value()", value.Value(), + mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FanControl::FanModeType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("fanMode", value, 0U)); + } + 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, "Step 1: 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, "Step 2a: TH writes a supported FanMode attribute that is other than off to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::FanControl::FanModeType value; + value = static_cast(3); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 2: { + LogStep(2, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 3: { + LogStep(3, "Step 2b: TH reads from the DUT the the FanMode attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Step 2.1a: TH writes the Off value of FanMode attribute to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::FanControl::FanModeType value; + value = static_cast(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 5: { + LogStep(5, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 6: { + LogStep(6, "Step 2.1b: TH reads from the DUT the PercentSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "Step 2.1c: TH reads from the DUT the PercentCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentCurrent::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "Step 3a: TH writes PercentSetting attribute a non-zero value to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 9: { + LogStep(9, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 10: { + LogStep(10, "Step 3b: TH reads from the DUT the PercentCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentCurrent::Id, true, + chip::NullOptional); + } + case 11: { + LogStep(11, "Step 3c: TH reads from the DUT the PercentSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, + chip::NullOptional); + } + case 12: { + LogStep(12, "Step 3.1a: TH writes PercentSetting attribute a zero value to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 13: { + LogStep(13, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 14: { + LogStep(14, "Step 3.1b: TH reads from the DUT the the FanMode attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_3_2Suite : public TestCommand +{ +public: + Test_TC_FAN_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_3_2", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigSpeedSetting", 0, UINT8_MAX, &mConfigSpeedSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_3_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 mConfigSpeedSetting; + 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)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("speedSetting", value)); + VerifyOrReturn(CheckValue("speedSetting.Value()", value.Value(), + mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValue("speedCurrent", value, mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U)); + } + 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, "Step 1: 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, "Step 2: TH writes SpeedSetting attribute a valid value to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 2: { + LogStep(2, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 3: { + LogStep(3, "Step 3: TH reads from the DUT the the SpeedSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Step 4: TH reads from the DUT the the SpeedCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedCurrent::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_3_4Suite : public TestCommand +{ +public: + Test_TC_FAN_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_3_4", 4, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWindSetting", 0, UINT8_MAX, &mConfigWindSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_3_4Suite() {} + + 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 mConfigWindSetting; + 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)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("windSetting", value, mConfigWindSetting.HasValue() ? mConfigWindSetting.Value() : 1U)); + } + 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, "Step 1: 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, "Step 2: TH writes WindSetting attribute a valid value to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint8_t value; + value = mConfigWindSetting.HasValue() ? mConfigWindSetting.Value() : 1U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::WindSetting::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 2: { + LogStep(2, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 3: { + LogStep(3, "Step 3: TH reads from the DUT the the WindSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::WindSetting::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CGEN_1_1Suite : public TestCommand +{ +public: + Test_TC_CGEN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_1_1", 7, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CGEN_1_1Suite() {} + + 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)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + } + 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, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Read the global attribute: EventList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::EventList::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CGEN_2_1Suite : public TestCommand +{ +public: + Test_TC_CGEN_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_2_1", 8, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CGEN_2_1Suite() {} + + 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)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int64u", "int64u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 1ULL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfo::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + 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, "TH1 reads the BreadCrumb Attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH1 writes the BreadCrumb attribute as 1 to the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint64_t value; + value = 1ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, value, chip::NullOptional, chip::NullOptional); + } + case 3: { + LogStep(3, "TH1 reads the BreadCrumb attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH1 reads the RegulatoryConfig attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::RegulatoryConfig::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH1 reads the LocationCapability attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::LocationCapability::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, + "TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the BasicCommissioningInfo attribute has " + "the following field: FailSafeExpiryLengthSeconds field value is within a duration range of 0 to 65535"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::BasicCommissioningInfo::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "TH1 reads SupportsConcurrentConnection attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DGGEN_1_1Suite : public TestCommand +{ +public: + Test_TC_DGGEN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGGEN_1_1", 19, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_DGGEN_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -40314,21 +41556,339 @@ class Test_TC_LVL_5_1Suite : public TestCommand return WaitForCommissionee(kIdentityAlpha, value); } case 1: { - LogStep(1, "Precondition Send On Command"); - VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Check on/off attribute value is true after on command"); - VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Precondition: write default value of OnOffTransitionTime attribute"); + LogStep(1, "Precondition Send On Command"); + VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional + + ); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Precondition: write default value of OnOffTransitionTime attribute"); + VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); + } + case 4: { + LogStep(4, "TH writes 0 to the Options attribute"); + VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::BitMask value; + value = static_cast>(0U); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 5: { + LogStep(5, "TH sends Off command to DUT"); + VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp && LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional + + ); + } + case 6: { + LogStep(6, + "TH sends a StepWithOnOff command to DUT, with StepMode =0x00 (up), StepSize =50 and TransitionTime =0 " + "(immediate)"); + VerifyOrDo(!ShouldSkip("LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type value; + value.stepMode = static_cast(0); + value.stepSize = 50U; + value.transitionTime.SetNonNull(); + value.transitionTime.Value() = 0U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::StepWithOnOff::Id, value, + chip::NullOptional + + ); + } + case 7: { + LogStep(7, "TH reads OnOff attribute (On/Off cluster) from DUT"); + VerifyOrDo(!ShouldSkip("OO.S.A0000 && LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "TH sends On command to DUT"); + VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional + + ); + } + case 9: { + LogStep(9, "TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)"); + VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 50U; + value.transitionTime.SetNonNull(); + value.transitionTime.Value() = 0U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value, + chip::NullOptional + + ); + } + case 10: { + LogStep(10, "Reads current level attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 11: { + LogStep(11, "TH sends a Step command to the DUT with StepMode =0x00 (up), StepSize =150 and TransitionTime =300"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::Step::Type value; + value.stepMode = static_cast(0); + value.stepSize = 150U; + value.transitionTime.SetNonNull(); + value.transitionTime.Value() = 300U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Step::Id, value, + chip::NullOptional + + ); + } + case 12: { + LogStep(12, "Wait 10s"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 13: { + LogStep(13, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 14: { + LogStep(14, "Wait 10s"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 15: { + LogStep(15, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 16: { + LogStep(16, "Wait 10s"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 17: { + LogStep(17, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 18: { + LogStep(18, "Wait 5000ms"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 19: { + LogStep(19, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 20: { + LogStep(20, "TH reads CurrentLevel attribute from DUT (after DUT has finished the transition)"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && !LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 21: { + LogStep(21, "Precondition send Off Command"); + VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional + + ); + } + case 22: { + LogStep(22, "Check on/off attribute value is false after off command"); + VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_LVL_6_1Suite : public TestCommand +{ +public: + Test_TC_LVL_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_6_1", 18, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_LVL_6_1Suite() {} + + 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)); + 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)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentLevel", value)); + VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), 50U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 64U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 86U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 85U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 115U)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 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: write default value of OnOffTransitionTime attribute"); VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint16_t value; @@ -40336,8 +41896,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); } - case 4: { - LogStep(4, "TH writes 0 to the Options attribute"); + case 2: { + LogStep(2, "TH writes 0 to the Options attribute"); VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::BitMask value; @@ -40345,40 +41905,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, value, chip::NullOptional, chip::NullOptional); } - case 5: { - LogStep(5, "TH sends Off command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp && LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, - "TH sends a StepWithOnOff command to DUT, with StepMode =0x00 (up), StepSize =50 and TransitionTime =0 " - "(immediate)"); - VerifyOrDo(!ShouldSkip("LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type value; - value.stepMode = static_cast(0); - value.stepSize = 50U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 0U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::StepWithOnOff::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "TH reads OnOff attribute (On/Off cluster) from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "TH sends On command to DUT"); + case 3: { + LogStep(3, "TH sends On command to DUT"); VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::OnOff::Commands::On::Type value; @@ -40386,8 +41914,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand ); } - case 9: { - LogStep(9, "TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)"); + case 4: { + LogStep(4, "TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)"); VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; @@ -40401,93 +41929,120 @@ class Test_TC_LVL_5_1Suite : public TestCommand ); } - case 10: { - LogStep(10, "Reads current level attribute from DUT"); + case 5: { + LogStep(5, "TH reads CurrentLevel attribute from DUT"); VerifyOrDo(!ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, chip::NullOptional); } - case 11: { - LogStep(11, "TH sends a Step command to the DUT with StepMode =0x00 (up), StepSize =150 and TransitionTime =300"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + case 6: { + LogStep(6, + "TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate field set to " + "0x05 (5 units/s)"); + VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::Step::Type value; - value.stepMode = static_cast(0); - value.stepSize = 150U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 300U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Step::Id, value, + chip::app::Clusters::LevelControl::Commands::Move::Type value; + value.moveMode = static_cast(0); + value.rate.SetNonNull(); + value.rate.Value() = 5U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value, chip::NullOptional ); } - case 12: { - LogStep(12, "Wait 10s"); + case 7: { + LogStep(7, "Wait 5000ms"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; + value.ms = 5000UL; return WaitForMs(kIdentityAlpha, value); } - case 13: { - LogStep(13, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); + case 8: { + LogStep(8, "Sends stop command to DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::Stop::Type value; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Stop::Id, value, + chip::NullOptional + + ); } - case 14: { - LogStep(14, "Wait 10s"); + case 9: { + LogStep(9, "Physically verify that the device has stopped transitioning"); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && LVL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); + 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 15: { - LogStep(15, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + case 10: { + LogStep(10, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.C03.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, chip::NullOptional); } - case 16: { - LogStep(16, "Wait 10s"); + case 11: { + LogStep(11, + "TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate field set to " + "0x05 (5 units/s)"); + VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); + chip::app::Clusters::LevelControl::Commands::Move::Type value; + value.moveMode = static_cast(0); + value.rate.SetNonNull(); + value.rate.Value() = 5U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value, + chip::NullOptional + + ); } - case 18: { - LogStep(18, "Wait 5000ms"); + case 12: { + LogStep(12, "Wait 5000ms"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; value.ms = 5000UL; return WaitForMs(kIdentityAlpha, value); } - case 19: { - LogStep(19, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); + case 13: { + LogStep(13, "TH sends a StopWithOnOff command to the DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type value; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::StopWithOnOff::Id, value, + chip::NullOptional + + ); } - case 20: { - LogStep(20, "TH reads CurrentLevel attribute from DUT (after DUT has finished the transition)"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && !LVL.S.M.VarRate"), + case 14: { + LogStep(14, "Physically verify that the device has stopped transitioning"); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && LVL.S.C07.Rsp"), 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 15: { + LogStep(15, "Reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.C07.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, chip::NullOptional); } - case 21: { - LogStep(21, "Precondition send Off Command"); + case 16: { + LogStep(16, "Precondition send Off Command"); VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::OnOff::Commands::Off::Type value; @@ -40495,8 +42050,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand ); } - case 22: { - LogStep(22, "Check on/off attribute value is false after off command"); + case 17: { + LogStep(17, "Check on/off attribute value is false after off command"); VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); } @@ -40505,18 +42060,20 @@ class Test_TC_LVL_5_1Suite : public TestCommand } }; -class Test_TC_LVL_6_1Suite : public TestCommand +class Test_TC_LVL_7_1Suite : public TestCommand { public: - Test_TC_LVL_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_6_1", 18, credsIssuerConfig) + Test_TC_LVL_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_7_1", 20, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("RandomLevelValue", 0, UINT8_MAX, &mRandomLevelValue); + AddArgument("RandomFrequencyValue", 0, UINT16_MAX, &mRandomFrequencyValue); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_6_1Suite() {} + ~Test_TC_LVL_7_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -40527,8 +42084,16 @@ class Test_TC_LVL_6_1Suite : public TestCommand chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mRandomLevelValue; + chip::Optional mRandomFrequencyValue; chip::Optional mTimeout; + uint8_t minLevelValue; + uint8_t maxLevelValue; + uint16_t CurrentFrequencyValue; + uint16_t MinFrequencyValue; + uint16_t MaxFrequencyValue; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // @@ -40556,14 +42121,24 @@ class Test_TC_LVL_6_1Suite : public TestCommand break; case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); + minLevelValue = value; + } break; case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::Nullable value; + uint8_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentLevel", value)); - VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), 50U)); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); + maxLevelValue = value; } break; case 6: @@ -40575,26 +42150,56 @@ class Test_TC_LVL_6_1Suite : public TestCommand break; case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentLevel", value)); + VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), + mRandomLevelValue.HasValue() ? mRandomLevelValue.Value() : 100U)); + } break; case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + CurrentFrequencyValue = value; + } break; case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::Nullable value; + uint16_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 64U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 86U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + MinFrequencyValue = value; } break; case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinFrequencyValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + MaxFrequencyValue = value; + } break; case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinFrequencyValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxFrequencyValue)); + } break; case 13: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -40606,21 +42211,36 @@ class Test_TC_LVL_6_1Suite : public TestCommand case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::Nullable value; + uint16_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 85U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 115U)); + VerifyOrReturn(CheckValue("currentFrequency", value, + mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); } break; case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - bool value; + uint16_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 0)); + VerifyOrReturn(CheckValue("currentFrequency", value, + mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); + } + 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)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentFrequency", value, + mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); } break; default: @@ -40655,7 +42275,7 @@ class Test_TC_LVL_6_1Suite : public TestCommand LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); } case 2: { - LogStep(2, "TH writes 0 to the Options attribute"); + LogStep(2, "Step 0a: TH writes 0 to the Options attribute"); VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::BitMask value; @@ -40664,7 +42284,7 @@ class Test_TC_LVL_6_1Suite : public TestCommand chip::NullOptional, chip::NullOptional); } case 3: { - LogStep(3, "TH sends On command to DUT"); + LogStep(3, "Step 0b: TH sends On command to DUT"); VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::OnOff::Commands::On::Type value; @@ -40673,11 +42293,26 @@ class Test_TC_LVL_6_1Suite : public TestCommand ); } case 4: { - LogStep(4, "TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)"); + LogStep(4, "Step 1a: TH reads the MinLevel attribute from the DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinLevel::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "Step 1b: TH reads the MaxLevel attribute from the DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxLevel::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, + "Step 1c: TH sends a MoveToLevel command to DUT, with the Level field set to a value between the MinLevel and " + "MaxLevel values (if present, otherwise between 0x01 and 0xFE) and the TransitionTime field set to 0x0000 " + "(move immediately)."); VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 50U; + value.level = mRandomLevelValue.HasValue() ? mRandomLevelValue.Value() : 100U; value.transitionTime.SetNonNull(); value.transitionTime.Value() = 0U; value.optionsMask = static_cast>(0U); @@ -40687,104 +42322,74 @@ class Test_TC_LVL_6_1Suite : public TestCommand ); } - case 5: { - LogStep(5, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, - "TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate field set to " - "0x05 (5 units/s)"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::Move::Type value; - value.moveMode = static_cast(0); - value.rate.SetNonNull(); - value.rate.Value() = 5U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value, - chip::NullOptional - - ); - } case 7: { - LogStep(7, "Wait 5000ms"); + LogStep(7, "Wait 100ms"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; + value.ms = 100UL; return WaitForMs(kIdentityAlpha, value); } case 8: { - LogStep(8, "Sends stop command to DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::Stop::Type value; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Stop::Id, value, - chip::NullOptional - - ); + LogStep(8, "Step 1d: TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); } case 9: { - LogStep(9, "Physically verify that the device has stopped transitioning"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && LVL.S.C03.Rsp"), 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); + LogStep(9, "Step 2a: TH reads the CurrentFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); } case 10: { - LogStep(10, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.C03.Rsp && LVL.S.A0000"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + LogStep(10, "Step 2b: TH reads the MinFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinFrequency::Id, true, chip::NullOptional); } case 11: { - LogStep(11, - "TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate field set to " - "0x05 (5 units/s)"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::Move::Type value; - value.moveMode = static_cast(0); - value.rate.SetNonNull(); - value.rate.Value() = 5U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value, - chip::NullOptional - - ); + LogStep(11, "Step 2c: TH reads the MaxFrequency attribute and check, if fmax < fmin, FAIL the test."); + VerifyOrDo(!ShouldSkip("LVL.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxFrequency::Id, true, + chip::NullOptional); } case 12: { - LogStep(12, "Wait 5000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); + LogStep( + 12, + "Step 2d: sanity check on values read in steps 2a..2c, if fc < fmin, FAIL the test and fc > fmax, FAIL the test"); + VerifyOrDo(!ShouldSkip("LVL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); } case 13: { - LogStep(13, "TH sends a StopWithOnOff command to the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(13, + "Step 3a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to a random value " + "frand, chosen such that: fmin < frand < fmax"); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type value; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::StopWithOnOff::Id, value, - chip::NullOptional + chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::Type value; + value.frequency = mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToClosestFrequency::Id, + value, chip::NullOptional ); } case 14: { - LogStep(14, "Physically verify that the device has stopped transitioning"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && LVL.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(14, "Wait 100ms"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 100UL; + return WaitForMs(kIdentityAlpha, value); + } + case 15: { + LogStep(15, "Step 3b: TH reads the CurrentFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); + } + case 16: { + LogStep(16, "Step 4a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to fmax + 1"); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && PICS_USER_PROMPT"), 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); @@ -40792,26 +42397,29 @@ class Test_TC_LVL_6_1Suite : public TestCommand value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt(kIdentityAlpha, value); } - case 15: { - LogStep(15, "Reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.C07.Rsp && LVL.S.A0000"), + case 17: { + LogStep(17, "Step 4b: TH reads the CurrentFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); } - case 16: { - LogStep(16, "Precondition send Off Command"); - VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + case 18: { + LogStep(18, "Step 5a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to fmin - 1"); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && PICS_USER_PROMPT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional - - ); + 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 17: { - LogStep(17, "Check on/off attribute value is false after off command"); - VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + case 19: { + LogStep(19, "Step 5b: TH reads the CurrentFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); } } return CHIP_NO_ERROR; @@ -99041,7 +100649,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand case 16: { LogStep(16, "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"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint8_t value; value = 3U; @@ -99051,7 +100660,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand case 17: { LogStep(17, "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"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint8_t value; value = 3U; @@ -99062,7 +100672,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand LogStep(18, "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"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint8_t value; value = 15U; @@ -99074,7 +100685,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand LogStep(19, "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"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint8_t value; value = 15U; @@ -99158,7 +100770,7 @@ class Test_TC_DRLK_2_3Suite : public TestCommand } case 27: { LogStep(27, "TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint32_t value; value = 10UL; @@ -99167,7 +100779,7 @@ class Test_TC_DRLK_2_3Suite : public TestCommand } case 28: { LogStep(28, "TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint32_t value; value = 60UL; @@ -99176,7 +100788,7 @@ class Test_TC_DRLK_2_3Suite : public TestCommand } case 29: { LogStep(29, "TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("!DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip(" !DRLK.S.A0023.Write && PICS_SDK_CI_ONLY "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint32_t value; value = 10UL; @@ -99185,7 +100797,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand } case 30: { LogStep(30, "TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("!DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip(" !DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP "), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint32_t value; value = 60UL; @@ -101418,7 +103031,575 @@ class Test_TC_DRLK_2_11Suite : public TestCommand return WaitForCommissionee(kIdentityAlpha, value); } case 1: { - LogStep(1, "Create new user with default parameters"); + LogStep(1, "Create new user with default parameters"); + 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(10000), chip::NullOptional + + ); + } + case 2: { + LogStep(2, "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, "TH reads NumberOfTotalUsersSupported and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::NumberOfTotalUsersSupported::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads MinPINCodeLength and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MinPINCodeLength::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads MaxPINCodeLength and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MaxPINCodeLength::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads MinRFIDCodeLength and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MinRFIDCodeLength::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads MaxRFIDCodeLength and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MaxRFIDCodeLength::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH sends Set Credential Command to DUT with type PIN"); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + 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 = mPINCredentialData.HasValue() ? mPINCredentialData.Value() + : chip::ByteSpan(chip::Uint8::from_const_char("123456"), 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(10000), chip::NullOptional + + ); + } + case 9: { + LogStep(9, "TH sends Set Credential Command to DUT with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + value.credentialData = mRFIDCredentialData.HasValue() + ? mRFIDCredentialData.Value() + : chip::ByteSpan(chip::Uint8::from_const_char("RFIDTESTDATA"), 12); + 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(10000), chip::NullOptional + + ); + } + case 10: { + LogStep(10, "TH sends Set Credential Command to DUT with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + value.credentialData = mFingerVeinCredentialData.HasValue() ? mFingerVeinCredentialData.Value() + : chip::ByteSpan(chip::Uint8::from_const_char("123456"), 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(10000), chip::NullOptional + + ); + } + case 11: { + LogStep(11, "TH sends Get Credential Status Command with type PIN"); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + 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 12: { + LogStep(12, "TH sends Get Credential Status Command with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 13: { + LogStep(13, "TH sends Get Credential Status Command with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 14: { + LogStep(14, "TH sends Clear Credential Command to DUT with type PIN"); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && 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(10000), chip::NullOptional + + ); + } + case 15: { + LogStep(15, "TH sends Get Credential Status Command with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 16: { + LogStep(16, "TH sends Get Credential Status Command with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 17: { + LogStep(17, "TH sends Clear Credential Command to DUT with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && 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(2); + value.credential.Value().credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 18: { + LogStep(18, "TH sends Get Credential Status Command with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 19: { + LogStep(19, "TH sends Clear Credential Command to DUT with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && 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(4); + value.credential.Value().credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 20: { + LogStep(20, "TH sends Get Credential Status Command to DUT with type PIN"); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + 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 21: { + LogStep(21, "TH sends Get Credential Status Command to DUT with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 22: { + LogStep(22, "TH sends Get Credential Status Command to DUT with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + } + return CHIP_NO_ERROR; + } +}; + +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, "Create new user"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetUser::Type value; value.operationType = static_cast(0); @@ -101434,7 +103615,7 @@ class Test_TC_DRLK_2_11Suite : public TestCommand value.credentialRule.SetNonNull(); value.credentialRule.Value() = static_cast(0); return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional + chip::Optional(1000), chip::NullOptional ); } @@ -101449,39 +103630,7 @@ class Test_TC_DRLK_2_11Suite : public TestCommand ); } case 3: { - LogStep(3, "TH reads NumberOfTotalUsersSupported and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfTotalUsersSupported::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "TH reads MinPINCodeLength and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MinPINCodeLength::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "TH reads MaxPINCodeLength and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MaxPINCodeLength::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "TH reads MinRFIDCodeLength and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MinRFIDCodeLength::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads MaxRFIDCodeLength and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MaxRFIDCodeLength::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "TH sends Set Credential Command to DUT with type PIN"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(3, "Create new PIN credential and lock/unlock user"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; value.operationType = static_cast(0); @@ -101489,239 +103638,371 @@ class Test_TC_DRLK_2_11Suite : public TestCommand value.credential.credentialType = static_cast(1); value.credential.credentialIndex = 1U; - value.credentialData = mPINCredentialData.HasValue() ? mPINCredentialData.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("123456"), 6); + 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(10000), chip::NullOptional + chip::Optional(1000), chip::NullOptional ); } - case 9: { - LogStep(9, "TH sends Set Credential Command to DUT with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + case 4: { + LogStep(4, "Verify created PIN credential"); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - value.credential.credentialType = static_cast(2); + value.credential.credentialType = static_cast(1); value.credential.credentialIndex = 1U; - value.credentialData = mRFIDCredentialData.HasValue() - ? mRFIDCredentialData.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("RFIDTESTDATA"), 12); - 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(10000), chip::NullOptional + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional ); } - case 10: { - LogStep(10, "TH sends Set Credential Command to DUT with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), + case 5: { + LogStep(5, "Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; + 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.F0c && 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.F0c && 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 && DRLK.S.F0c"), 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 - value.credentialData = mFingerVeinCredentialData.HasValue() ? mFingerVeinCredentialData.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("123456"), 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(10000), chip::NullOptional + ); + } + case 9: { + LogStep(9, "Step 4: TH sends Ubolt Door Command to the DUT with PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), 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.F0c && 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, "TH sends Get Credential Status Command with type PIN"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + LogStep(11, "Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); 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 - - ); + bool value; + value = true; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, + chip::NullOptional); } case 12: { - LogStep(12, "TH sends Get Credential Status Command with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + LogStep(12, "Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); } case 13: { - LogStep(13, "TH sends Get Credential Status Command with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(13, "Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + 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, "TH sends Clear Credential Command to DUT with type PIN"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(14, "Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), 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(10000), chip::NullOptional + 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, "TH sends Get Credential Status Command with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(15, "Step 9: TH sends Unbolt Door Command to the DUT without PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + 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, "TH sends Get Credential Status Command with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + LogStep(16, "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); + 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, "TH sends Clear Credential Command to DUT with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(17, "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(2); - value.credential.Value().credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); + 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, "TH sends Get Credential Status Command with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + 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.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + 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.F0c && ( 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 19: { - LogStep(19, "TH sends Clear Credential Command to DUT with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + 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::ClearCredential::Type value; - value.credential.SetNonNull(); + 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 - value.credential.Value().credentialType = static_cast(4); - value.credential.Value().credentialIndex = 1U; + ); + } + 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 - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), 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 20: { - LogStep(20, "TH sends Get Credential Status Command to DUT with type PIN"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + case 24: { + LogStep(24, "Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( 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::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 + 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 21: { - LogStep(21, "TH sends Get Credential Status Command to DUT with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + case 26: { + LogStep(26, "Wait for UserCodeTemporaryDisableTime expires"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 1U; + 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 - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - 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 22: { - LogStep(22, "TH sends Get Credential Status Command to DUT with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + 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::GetCredentialStatus::Type value; + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(1000), chip::NullOptional ); } @@ -128348,61 +130629,6 @@ class Test_TC_LCFG_2_1Suite : public TestCommand } }; -class Test_TC_LVL_7_1Suite : public TestCommand -{ -public: - Test_TC_LVL_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_7_1", 0, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_7_1Suite() {} - - 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) - { - 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) - {} - return CHIP_NO_ERROR; - } -}; - class Test_TC_LVL_8_1Suite : public TestCommand { public: @@ -134776,6 +137002,14 @@ 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), @@ -134794,6 +137028,7 @@ 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), @@ -134957,6 +137192,7 @@ 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), @@ -135218,7 +137454,6 @@ 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), 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 b5e5873650ad46..721bd0e654840e 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -97,6 +97,14 @@ class TestList : public Command { printf("Test_TC_FLW_1_1\n"); printf("Test_TC_FLW_2_1\n"); printf("Test_TC_FLABEL_1_1\n"); + printf("Test_TC_FAN_1_1\n"); + printf("Test_TC_FAN_2_1\n"); + printf("Test_TC_FAN_2_2\n"); + printf("Test_TC_FAN_2_3\n"); + printf("Test_TC_FAN_2_4\n"); + printf("Test_TC_FAN_3_1\n"); + printf("Test_TC_FAN_3_2\n"); + printf("Test_TC_FAN_3_4\n"); printf("Test_TC_CGEN_1_1\n"); printf("Test_TC_CGEN_2_1\n"); printf("Test_TC_DGGEN_1_1\n"); @@ -115,6 +123,7 @@ class TestList : public Command { printf("Test_TC_LVL_4_1\n"); printf("Test_TC_LVL_5_1\n"); printf("Test_TC_LVL_6_1\n"); + printf("Test_TC_LVL_7_1\n"); printf("Test_TC_LCFG_1_1\n"); printf("Test_TC_LUNIT_1_2\n"); printf("Test_TC_LUNIT_3_1\n"); @@ -262,6 +271,7 @@ class TestList : public Command { printf("Test_TC_DRLK_2_7\n"); printf("Test_TC_DRLK_2_9\n"); printf("Test_TC_DRLK_2_11\n"); + printf("Test_TC_DRLK_2_12\n"); printf("TestGroupsCluster\n"); printf("TestGroupKeyManagementCluster\n"); printf("Test_TC_G_1_1\n"); @@ -47490,11 +47500,11 @@ class Test_TC_FLABEL_1_1 : public TestCommandBridge { } }; -class Test_TC_CGEN_1_1 : public TestCommandBridge { +class Test_TC_FAN_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_CGEN_1_1() - : TestCommandBridge("Test_TC_CGEN_1_1") + Test_TC_FAN_1_1() + : TestCommandBridge("Test_TC_FAN_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -47504,7 +47514,7 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_CGEN_1_1() {} + ~Test_TC_FAN_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -47512,11 +47522,11 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CGEN_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CGEN_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -47534,27 +47544,125 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { break; case 1: ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("PICS_USER_PROMPT")) { + NextTest(); + return; + } err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip(" !FAN.S.F00 && !FAN.S.F01 && !FAN.S.F02 && !FAN.S.F03 && !FAN.S.F04 && !FAN.S.F05 ")) { + NextTest(); + return; + } err = TestReadTheGlobalAttributeFeatureMap_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given FAN.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F00")) { + NextTest(); + return; + } + err = TestGivenFANSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: EventList\n"); - err = TestReadTheGlobalAttributeEventList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Given FAN.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F01")) { + NextTest(); + return; + } + err = TestGivenFANSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_5(); + ChipLogProgress( + chipTool, " ***** Test Step 5 : Given FAN.S.F02(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F02")) { + NextTest(); + return; + } + err = TestGivenFANSF02ConditionEnsureFeaturemapHasTheCorrectBitSet_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Given FAN.S.F03(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F03")) { + NextTest(); + return; + } + err = TestGivenFANSF03WarningEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Given FAN.S.F04(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F04")) { + NextTest(); + return; + } + err = TestGivenFANSF04WarningEnsureFeaturemapHasTheCorrectBitSet_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given FAN.S.F05(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F05")) { + NextTest(); + return; + } + err = TestGivenFANSF05WarningEnsureFeaturemapHasTheCorrectBitSet_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Read the feature dependent FAN.S.F00 (SPD) attribute in AttributeList\n"); + if (ShouldSkip("FAN.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFansf00SpdAttributeInAttributeList_10(); + break; + case 11: + ChipLogProgress( + chipTool, " ***** Test Step 11 : Read the feature dependent FAN.S.F02(RCK) attribute in AttributeList\n"); + if (ShouldSkip("FAN.S.F02")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFansf02rckAttributeInAttributeList_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Read the feature dependent FAN.S.F03(WND) attribute in AttributeList\n"); + if (ShouldSkip("FAN.S.F03")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFansf03wndAttributeInAttributeList_12(); + break; + case 13: + ChipLogProgress( + chipTool, " ***** Test Step 13 : Read the feature dependent FAN.S.F05(DIR) attribute in AttributeList\n"); + if (ShouldSkip("FAN.S.F05")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFansf05dirAttributeInAttributeList_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip(" !FAN.S.C00.Rsp ")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("FAN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_15(); break; } @@ -47588,6 +47696,33 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { 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; } // Go on to the next test. @@ -47601,7 +47736,7 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; + const uint16_t mTestCount = 16; chip::Optional mNodeId; chip::Optional mCluster; @@ -47617,49 +47752,69 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { } CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + 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 TestReadTheGlobalAttributeFeatureMap_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); } - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + CHIP_ERROR TestGivenFANSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + NSLog(@"Given FAN.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFANSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); NextTest(); @@ -47668,13 +47823,87 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestGivenFANSF02ConditionEnsureFeaturemapHasTheCorrectBitSet_5() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F02(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFANSF03WarningEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F03(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFANSF04WarningEnsureFeaturemapHasTheCorrectBitSet_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F04(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFANSF05WarningEnsureFeaturemapHasTheCorrectBitSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F05(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -47687,7 +47916,6 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); @@ -47701,39 +47929,99 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeEventList_4() + CHIP_ERROR TestReadTheFeatureDependentFansf00SpdAttributeInAttributeList_10() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: EventList Error: %@", err); + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent FAN.S.F00 (SPD) attribute in AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_5() + CHIP_ERROR TestReadTheFeatureDependentFansf02rckAttributeInAttributeList_11() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent FAN.S.F02(RCK) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentFansf03wndAttributeInAttributeList_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent FAN.S.F03(WND) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentFansf05dirAttributeInAttributeList_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent FAN.S.F05(DIR) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 11UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -47741,35 +48029,32 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 4UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(0))); + } + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_6() + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_15() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 5UL)); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); NextTest(); }]; @@ -47778,11 +48063,11 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { } }; -class Test_TC_CGEN_2_1 : public TestCommandBridge { +class Test_TC_FAN_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_CGEN_2_1() - : TestCommandBridge("Test_TC_CGEN_2_1") + Test_TC_FAN_2_1() + : TestCommandBridge("Test_TC_FAN_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -47792,7 +48077,7 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_CGEN_2_1() {} + ~Test_TC_FAN_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -47800,11 +48085,11 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CGEN_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CGEN_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -47821,63 +48106,36 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH1 reads the BreadCrumb Attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the the FanMode attribute\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1(); + err = TestThReadsFromTheDutTheTheFanModeAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH1 writes the BreadCrumb attribute as 1 to the DUT\n"); - if (ShouldSkip("CGEN.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the the FanModeSequence attribute\n"); + if (ShouldSkip("FAN.S.A0001")) { NextTest(); return; } - err = TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2(); + err = TestThReadsFromTheDutTheTheFanModeSequenceAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH1 reads the BreadCrumb attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the the PercentSetting attribute\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3(); + err = TestThReadsFromTheDutTheThePercentSettingAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH1 reads the RegulatoryConfig attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0002")) { - NextTest(); - return; - } - err = TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH1 reads the LocationCapability attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0003")) { - NextTest(); - return; - } - err = TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the " - "BasicCommissioningInfo attribute has the following field: FailSafeExpiryLengthSeconds field value is within a " - "duration range of 0 to 65535\n"); - if (ShouldSkip("CGEN.S.A0001")) { - NextTest(); - return; - } - err = TestTh1ReadsBasicCommissioningInfoAttributeFromDutAndVerifyThatTheBasicCommissioningInfoAttributeHasTheFollowingFieldFailSafeExpiryLengthSecondsFieldValueIsWithinADurationRangeOf0To65535_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH1 reads SupportsConcurrentConnection attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0004")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the the PercentCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0003")) { NextTest(); return; } - err = TestTh1ReadsSupportsConcurrentConnectionAttributeFromTheDut_7(); + err = TestThReadsFromTheDutTheThePercentCurrentAttribute_4(); break; } @@ -47905,15 +48163,6 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { 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; } // Go on to the next test. @@ -47927,7 +48176,7 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -47942,67 +48191,67 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1() + CHIP_ERROR TestThReadsFromTheDutTheTheFanModeAttribute_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads the BreadCrumb Attribute from the DUT Error: %@", err); + [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the FanMode attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("breadcrumb", "int64u", "int64u")); + VerifyOrReturn(CheckConstraintType("fanMode", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("fanMode", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("fanMode", [value unsignedCharValue], 6U)); + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2() + CHIP_ERROR TestThReadsFromTheDutTheTheFanModeSequenceAttribute_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id breadcrumbArgument; - breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:1ULL]; - [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument - completion:^(NSError * _Nullable err) { - NSLog(@"TH1 writes the BreadCrumb attribute as 1 to the DUT Error: %@", err); + [cluster readAttributeFanModeSequenceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the FanModeSequence attribute Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("fanModeSequence", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("fanModeSequence", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("fanModeSequence", [value unsignedCharValue], 5U)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3() + CHIP_ERROR TestThReadsFromTheDutTheThePercentSettingAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads the BreadCrumb attribute from the DUT Error: %@", err); + [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the PercentSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("Breadcrumb", actualValue, 1ULL)); + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("percentSetting", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("percentSetting", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("percentSetting", [value unsignedCharValue], 100U)); } NextTest(); @@ -48011,45 +48260,165 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4() + CHIP_ERROR TestThReadsFromTheDutTheThePercentCurrentAttribute_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeRegulatoryConfigWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads the RegulatoryConfig attribute from the DUT Error: %@", err); + [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the PercentCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("regulatoryConfig", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("regulatoryConfig", [value unsignedCharValue], 2U)); + VerifyOrReturn(CheckConstraintType("percentCurrent", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("percentCurrent", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("percentCurrent", [value unsignedCharValue], 100U)); NextTest(); }]; return CHIP_NO_ERROR; } +}; + +class Test_TC_FAN_2_2 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FAN_2_2() + : TestCommandBridge("Test_TC_FAN_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - CHIP_ERROR TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5() + ~Test_TC_FAN_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the the SpeedMax attribute\n"); + if (ShouldSkip("FAN.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheTheSpeedMaxAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the the SpeedSetting attribute\n"); + if (ShouldSkip("FAN.S.A0005 && FAN.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheTheSpeedSettingAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the the SpeedCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0006 && FAN.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheTheSpeedCurrentAttribute_3(); + 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; + } + + // 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 = 4; + + 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 SpeedMaxValue; + + CHIP_ERROR TestThReadsFromTheDutTheTheSpeedMaxAttribute_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLocationCapabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads the LocationCapability attribute from the DUT Error: %@", err); + [cluster readAttributeSpeedMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the SpeedMax attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("locationCapability", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("locationCapability", [value unsignedCharValue], 2U)); + VerifyOrReturn(CheckConstraintType("speedMax", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("speedMax", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("speedMax", [value unsignedCharValue], 100U)); + { + SpeedMaxValue = value; + } NextTest(); }]; @@ -48057,46 +48426,47 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR - TestTh1ReadsBasicCommissioningInfoAttributeFromDutAndVerifyThatTheBasicCommissioningInfoAttributeHasTheFollowingFieldFailSafeExpiryLengthSecondsFieldValueIsWithinADurationRangeOf0To65535_6() + CHIP_ERROR TestThReadsFromTheDutTheTheSpeedSettingAttribute_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeBasicCommissioningInfoWithCompletion:^( - MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, NSError * _Nullable err) { - NSLog( - @"TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the BasicCommissioningInfo attribute has the " - @"following field: FailSafeExpiryLengthSeconds field value is within a duration range of 0 to 65535 Error: %@", - err); + [cluster readAttributeSpeedSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the SpeedSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("speedSetting", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("speedSetting", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("speedSetting", [value unsignedCharValue], SpeedMaxValue)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestTh1ReadsSupportsConcurrentConnectionAttributeFromTheDut_7() + CHIP_ERROR TestThReadsFromTheDutTheTheSpeedCurrentAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSupportsConcurrentConnectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads SupportsConcurrentConnection attribute from the DUT Error: %@", err); + [cluster readAttributeSpeedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the SpeedCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("supportsConcurrentConnection", "boolean", "boolean")); + VerifyOrReturn(CheckConstraintType("speedCurrent", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("speedCurrent", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("speedCurrent", [value unsignedCharValue], SpeedMaxValue)); + NextTest(); }]; @@ -48104,11 +48474,11 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { } }; -class Test_TC_DGGEN_1_1 : public TestCommandBridge { +class Test_TC_FAN_2_3 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DGGEN_1_1() - : TestCommandBridge("Test_TC_DGGEN_1_1") + Test_TC_FAN_2_3() + : TestCommandBridge("Test_TC_FAN_2_3") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -48118,7 +48488,7 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DGGEN_1_1() {} + ~Test_TC_FAN_2_3() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -48126,11 +48496,11 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DGGEN_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_2_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DGGEN_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_2_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -48147,170 +48517,408 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - if (ShouldSkip("DGGEN.S.Afffd")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the the RockSupport attribute\n"); + if (ShouldSkip("FAN.S.A0007")) { NextTest(); return; } - err = TestReadTheGlobalAttributeClusterRevision_1(); + err = TestThReadsFromTheDutTheTheRockSupportAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("DGGEN.S.Afffc")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the the RockSetting attribute\n"); + if (ShouldSkip("FAN.S.A0008")) { NextTest(); return; } - err = TestReadTheGlobalAttributeFeatureMap_2(); + err = TestThReadsFromTheDutTheTheRockSettingAttribute_2(); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - if (ShouldSkip("DGGEN.S.Afffb")) { + } + + 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; + } + + // 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 = 3; + + 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 TestThReadsFromTheDutTheTheRockSupportAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRockSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the RockSupport attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("rockSupport", "bitmap8", "bitmap8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheTheRockSettingAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRockSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the RockSetting attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("rockSetting", "bitmap8", "bitmap8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_2_4 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FAN_2_4() + : TestCommandBridge("Test_TC_FAN_2_4") + , 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_FAN_2_4() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_2_4\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_2_4\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 : TH reads from the DUT the the WindSupport attribute\n"); + if (ShouldSkip("FAN.S.A0009")) { NextTest(); return; } - err = TestReadTheGlobalAttributeAttributeList_3(); + err = TestThReadsFromTheDutTheTheWindSupportAttribute_1(); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read optional attribute(UpTime) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0002 && DGGEN.S.Afffb")) { + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the the WindSetting attribute\n"); + if (ShouldSkip("FAN.S.A000A")) { NextTest(); return; } - err = TestReadOptionalAttributeUpTimeInAttributeList_4(); + err = TestThReadsFromTheDutTheTheWindSettingAttribute_2(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read optional attribute(TotalOperationalHours) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0003 && DGGEN.S.Afffb")) { + } + + 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; + } + + // 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 = 3; + + 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 TestThReadsFromTheDutTheTheWindSupportAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeWindSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the WindSupport attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("windSupport", "bitmap8", "bitmap8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheTheWindSettingAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeWindSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the WindSetting attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("windSetting", "bitmap8", "bitmap8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_3_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FAN_3_1() + : TestCommandBridge("Test_TC_FAN_3_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigPercentSetting", 0, UINT8_MAX, &mConfigPercentSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_FAN_3_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_3_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_3_1\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 : Step 1: Wait for the commissioned device to be retrieved\n"); + err = TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress( + chipTool, " ***** Test Step 1 : Step 2a: TH writes a supported FanMode attribute that is other than off to DUT\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeTotalOperationalHoursInAttributeList_5(); + err = TestStep2aThWritesASupportedFanModeAttributeThatIsOtherThanOffToDut_1(); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read optional attribute(BootReason) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0004 && DGGEN.S.Afffb")) { + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeBootReasonInAttributeList_6(); + err = TestWait1000ms_2(); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read optional attribute(ActiveHardwareFaults) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0005 && DGGEN.S.Afffb")) { + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 2b: TH reads from the DUT the the FanMode attribute\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeActiveHardwareFaultsInAttributeList_7(); + err = TestStep2bThReadsFromTheDutTheTheFanModeAttribute_3(); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read optional attribute(ActiveRadioFaults) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0006 && DGGEN.S.Afffb")) { + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 2.1a: TH writes the Off value of FanMode attribute to DUT\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeActiveRadioFaultsInAttributeList_8(); + err = TestStep21aThWritesTheOffValueOfFanModeAttributeToDut_4(); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read optional attribute(ActiveNetworkFaults) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0007 && DGGEN.S.Afffb")) { + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeActiveNetworkFaultsInAttributeList_9(); + err = TestWait1000ms_5(); break; - case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : TH reads AttributeList attribute from DUT. 1.The list SHALL NOT contain any additional " - "values in the standard or scoped range: (0x0000_0000 - 0x0000_4FFF) and (0x0000_F000 - 0x0000_FFFE) 2.The list " - "MAY contain values in the Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_4FFF), where XXXX " - "is the allowed MEI range (0x0001 - 0xFFF1), these values SHALL be ignored. 3.The list SHALL NOT contain any " - "values in the Test Vendor or invalid range: (0x0000_5000 - 0x0000_EFFF and 0x0000_FFFF), (0xXXXX_5000 - " - "0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afffb")) { + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 2.1b: TH reads from the DUT the PercentSetting attribute\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestThReadsAttributeListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x00004fffAnd0x0000F0000x0000Fffe2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX4fffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000050000x0000EfffAnd0x0000Ffff0xXXXX50000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_10(); + err = TestStep21bThReadsFromTheDutThePercentSettingAttribute_6(); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read the global attribute: EventList\n"); - if (ShouldSkip("DGGEN.S.Afffa")) { + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 2.1c: TH reads from the DUT the PercentCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0003")) { NextTest(); return; } - err = TestReadTheGlobalAttributeEventList_11(); + err = TestStep21cThReadsFromTheDutThePercentCurrentAttribute_7(); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Read optional event(HardwareFaultChange) in EventList\n"); - if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E00")) { + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3a: TH writes PercentSetting attribute a non-zero value to DUT\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestReadOptionalEventHardwareFaultChangeInEventList_12(); + err = TestStep3aThWritesPercentSettingAttributeANonZeroValueToDut_8(); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read optional event(RadioFaultChange) in EventList\n"); - if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E01")) { + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestReadOptionalEventRadioFaultChangeInEventList_13(); + err = TestWait1000ms_9(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Read optional event(NetworkFaultChange) in EventList\n"); - if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E02")) { + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 3b: TH reads from the DUT the PercentCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0003")) { NextTest(); return; } - err = TestReadOptionalEventNetworkFaultChangeInEventList_14(); + err = TestStep3bThReadsFromTheDutThePercentCurrentAttribute_10(); break; - case 15: - ChipLogProgress(chipTool, - " ***** Test Step 15 : TH reads EventList attribute from DUT. 1.The list MAY contain values in the Manufacturer " - "Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI range (0x0001 - " - "0xFFF1), these values SHALL be ignored. 2.The list SHALL NOT contain any values in the Test Vendor or invalid " - "range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where XXXX is " - "the allowed MEI range (0x0001 - 0xFFF1)\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afffa")) { + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 3c: TH reads from the DUT the PercentSetting attribute\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestThReadsEventListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_15(); + err = TestStep3cThReadsFromTheDutThePercentSettingAttribute_11(); break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Read the global attribute: AcceptedCommandList\n"); - if (ShouldSkip("DGGEN.S.Afff9")) { + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 3.1a: TH writes PercentSetting attribute a zero value to DUT\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestReadTheGlobalAttributeAcceptedCommandList_16(); + err = TestStep31aThWritesPercentSettingAttributeAZeroValueToDut_12(); break; - case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : TH reads AcceptedCommandList attribute from DUT. 1.The list SHALL NOT contain any " - "additional values in the standard or scoped range: (0x0000_0000 - 0x0000_00FF). 2.The list MAY contain values in " - "the Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI " - "range (0x0001 - 0xFFF1), these values SHALL be ignored.3.The list SHALL NOT contain any values in the Test Vendor " - "or invalid range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where " - "XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afff9")) { + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestThReadsAcceptedCommandListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x000000ff2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_17(); + err = TestWait1000ms_13(); break; - case 18: - ChipLogProgress(chipTool, - " ***** Test Step 18 : TH reads GeneratedCommandList attribute from DUT. 1.The list MAY contain values in the " - "Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI range " - "(0x0001 - 0xFFF1), these values SHALL be ignored. 2.The list SHALL NOT contain any values in the Test Vendor or " - "invalid range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where " - "XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afff8")) { + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 3.1b: TH reads from the DUT the the FanMode attribute\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestThReadsGeneratedCommandListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_18(); + err = TestStep31bThReadsFromTheDutTheTheFanModeAttribute_14(); break; } @@ -48368,18 +48976,6 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { 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; } // Go on to the next test. @@ -48393,14 +48989,15 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; + const uint16_t mTestCount = 15; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigPercentSetting; chip::Optional mTimeout; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -48408,174 +49005,107 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestStep2aThWritesASupportedFanModeAttributeThatIsOtherThanOffToDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id fanModeArgument; + fanModeArgument = [NSNumber numberWithUnsignedChar:3U]; + [cluster + writeAttributeFanModeWithValue:fanModeArgument + completion:^(NSError * _Nullable err) { + NSLog( + @"Step 2a: TH writes a supported FanMode attribute that is other than off to DUT Error: %@", + err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + CHIP_ERROR TestWait1000ms_2() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestStep2bThReadsFromTheDutTheTheFanModeAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2b: TH reads from the DUT the the FanMode attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + VerifyOrReturn(CheckValue("FanMode", actualValue, 3U)); } - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestStep21aThWritesTheOffValueOfFanModeAttributeToDut_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id fanModeArgument; + fanModeArgument = [NSNumber numberWithUnsignedChar:0U]; + [cluster writeAttributeFanModeWithValue:fanModeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2.1a: TH writes the Off value of FanMode attribute to DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalAttributeUpTimeInAttributeList_4() + CHIP_ERROR TestWait1000ms_5() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestStep21bThReadsFromTheDutThePercentSettingAttribute_6() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(UpTime) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadOptionalAttributeTotalOperationalHoursInAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(TotalOperationalHours) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadOptionalAttributeBootReasonInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(BootReason) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadOptionalAttributeActiveHardwareFaultsInAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(ActiveHardwareFaults) in AttributeList Error: %@", err); + [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2.1b: TH reads from the DUT the PercentSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("PercentSetting", actualValue)); + VerifyOrReturn(CheckValue("PercentSetting", actualValue, 0U)); + } NextTest(); }]; @@ -48583,22 +49113,22 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalAttributeActiveRadioFaultsInAttributeList_8() + CHIP_ERROR TestStep21cThReadsFromTheDutThePercentCurrentAttribute_7() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(ActiveRadioFaults) in AttributeList Error: %@", err); + [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2.1c: TH reads from the DUT the PercentCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("PercentCurrent", actualValue, 0U)); + } NextTest(); }]; @@ -48606,79 +49136,55 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalAttributeActiveNetworkFaultsInAttributeList_9() + CHIP_ERROR TestStep3aThWritesPercentSettingAttributeANonZeroValueToDut_8() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(ActiveNetworkFaults) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id percentSettingArgument; + percentSettingArgument = mConfigPercentSetting.HasValue() ? [NSNumber numberWithUnsignedChar:mConfigPercentSetting.Value()] + : [NSNumber numberWithUnsignedChar:30U]; + [cluster + writeAttributePercentSettingWithValue:percentSettingArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 3a: TH writes PercentSetting attribute a non-zero value to DUT Error: %@", + err); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestThReadsAttributeListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x00004fffAnd0x0000F0000x0000Fffe2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX4fffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000050000x0000EfffAnd0x0000Ffff0xXXXX50000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_10() - { - - 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 TestReadTheGlobalAttributeEventList_11() + CHIP_ERROR TestWait1000ms_9() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: EventList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("eventList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestReadOptionalEventHardwareFaultChangeInEventList_12() + CHIP_ERROR TestStep3bThReadsFromTheDutThePercentCurrentAttribute_10() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional event(HardwareFaultChange) in EventList Error: %@", err); + [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3b: TH reads from the DUT the PercentCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("eventList", value, 0UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue( + "PercentCurrent", actualValue, mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); + } NextTest(); }]; @@ -48686,22 +49192,24 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalEventRadioFaultChangeInEventList_13() + CHIP_ERROR TestStep3cThReadsFromTheDutThePercentSettingAttribute_11() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional event(RadioFaultChange) in EventList Error: %@", err); + [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3c: TH reads from the DUT the PercentSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("eventList", value, 1UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("PercentSetting", actualValue)); + VerifyOrReturn(CheckValue( + "PercentSetting", actualValue, mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); + } NextTest(); }]; @@ -48709,101 +49217,77 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalEventNetworkFaultChangeInEventList_14() + CHIP_ERROR TestStep31aThWritesPercentSettingAttributeAZeroValueToDut_12() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional event(NetworkFaultChange) in EventList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id percentSettingArgument; + percentSettingArgument = [NSNumber numberWithUnsignedChar:0U]; + [cluster + writeAttributePercentSettingWithValue:percentSettingArgument + completion:^(NSError * _Nullable err) { + NSLog( + @"Step 3.1a: TH writes PercentSetting attribute a zero value to DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("eventList", value, 2UL)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestThReadsEventListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_15() + CHIP_ERROR TestWait1000ms_13() { - 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::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_16() + CHIP_ERROR TestStep31bThReadsFromTheDutTheTheFanModeAttribute_14() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3.1b: TH reads from the DUT the the FanMode attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("FanMode", actualValue, 0U)); + } NextTest(); }]; return CHIP_NO_ERROR; } - - CHIP_ERROR - TestThReadsAcceptedCommandListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x000000ff2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_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 - TestThReadsGeneratedCommandListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_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); - } }; -class Test_TC_DGGEN_2_1 : public TestCommandBridge { +class Test_TC_FAN_3_2 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DGGEN_2_1() - : TestCommandBridge("Test_TC_DGGEN_2_1") + Test_TC_FAN_3_2() + : TestCommandBridge("Test_TC_FAN_3_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigSpeedSetting", 0, UINT8_MAX, &mConfigSpeedSetting); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DGGEN_2_1() {} + ~Test_TC_FAN_3_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -48811,11 +49295,11 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DGGEN_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_3_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DGGEN_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_3_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -48828,138 +49312,40 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { // 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(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Step 1: Wait for the commissioned device to be retrieved\n"); + err = TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads NetworkInterfaces structure attribute from DUT.\n"); - if (ShouldSkip("DGGEN.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH writes SpeedSetting attribute a valid value to DUT\n"); + if (ShouldSkip("FAN.S.A0005")) { NextTest(); return; } - err = TestThReadsNetworkInterfacesStructureAttributeFromDut_1(); + err = TestStep2ThWritesSpeedSettingAttributeAValidValueToDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads a RebootCount attribute value from DUT.\n"); - if (ShouldSkip("DGGEN.S.A0001")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0005")) { NextTest(); return; } - err = TestThReadsARebootCountAttributeValueFromDut_2(); + err = TestWait1000ms_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reboot target device\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3: TH reads from the DUT the the SpeedSetting attribute\n"); + if (ShouldSkip("FAN.S.A0005")) { NextTest(); return; } - err = TestRebootTargetDevice_3(); + err = TestStep3ThReadsFromTheDutTheTheSpeedSettingAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reboot target device(DUT)\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestRebootTargetDeviceDUT_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reboot target device\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestRebootTargetDevice_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reboot target device(DUT)\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestRebootTargetDeviceDUT_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_7(); - break; - case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : DUT reboots and TH reads a UpTime attribute value of DUT since some arbitrary start time of " - "DUT rebooting.\n"); - if (ShouldSkip("DGGEN.S.A0002")) { - NextTest(); - return; - } - err = TestDutRebootsAndThReadsAUpTimeAttributeValueOfDutSinceSomeArbitraryStartTimeOfDutRebooting_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads a TotalOperationalHours attribute value from DUT.\n"); - if (ShouldSkip("DGGEN.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsATotalOperationalHoursAttributeValueFromDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reboot target device\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestRebootTargetDevice_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reboot target device(DUT)\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestRebootTargetDeviceDUT_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : TH reads BootReason attribute value from DUT.\n"); - if (ShouldSkip("DGGEN.S.A0004")) { - NextTest(); - return; - } - err = TestThReadsBootReasonAttributeValueFromDut_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : TH reads ActiveHardwareFaults attribute value from DUT.\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0005")) { - NextTest(); - return; - } - err = TestThReadsActiveHardwareFaultsAttributeValueFromDut_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : TH reads ActiveRadioFaults attribute value from DUT.\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0006")) { - NextTest(); - return; - } - err = TestThReadsActiveRadioFaultsAttributeValueFromDut_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : TH reads ActiveNetworkFaults attribute value from DUT.\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0007")) { - NextTest(); - return; - } - err = TestThReadsActiveNetworkFaultsAttributeValueFromDut_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : TH reads TestEventTriggersEnabled attribute value\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0008")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4: TH reads from the DUT the the SpeedCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0006")) { NextTest(); return; } - err = TestThReadsTestEventTriggersEnabledAttributeValue_17(); + err = TestStep4ThReadsFromTheDutTheTheSpeedCurrentAttribute_4(); break; } @@ -48987,45 +49373,6 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { 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; } // Go on to the next test. @@ -49039,14 +49386,15 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigSpeedSetting; chip::Optional mTimeout; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -49054,44 +49402,55 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsNetworkInterfacesStructureAttributeFromDut_1() + CHIP_ERROR TestStep2ThWritesSpeedSettingAttributeAValidValueToDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeNetworkInterfacesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads NetworkInterfaces structure attribute from DUT. Error: %@", err); + id speedSettingArgument; + speedSettingArgument = mConfigSpeedSetting.HasValue() ? [NSNumber numberWithUnsignedChar:mConfigSpeedSetting.Value()] + : [NSNumber numberWithUnsignedChar:50U]; + [cluster + writeAttributeSpeedSettingWithValue:speedSettingArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2: TH writes SpeedSetting attribute a valid value to DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("networkInterfaces", "list", "list")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsARebootCountAttributeValueFromDut_2() + CHIP_ERROR TestWait1000ms_2() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestStep3ThReadsFromTheDutTheTheSpeedSettingAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeRebootCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads a RebootCount attribute value from DUT. Error: %@", err); + [cluster readAttributeSpeedSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3: TH reads from the DUT the the SpeedSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("rebootCount", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("rebootCount", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("rebootCount", [value unsignedShortValue], 65535U)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("SpeedSetting", actualValue)); + VerifyOrReturn( + CheckValue("SpeedSetting", actualValue, mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U)); + } NextTest(); }]; @@ -49099,116 +49458,143 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRebootTargetDevice_3() - { - - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot("alpha", value); - } - - CHIP_ERROR TestRebootTargetDeviceDUT_4() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message - = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestRebootTargetDevice_5() - { - - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot("alpha", value); - } - - CHIP_ERROR TestRebootTargetDeviceDUT_6() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message - = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_7() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestDutRebootsAndThReadsAUpTimeAttributeValueOfDutSinceSomeArbitraryStartTimeOfDutRebooting_8() + CHIP_ERROR TestStep4ThReadsFromTheDutTheTheSpeedCurrentAttribute_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeUpTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"DUT reboots and TH reads a UpTime attribute value of DUT since some arbitrary start time of DUT rebooting. " - @"Error: %@", - err); + [cluster readAttributeSpeedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 4: TH reads from the DUT the the SpeedCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("upTime", "int64u", "int64u")); + { + id actualValue = value; + VerifyOrReturn( + CheckValue("SpeedCurrent", actualValue, mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestThReadsATotalOperationalHoursAttributeValueFromDut_9() +class Test_TC_FAN_3_4 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FAN_3_4() + : TestCommandBridge("Test_TC_FAN_3_4") + , mTestIndex(0) { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWindSetting", 0, UINT8_MAX, &mConfigWindSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + ~Test_TC_FAN_3_4() {} - [cluster readAttributeTotalOperationalHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads a TotalOperationalHours attribute value from DUT. Error: %@", err); + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_3_4\n"); + } - VerifyOrReturn(CheckConstraintType("totalOperationalHours", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("totalOperationalHours", [value unsignedIntValue], 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("totalOperationalHours", [value unsignedIntValue], 4294967294UL)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_3_4\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - 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 : Step 1: Wait for the commissioned device to be retrieved\n"); + err = TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH writes WindSetting attribute a valid value to DUT\n"); + if (ShouldSkip("FAN.S.A0008")) { + NextTest(); + return; + } + err = TestStep2ThWritesWindSettingAttributeAValidValueToDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0008")) { + NextTest(); + return; + } + err = TestWait1000ms_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3: TH reads from the DUT the the WindSetting attribute\n"); + if (ShouldSkip("FAN.S.A0008")) { + NextTest(); + return; + } + err = TestStep3ThReadsFromTheDutTheTheWindSettingAttribute_3(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestRebootTargetDevice_10() + 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; + } - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot("alpha", value); + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); } - CHIP_ERROR TestRebootTargetDeviceDUT_11() + chip::System::Clock::Timeout GetWaitDuration() const override { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message - = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_12() +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mConfigWindSetting; + chip::Optional mTimeout; + + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -49216,75 +49602,66 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsBootReasonAttributeValueFromDut_13() + CHIP_ERROR TestStep2ThWritesWindSettingAttributeAValidValueToDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeBootReasonWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads BootReason attribute value from DUT. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id windSettingArgument; + windSettingArgument = mConfigWindSetting.HasValue() ? [NSNumber numberWithUnsignedChar:mConfigWindSetting.Value()] + : [NSNumber numberWithUnsignedChar:1U]; + [cluster writeAttributeWindSettingWithValue:windSettingArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2: TH writes WindSetting attribute a valid value to DUT Error: %@", err); - VerifyOrReturn(CheckConstraintMinValue("bootReason", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("bootReason", [value unsignedCharValue], 6U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsActiveHardwareFaultsAttributeValueFromDut_14() + CHIP_ERROR TestWait1000ms_2() { - 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::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestThReadsActiveRadioFaultsAttributeValueFromDut_15() + CHIP_ERROR TestStep3ThReadsFromTheDutTheTheWindSettingAttribute_3() { - 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); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR TestThReadsActiveNetworkFaultsAttributeValueFromDut_16() - { + [cluster readAttributeWindSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3: TH reads from the DUT the the WindSetting attribute Error: %@", err); - 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); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - CHIP_ERROR TestThReadsTestEventTriggersEnabledAttributeValue_17() - { + { + id actualValue = value; + VerifyOrReturn( + CheckValue("WindSetting", actualValue, mConfigWindSetting.HasValue() ? mConfigWindSetting.Value() : 1U)); + } - 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); + NextTest(); + }]; + + return CHIP_NO_ERROR; } }; -class Test_TC_I_1_1 : public TestCommandBridge { +class Test_TC_CGEN_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_I_1_1() - : TestCommandBridge("Test_TC_I_1_1") + Test_TC_CGEN_1_1() + : TestCommandBridge("Test_TC_CGEN_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -49294,7 +49671,7 @@ class Test_TC_I_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_I_1_1() {} + ~Test_TC_CGEN_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -49302,11 +49679,11 @@ class Test_TC_I_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CGEN_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CGEN_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -49323,43 +49700,29 @@ class Test_TC_I_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); - err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the FeatureMap attribute from the DUT\n"); - err = TestThReadsTheFeatureMapAttributeFromTheDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + err = TestReadTheGlobalAttributeFeatureMap_2(); break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: EventList\n"); + err = TestReadTheGlobalAttributeEventList_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the optional command(TriggerEffect) in AcceptedCommandList\n"); - if (ShouldSkip("I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandTriggerEffectInAcceptedCommandList_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_5(); break; case 6: ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: GeneratedCommandList\n"); err = TestReadTheGlobalAttributeGeneratedCommandList_6(); break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Read EventList attribute from the DUT. For this cluster the list is usually empty but it can " - "contain manufacturer specific event IDs.\n"); - if (ShouldSkip("PICS_USER_PROMPT")) { - NextTest(); - return; - } - err = TestReadEventListAttributeFromTheDutForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_7(); - break; } if (CHIP_NO_ERROR != err) { @@ -49392,9 +49755,6 @@ class Test_TC_I_1_1 : public TestCommandBridge { case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -49408,7 +49768,7 @@ class Test_TC_I_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 7; chip::Optional mNodeId; chip::Optional mCluster; @@ -49423,21 +49783,23 @@ class Test_TC_I_1_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the ClusterRevision attribute from the DUT Error: %@", err); + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 4U)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); } VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); @@ -49447,15 +49809,17 @@ class Test_TC_I_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsTheFeatureMapAttributeFromTheDut_2() + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the FeatureMap attribute from the DUT Error: %@", err); + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -49475,7 +49839,9 @@ class Test_TC_I_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -49486,6 +49852,9 @@ class Test_TC_I_1_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); @@ -49499,41 +49868,50 @@ class Test_TC_I_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() + CHIP_ERROR TestReadTheGlobalAttributeEventList_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalCommandTriggerEffectInAcceptedCommandList_5() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_5() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command(TriggerEffect) in AcceptedCommandList Error: %@", err); + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 64UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 4UL)); NextTest(); }]; @@ -49545,7 +49923,9 @@ class Test_TC_I_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -49553,35 +49933,23 @@ class Test_TC_I_1_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 5UL)); + NextTest(); }]; return CHIP_NO_ERROR; } - - CHIP_ERROR - TestReadEventListAttributeFromTheDutForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_7() - { - - 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); - } }; -class Test_TC_I_2_1 : public TestCommandBridge { +class Test_TC_CGEN_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_I_2_1() - : TestCommandBridge("Test_TC_I_2_1") + Test_TC_CGEN_2_1() + : TestCommandBridge("Test_TC_CGEN_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -49591,7 +49959,7 @@ class Test_TC_I_2_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_I_2_1() {} + ~Test_TC_CGEN_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -49599,11 +49967,11 @@ class Test_TC_I_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CGEN_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CGEN_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -49620,20 +49988,63 @@ class Test_TC_I_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the IdentifyTime attribute from the DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH1 reads the BreadCrumb Attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0000")) { NextTest(); return; } - err = TestThReadsTheIdentifyTimeAttributeFromTheDut_1(); + err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the IdentifyType attribute from the DUT\n"); - if (ShouldSkip("I.S.A0001")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH1 writes the BreadCrumb attribute as 1 to the DUT\n"); + if (ShouldSkip("CGEN.S.A0000")) { NextTest(); return; } - err = TestThReadsTheIdentifyTypeAttributeFromTheDut_2(); + err = TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH1 reads the BreadCrumb attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0000")) { + NextTest(); + return; + } + err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH1 reads the RegulatoryConfig attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0002")) { + NextTest(); + return; + } + err = TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH1 reads the LocationCapability attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0003")) { + NextTest(); + return; + } + err = TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5(); + break; + case 6: + ChipLogProgress(chipTool, + " ***** Test Step 6 : TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the " + "BasicCommissioningInfo attribute has the following field: FailSafeExpiryLengthSeconds field value is within a " + "duration range of 0 to 65535\n"); + if (ShouldSkip("CGEN.S.A0001")) { + NextTest(); + return; + } + err = TestTh1ReadsBasicCommissioningInfoAttributeFromDutAndVerifyThatTheBasicCommissioningInfoAttributeHasTheFollowingFieldFailSafeExpiryLengthSecondsFieldValueIsWithinADurationRangeOf0To65535_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH1 reads SupportsConcurrentConnection attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0004")) { + NextTest(); + return; + } + err = TestTh1ReadsSupportsConcurrentConnectionAttributeFromTheDut_7(); break; } @@ -49655,6 +50066,21 @@ class Test_TC_I_2_1 : public TestCommandBridge { 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; } // Go on to the next test. @@ -49668,7 +50094,7 @@ class Test_TC_I_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 8; chip::Optional mNodeId; chip::Optional mCluster; @@ -49683,169 +50109,375 @@ class Test_TC_I_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsTheIdentifyTimeAttributeFromTheDut_1() + CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the IdentifyTime attribute from the DUT Error: %@", err); + [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the BreadCrumb Attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("identifyTime", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 65535U)); - + VerifyOrReturn(CheckConstraintType("breadcrumb", "int64u", "int64u")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsTheIdentifyTypeAttributeFromTheDut_2() + CHIP_ERROR TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the IdentifyType attribute from the DUT Error: %@", err); + id breadcrumbArgument; + breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:1ULL]; + [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument + completion:^(NSError * _Nullable err) { + NSLog(@"TH1 writes the BreadCrumb attribute as 1 to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the BreadCrumb attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("identifyType", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("identifyType", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyType", [value unsignedCharValue], 5U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("Breadcrumb", actualValue, 1ULL)); + } NextTest(); }]; return CHIP_NO_ERROR; } -}; -class Test_TC_I_2_2 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_I_2_2() - : TestCommandBridge("Test_TC_I_2_2") - , mTestIndex(0) + CHIP_ERROR TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRegulatoryConfigWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the RegulatoryConfig attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("regulatoryConfig", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("regulatoryConfig", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_I_2_2() {} + CHIP_ERROR TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5() + { - /////////// TestCommand Interface ///////// - void NextTest() override + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLocationCapabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the LocationCapability attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("locationCapability", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("locationCapability", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestTh1ReadsBasicCommissioningInfoAttributeFromDutAndVerifyThatTheBasicCommissioningInfoAttributeHasTheFollowingFieldFailSafeExpiryLengthSecondsFieldValueIsWithinADurationRangeOf0To65535_6() { - CHIP_ERROR err = CHIP_NO_ERROR; - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_2\n"); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + [cluster readAttributeBasicCommissioningInfoWithCompletion:^( + MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, NSError * _Nullable err) { + NSLog( + @"TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the BasicCommissioningInfo attribute has the " + @"following field: FailSafeExpiryLengthSeconds field value is within a duration range of 0 to 65535 Error: %@", + err); - Wait(); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - // 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 : TH sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s).\n"); - if (ShouldSkip("I.S.C00.Rsp")) { + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1ReadsSupportsConcurrentConnectionAttributeFromTheDut_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSupportsConcurrentConnectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads SupportsConcurrentConnection attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("supportsConcurrentConnection", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DGGEN_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_DGGEN_1_1() + : TestCommandBridge("Test_TC_DGGEN_1_1") + , 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_DGGEN_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DGGEN_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DGGEN_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("DGGEN.S.Afffd")) { NextTest(); return; } - err = TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x003c60s_1(); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads immediately IdentifyTime attribute from DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("DGGEN.S.Afffc")) { NextTest(); return; } - err = TestThReadsImmediatelyIdentifyTimeAttributeFromDut_2(); + err = TestReadTheGlobalAttributeFeatureMap_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 10000ms\n"); - err = TestWait10000ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("DGGEN.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : After 10 seconds, the TH reads IdentifyTime attribute from DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : Read optional attribute(UpTime) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0002 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestAfter10SecondsTheThReadsIdentifyTimeAttributeFromDut_4(); + err = TestReadOptionalAttributeUpTimeInAttributeList_4(); break; case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : TH sends IdentifyQuery command to DUT and Verify IdentifyQueryResponse command to TH,with " - "the Timeout field set to a value in the range 0x0000 to 0x0032\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C01.Rsp && I.S.C00.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Read optional attribute(TotalOperationalHours) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0003 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestThSendsIdentifyQueryCommandToDutAndVerifyIdentifyQueryResponseCommandToTHwithTheTimeoutFieldSetToAValueInTheRange0x0000To0x0032_5(); + err = TestReadOptionalAttributeTotalOperationalHoursInAttributeList_5(); break; case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop " - "identifying).\n"); - if (ShouldSkip("I.S.C00.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : Read optional attribute(BootReason) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0004 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x0000StopIdentifying_6(); + err = TestReadOptionalAttributeBootReasonInAttributeList_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads immediately IdentifyTime attribute from DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 7 : Read optional attribute(ActiveHardwareFaults) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0005 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestThReadsImmediatelyIdentifyTimeAttributeFromDut_7(); + err = TestReadOptionalAttributeActiveHardwareFaultsInAttributeList_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Read optional attribute(ActiveRadioFaults) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0006 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestThWritesAValueOf0x000f15sToIdentifyTimeAttributeOfDut_8(); + err = TestReadOptionalAttributeActiveRadioFaultsInAttributeList_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); - err = TestWait5000ms_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Read optional attribute(ActiveNetworkFaults) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0007 && DGGEN.S.Afffb")) { + NextTest(); + return; + } + err = TestReadOptionalAttributeActiveNetworkFaultsInAttributeList_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : After 5 seconds, the TH reads IdentifyTime attribute from DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, + " ***** Test Step 10 : TH reads AttributeList attribute from DUT. 1.The list SHALL NOT contain any additional " + "values in the standard or scoped range: (0x0000_0000 - 0x0000_4FFF) and (0x0000_F000 - 0x0000_FFFE) 2.The list " + "MAY contain values in the Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_4FFF), where XXXX " + "is the allowed MEI range (0x0001 - 0xFFF1), these values SHALL be ignored. 3.The list SHALL NOT contain any " + "values in the Test Vendor or invalid range: (0x0000_5000 - 0x0000_EFFF and 0x0000_FFFF), (0xXXXX_5000 - " + "0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestAfter5SecondsTheThReadsIdentifyTimeAttributeFromDut_10(); + err = TestThReadsAttributeListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x00004fffAnd0x0000F0000x0000Fffe2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX4fffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000050000x0000EfffAnd0x0000Ffff0xXXXX50000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Read the global attribute: EventList\n"); + if (ShouldSkip("DGGEN.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read optional event(HardwareFaultChange) in EventList\n"); + if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E00")) { + NextTest(); + return; + } + err = TestReadOptionalEventHardwareFaultChangeInEventList_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Read optional event(RadioFaultChange) in EventList\n"); + if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E01")) { + NextTest(); + return; + } + err = TestReadOptionalEventRadioFaultChangeInEventList_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read optional event(NetworkFaultChange) in EventList\n"); + if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E02")) { + NextTest(); + return; + } + err = TestReadOptionalEventNetworkFaultChangeInEventList_14(); + break; + case 15: + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH reads EventList attribute from DUT. 1.The list MAY contain values in the Manufacturer " + "Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI range (0x0001 - " + "0xFFF1), these values SHALL be ignored. 2.The list SHALL NOT contain any values in the Test Vendor or invalid " + "range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where XXXX is " + "the allowed MEI range (0x0001 - 0xFFF1)\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afffa")) { + NextTest(); + return; + } + err = TestThReadsEventListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("DGGEN.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH reads AcceptedCommandList attribute from DUT. 1.The list SHALL NOT contain any " + "additional values in the standard or scoped range: (0x0000_0000 - 0x0000_00FF). 2.The list MAY contain values in " + "the Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI " + "range (0x0001 - 0xFFF1), these values SHALL be ignored.3.The list SHALL NOT contain any values in the Test Vendor " + "or invalid range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where " + "XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afff9")) { + NextTest(); + return; + } + err = TestThReadsAcceptedCommandListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x000000ff2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : TH reads GeneratedCommandList attribute from DUT. 1.The list MAY contain values in the " + "Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI range " + "(0x0001 - 0xFFF1), these values SHALL be ignored. 2.The list SHALL NOT contain any values in the Test Vendor or " + "invalid range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where " + "XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afff8")) { + NextTest(); + return; + } + err = TestThReadsGeneratedCommandListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_18(); break; } @@ -49891,6 +50523,30 @@ class Test_TC_I_2_2 : public TestCommandBridge { 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; } // Go on to the next test. @@ -49904,7 +50560,7 @@ class Test_TC_I_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; + const uint16_t mTestCount = 19; chip::Optional mNodeId; chip::Optional mCluster; @@ -49919,71 +50575,220 @@ class Test_TC_I_2_2 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x003c60s_1() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; - params.identifyTime = [NSNumber numberWithUnsignedShort:60U]; - [cluster - identifyWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s). Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsImmediatelyIdentifyTimeAttributeFromDut_2() + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads immediately IdentifyTime attribute from DUT Error: %@", err); + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 51U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 69U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait10000ms_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestAfter10SecondsTheThReadsIdentifyTimeAttributeFromDut_4() + CHIP_ERROR TestReadOptionalAttributeUpTimeInAttributeList_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"After 10 seconds, the TH reads IdentifyTime attribute from DUT Error: %@", err); + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(UpTime) in AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 42U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 58U)); + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeTotalOperationalHoursInAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(TotalOperationalHours) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeBootReasonInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(BootReason) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeActiveHardwareFaultsInAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(ActiveHardwareFaults) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeActiveRadioFaultsInAttributeList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(ActiveRadioFaults) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeActiveNetworkFaultsInAttributeList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(ActiveNetworkFaults) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); NextTest(); }]; @@ -49992,7 +50797,7 @@ class Test_TC_I_2_2 : public TestCommandBridge { } CHIP_ERROR - TestThSendsIdentifyQueryCommandToDutAndVerifyIdentifyQueryResponseCommandToTHwithTheTimeoutFieldSetToAValueInTheRange0x0000To0x0032_5() + TestThReadsAttributeListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x00004fffAnd0x0000F0000x0000Fffe2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX4fffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000050000x0000EfffAnd0x0000Ffff0xXXXX50000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_10() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -50002,45 +50807,45 @@ class Test_TC_I_2_2 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x0000StopIdentifying_6() + CHIP_ERROR TestReadTheGlobalAttributeEventList_11() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; - params.identifyTime = [NSNumber numberWithUnsignedShort:0U]; - [cluster identifyWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop " - @"identifying). Error: %@", - err); + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("eventList", value, 3UL)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsImmediatelyIdentifyTimeAttributeFromDut_7() + CHIP_ERROR TestReadOptionalEventHardwareFaultChangeInEventList_12() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads immediately IdentifyTime attribute from DUT Error: %@", err); + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional event(HardwareFaultChange) in EventList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("IdentifyTime", actualValue, 0U)); - } + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("eventList", value, 0UL)); NextTest(); }]; @@ -50048,63 +50853,114 @@ class Test_TC_I_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThWritesAValueOf0x000f15sToIdentifyTimeAttributeOfDut_8() + CHIP_ERROR TestReadOptionalEventRadioFaultChangeInEventList_13() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id identifyTimeArgument; - identifyTimeArgument = [NSNumber numberWithUnsignedShort:15U]; - [cluster writeAttributeIdentifyTimeWithValue:identifyTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT Error: %@", - err); + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional event(RadioFaultChange) in EventList Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("eventList", value, 1UL)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait5000ms_9() + CHIP_ERROR TestReadOptionalEventNetworkFaultChangeInEventList_14() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional event(NetworkFaultChange) in EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("eventList", value, 2UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestAfter5SecondsTheThReadsIdentifyTimeAttributeFromDut_10() + CHIP_ERROR + TestThReadsEventListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_15() + { + + 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 TestReadTheGlobalAttributeAcceptedCommandList_16() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"After 5 seconds, the TH reads IdentifyTime attribute from DUT Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 5U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 15U)); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); NextTest(); }]; return CHIP_NO_ERROR; } + + CHIP_ERROR + TestThReadsAcceptedCommandListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x000000ff2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_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 + TestThReadsGeneratedCommandListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_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); + } }; -class Test_TC_I_2_3 : public TestCommandBridge { +class Test_TC_DGGEN_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_I_2_3() - : TestCommandBridge("Test_TC_I_2_3") + Test_TC_DGGEN_2_1() + : TestCommandBridge("Test_TC_DGGEN_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -50114,7 +50970,7 @@ class Test_TC_I_2_3 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_I_2_3() {} + ~Test_TC_DGGEN_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -50122,11 +50978,11 @@ class Test_TC_I_2_3 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DGGEN_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DGGEN_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -50139,188 +50995,138 @@ class Test_TC_I_2_3 : public TestCommandBridge { // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 1.Wait for the commissioned device to be retrieved\n"); - err = Test1WaitForTheCommissionedDeviceToBeRetrieved_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 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and " - "the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads NetworkInterfaces structure attribute from DUT.\n"); + if (ShouldSkip("DGGEN.S.A0000")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1(); + err = TestThReadsNetworkInterfacesStructureAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : DUT executes a blink effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads a RebootCount attribute value from DUT.\n"); + if (ShouldSkip("DGGEN.S.A0001")) { NextTest(); return; } - err = TestDutExecutesABlinkEffect_2(); + err = TestThReadsARebootCountAttributeValueFromDut_2(); break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " - "and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Reboot target device\n"); + if (ShouldSkip("PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3(); + err = TestRebootTargetDevice_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : DUT executes a breathe effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : Reboot target device(DUT)\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestDutExecutesABreatheEffect_4(); + err = TestRebootTargetDeviceDUT_4(); break; case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and " - "the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Reboot target device\n"); + if (ShouldSkip("PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5(); + err = TestRebootTargetDevice_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : DUT executes an okay effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : Reboot target device(DUT)\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestDutExecutesAnOkayEffect_6(); + err = TestRebootTargetDeviceDUT_6(); break; case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b channel " - "change and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : DUT executes a channel change effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, + " ***** Test Step 8 : DUT reboots and TH reads a UpTime attribute value of DUT since some arbitrary start time of " + "DUT rebooting.\n"); + if (ShouldSkip("DGGEN.S.A0002")) { NextTest(); return; } - err = TestDutExecutesAChannelChangeEffect_8(); + err = TestDutRebootsAndThReadsAUpTimeAttributeValueOfDutSinceSomeArbitraryStartTimeOfDutRebooting_8(); break; case 9: - ChipLogProgress(chipTool, - " ***** Test Step 9 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " - "and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads a TotalOperationalHours attribute value from DUT.\n"); + if (ShouldSkip("DGGEN.S.A0003")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9(); + err = TestThReadsATotalOperationalHoursAttributeValueFromDut_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : DUT executes a breathe effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Reboot target device\n"); + if (ShouldSkip("PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestDutExecutesABreatheEffect_10(); + err = TestRebootTargetDevice_10(); break; case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe finish " - "effect and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 11 : Reboot target device(DUT)\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11(); + err = TestRebootTargetDeviceDUT_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : DUT stops the breathe effect after the current effect sequence\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_12(); break; case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " - "and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 13 : TH reads BootReason attribute value from DUT.\n"); + if (ShouldSkip("DGGEN.S.A0004")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13(); + err = TestThReadsBootReasonAttributeValueFromDut_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : DUT executes a breathe effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 14 : TH reads ActiveHardwareFaults attribute value from DUT.\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0005")) { NextTest(); return; } - err = TestDutExecutesABreatheEffect_14(); + err = TestThReadsActiveHardwareFaultsAttributeValueFromDut_14(); break; case 15: - ChipLogProgress(chipTool, - " ***** Test Step 15 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " - "effect and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : TH reads ActiveRadioFaults attribute value from DUT.\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0006")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15(); + err = TestThReadsActiveRadioFaultsAttributeValueFromDut_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : DUT stops the breathe effect as soon as possible.\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 16 : TH reads ActiveNetworkFaults attribute value from DUT.\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0007")) { NextTest(); return; } - err = TestDutStopsTheBreatheEffectAsSoonAsPossible_16(); + err = TestThReadsActiveNetworkFaultsAttributeValueFromDut_16(); break; case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " - "and the effect variant field set to 0x42 unknown\n"); - if (ShouldSkip("I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Check DUT executes a blink effect.\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestCheckDutExecutesABlinkEffect_18(); - break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " - "effect and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : DUT stops any effect that may be still running as soon as possible\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 17 : TH reads TestEventTriggersEnabled attribute value\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0008")) { NextTest(); return; } - err = TestDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20(); + err = TestThReadsTestEventTriggersEnabledAttributeValue_17(); break; } @@ -50387,15 +51193,6 @@ class Test_TC_I_2_3 : public TestCommandBridge { 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; } // Go on to the next test. @@ -50409,14 +51206,14 @@ class Test_TC_I_2_3 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; - CHIP_ERROR Test1WaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -50424,207 +51221,192 @@ class Test_TC_I_2_3 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1() + CHIP_ERROR TestThReadsNetworkInterfacesStructureAttributeFromDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:0U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " - @"and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeNetworkInterfacesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads NetworkInterfaces structure attribute from DUT. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("networkInterfaces", "list", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutExecutesABlinkEffect_2() - { - - 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 - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3() + CHIP_ERROR TestThReadsARebootCountAttributeValueFromDut_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " - @"breathe and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeRebootCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads a RebootCount attribute value from DUT. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("rebootCount", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("rebootCount", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("rebootCount", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutExecutesABreatheEffect_4() + CHIP_ERROR TestRebootTargetDevice_3() + { + + chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; + return Reboot("alpha", value); + } + + CHIP_ERROR TestRebootTargetDeviceDUT_4() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.message + = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); value.expectedValue.Emplace(); value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5() + CHIP_ERROR TestRebootTargetDevice_5() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:2U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay " - @"and the effect variant field set to 0x00 default Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; + chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; + return Reboot("alpha", value); } - CHIP_ERROR TestDutExecutesAnOkayEffect_6() + CHIP_ERROR TestRebootTargetDeviceDUT_6() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.message + = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); value.expectedValue.Emplace(); value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7() + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_7() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestDutRebootsAndThReadsAUpTimeAttributeValueOfDutSinceSomeArbitraryStartTimeOfDutRebooting_8() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:11U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b " - @"channel change and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeUpTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"DUT reboots and TH reads a UpTime attribute value of DUT since some arbitrary start time of DUT rebooting. " + @"Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("upTime", "int64u", "int64u")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutExecutesAChannelChangeEffect_8() - { - - 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 - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9() + CHIP_ERROR TestThReadsATotalOperationalHoursAttributeValueFromDut_9() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " - @"breathe and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeTotalOperationalHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads a TotalOperationalHours attribute value from DUT. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("totalOperationalHours", "int32u", "int32u")); + VerifyOrReturn(CheckConstraintMinValue("totalOperationalHours", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("totalOperationalHours", [value unsignedIntValue], 4294967294UL)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutExecutesABreatheEffect_10() + CHIP_ERROR TestRebootTargetDevice_10() + { + + chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; + return Reboot("alpha", value); + } + + CHIP_ERROR TestRebootTargetDeviceDUT_11() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.message + = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); value.expectedValue.Emplace(); value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11() + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_12() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsBootReasonAttributeValueFromDut_13() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:254U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe " - @"finish effect and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeBootReasonWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads BootReason attribute value from DUT. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintMinValue("bootReason", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("bootReason", [value unsignedCharValue], 6U)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12() + CHIP_ERROR TestThReadsActiveHardwareFaultsAttributeValueFromDut_14() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -50634,32 +51416,17 @@ class Test_TC_I_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13() + CHIP_ERROR TestThReadsActiveRadioFaultsAttributeValueFromDut_15() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " - @"breathe and the effect variant field set to 0x00 default Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; + 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 TestDutExecutesABreatheEffect_14() + CHIP_ERROR TestThReadsActiveNetworkFaultsAttributeValueFromDut_16() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -50669,102 +51436,7 @@ class Test_TC_I_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:255U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " - @"effect and the effect variant field set to 0x00 default Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestDutStopsTheBreatheEffectAsSoonAsPossible_16() - { - - 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 - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:0U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:66U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " - @"and the effect variant field set to 0x42 unknown Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCheckDutExecutesABlinkEffect_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 - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:255U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " - @"effect and the effect variant field set to 0x00 default Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20() + CHIP_ERROR TestThReadsTestEventTriggersEnabledAttributeValue_17() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -50775,11 +51447,11 @@ class Test_TC_I_2_3 : public TestCommandBridge { } }; -class Test_TC_ILL_1_1 : public TestCommandBridge { +class Test_TC_I_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ILL_1_1() - : TestCommandBridge("Test_TC_ILL_1_1") + Test_TC_I_1_1() + : TestCommandBridge("Test_TC_I_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -50789,7 +51461,7 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_ILL_1_1() {} + ~Test_TC_I_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -50797,11 +51469,11 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -50818,50 +51490,42 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); + err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - err = TestReadTheGlobalAttributeFeatureMap_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the FeatureMap attribute from the DUT\n"); + err = TestThReadsTheFeatureMapAttributeFromTheDut_2(); break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the optional attribute(Tolerance) in AttributeList\n"); - if (ShouldSkip("ILL.S.A0003")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeToleranceInAttributeList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the optional attribute(LightSensorType) in AttributeList\n"); - if (ShouldSkip("ILL.S.A0004")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the optional command(TriggerEffect) in AcceptedCommandList\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeLightSensorTypeInAttributeList_5(); + err = TestReadTheOptionalCommandTriggerEffectInAcceptedCommandList_5(); break; case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_6(); + break; + case 7: ChipLogProgress(chipTool, - " ***** Test Step 6 : Read EventList attribute from the DUT.For this cluster the list is usually empty but it can " + " ***** Test Step 7 : Read EventList attribute from the DUT. For this cluster the list is usually empty but it can " "contain manufacturer specific event IDs.\n"); if (ShouldSkip("PICS_USER_PROMPT")) { NextTest(); return; } - err = TestReadEventListAttributeFromTheDUTForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_8(); + err = TestReadEventListAttributeFromTheDutForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_7(); break; } @@ -50898,9 +51562,6 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -50914,7 +51575,7 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 8; chip::Optional mNodeId; chip::Optional mCluster; @@ -50929,23 +51590,21 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + NSLog(@"TH reads the ClusterRevision attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 3U)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 4U)); } VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); @@ -50955,17 +51614,15 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + CHIP_ERROR TestThReadsTheFeatureMapAttributeFromTheDut_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + NSLog(@"TH reads the FeatureMap attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -50985,9 +51642,7 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -50998,7 +51653,6 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); @@ -51012,45 +51666,20 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeToleranceInAttributeList_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute(Tolerance) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeLightSensorTypeInAttributeList_5() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute(LightSensorType) in AttributeList Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); NextTest(); }]; @@ -51058,50 +51687,32 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR - TestReadEventListAttributeFromTheDUTForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_6() - { - - 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 TestReadTheGlobalAttributeAcceptedCommandList_7() + CHIP_ERROR TestReadTheOptionalCommandTriggerEffectInAcceptedCommandList_5() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + NSLog(@"Read the optional command(TriggerEffect) in AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(0))); - } - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 64UL)); + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_8() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_6() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -51120,13 +51731,24 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR + TestReadEventListAttributeFromTheDutForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_7() + { + + 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); + } }; -class Test_TC_ILL_2_1 : public TestCommandBridge { +class Test_TC_I_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ILL_2_1() - : TestCommandBridge("Test_TC_ILL_2_1") + Test_TC_I_2_1() + : TestCommandBridge("Test_TC_I_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -51136,7 +51758,7 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_ILL_2_1() {} + ~Test_TC_I_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -51144,11 +51766,11 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -51165,44 +51787,20 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0001")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the IdentifyTime attribute from the DUT\n"); + if (ShouldSkip("I.S.A0000")) { NextTest(); return; } - err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + err = TestThReadsTheIdentifyTimeAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads MeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsMeasuredValueAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads Tolerance attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsToleranceAttributeFromDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads LightSensorType attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0004")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the IdentifyType attribute from the DUT\n"); + if (ShouldSkip("I.S.A0001")) { NextTest(); return; } - err = TestThReadsLightSensorTypeAttributeFromDut_5(); + err = TestThReadsTheIdentifyTypeAttributeFromTheDut_2(); break; } @@ -51224,15 +51822,6 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { 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; } // Go on to the next test. @@ -51246,7 +51835,7 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -51261,104 +51850,21 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 1U)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 65533U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], 2U)); - VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value unsignedShortValue], 65534U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsMeasuredValueAttributeFromDut_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MeasuredValue attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65534U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsToleranceAttributeFromDut_4() + CHIP_ERROR TestThReadsTheIdentifyTimeAttributeFromTheDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads Tolerance attribute from DUT Error: %@", err); + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the IdentifyTime attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("tolerance", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); + VerifyOrReturn(CheckConstraintType("identifyTime", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 65535U)); NextTest(); }]; @@ -51366,26 +51872,21 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsLightSensorTypeAttributeFromDut_5() + CHIP_ERROR TestThReadsTheIdentifyTypeAttributeFromTheDut_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLightSensorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads LightSensorType attribute from DUT Error: %@", err); + [cluster readAttributeIdentifyTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the IdentifyType attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("lightSensorType", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("lightSensorType", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("lightSensorType", [value unsignedCharValue], 254U)); - } + VerifyOrReturn(CheckConstraintType("identifyType", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("identifyType", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyType", [value unsignedCharValue], 5U)); NextTest(); }]; @@ -51394,11 +51895,11 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { } }; -class Test_TC_ILL_2_2 : public TestCommandBridge { +class Test_TC_I_2_2 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ILL_2_2() - : TestCommandBridge("Test_TC_ILL_2_2") + Test_TC_I_2_2() + : TestCommandBridge("Test_TC_I_2_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -51408,7 +51909,7 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_ILL_2_2() {} + ~Test_TC_I_2_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -51416,11 +51917,11 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -51437,60 +51938,81 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0001")) { + ChipLogProgress(chipTool, + " ***** Test Step 1 : TH sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s).\n"); + if (ShouldSkip("I.S.C00.Rsp")) { NextTest(); return; } - err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + err = TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x003c60s_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0002")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads immediately IdentifyTime attribute from DUT\n"); + if (ShouldSkip("I.S.A0000")) { NextTest(); return; } - err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); + err = TestThReadsImmediatelyIdentifyTimeAttributeFromDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Cover the sensor or darken the room\n"); - if (ShouldSkip("PICS_USER_PROMPT")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 10000ms\n"); + err = TestWait10000ms_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : After 10 seconds, the TH reads IdentifyTime attribute from DUT\n"); + if (ShouldSkip("I.S.A0000")) { NextTest(); return; } - err = TestCoverTheSensorOrDarkenTheRoom_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 1s\n"); - err = TestWait1s_4(); + err = TestAfter10SecondsTheThReadsIdentifyTimeAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : After a few seconds, TH reads MeasuredValue attribute from DUT.\n"); - if (ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP")) { + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends IdentifyQuery command to DUT and Verify IdentifyQueryResponse command to TH,with " + "the Timeout field set to a value in the range 0x0000 to 0x0032\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C01.Rsp && I.S.C00.Tx")) { NextTest(); return; } - err = TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_5(); + err = TestThSendsIdentifyQueryCommandToDutAndVerifyIdentifyQueryResponseCommandToTHwithTheTimeoutFieldSetToAValueInTheRange0x0000To0x0032_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Expose the sensor again to light\n"); - if (ShouldSkip("PICS_USER_PROMPT")) { + ChipLogProgress(chipTool, + " ***** Test Step 6 : TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop " + "identifying).\n"); + if (ShouldSkip("I.S.C00.Rsp")) { NextTest(); return; } - err = TestExposeTheSensorAgainToLight_6(); + err = TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x0000StopIdentifying_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 1s\n"); - err = TestWait1s_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads immediately IdentifyTime attribute from DUT\n"); + if (ShouldSkip("I.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsImmediatelyIdentifyTimeAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : After a few seconds, TH reads MeasuredValue attribute from DUT.\n"); - if (ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT\n"); + if (ShouldSkip("I.S.A0000")) { NextTest(); return; } - err = TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_8(); + err = TestThWritesAValueOf0x000f15sToIdentifyTimeAttributeOfDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); + err = TestWait5000ms_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : After 5 seconds, the TH reads IdentifyTime attribute from DUT\n"); + if (ShouldSkip("I.S.A0000")) { + NextTest(); + return; + } + err = TestAfter5SecondsTheThReadsIdentifyTimeAttributeFromDut_10(); break; } @@ -51530,6 +52052,12 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { 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; } // Go on to the next test. @@ -51543,7 +52071,7 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 11; chip::Optional mNodeId; chip::Optional mCluster; @@ -51557,58 +52085,72 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; return WaitForCommissionee("alpha", value); } - NSNumber * _Nullable MinMeasuredValue; - CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() + CHIP_ERROR TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x003c60s_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); + __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; + params.identifyTime = [NSNumber numberWithUnsignedShort:60U]; + [cluster + identifyWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s). Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16u", "int16u")); - } - { - MinMeasuredValue = value; - } + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsImmediatelyIdentifyTimeAttributeFromDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads immediately IdentifyTime attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 51U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 69U)); NextTest(); }]; return CHIP_NO_ERROR; } - NSNumber * _Nullable MaxMeasuredValue; - CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() + CHIP_ERROR TestWait10000ms_3() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestAfter10SecondsTheThReadsIdentifyTimeAttributeFromDut_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"After 10 seconds, the TH reads IdentifyTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); - } - { - MaxMeasuredValue = value; - } + VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 42U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 58U)); NextTest(); }]; @@ -51616,42 +52158,55 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCoverTheSensorOrDarkenTheRoom_3() + CHIP_ERROR + TestThSendsIdentifyQueryCommandToDutAndVerifyIdentifyQueryResponseCommandToTHwithTheTimeoutFieldSetToAValueInTheRange0x0000To0x0032_5() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for Successgarbage: not in length on purpose", 28); + 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 TestWait1s_4() + CHIP_ERROR TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x0000StopIdentifying_6() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; + params.identifyTime = [NSNumber numberWithUnsignedShort:0U]; + [cluster identifyWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop " + @"identifying). Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_5() + CHIP_ERROR TestThReadsImmediatelyIdentifyTimeAttributeFromDut_7() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"After a few seconds, TH reads MeasuredValue attribute from DUT. Error: %@", err); + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads immediately IdentifyTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("IdentifyTime", actualValue, 0U)); } NextTest(); @@ -51660,43 +52215,50 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestExposeTheSensorAgainToLight_6() + CHIP_ERROR TestThWritesAValueOf0x000f15sToIdentifyTimeAttributeOfDut_8() { - 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); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id identifyTimeArgument; + identifyTimeArgument = [NSNumber numberWithUnsignedShort:15U]; + [cluster writeAttributeIdentifyTimeWithValue:identifyTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestWait1s_7() + CHIP_ERROR TestWait5000ms_9() { chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; + value.ms = 5000UL; return WaitForMs("alpha", value); } - CHIP_ERROR TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_8() + CHIP_ERROR TestAfter5SecondsTheThReadsIdentifyTimeAttributeFromDut_10() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"After a few seconds, TH reads MeasuredValue attribute from DUT. Error: %@", err); + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"After 5 seconds, the TH reads IdentifyTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65534U)); - } + VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 5U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 15U)); NextTest(); }]; @@ -51705,11 +52267,11 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { } }; -class Test_TC_LVL_1_1 : public TestCommandBridge { +class Test_TC_I_2_3 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_LVL_1_1() - : TestCommandBridge("Test_TC_LVL_1_1") + Test_TC_I_2_3() + : TestCommandBridge("Test_TC_I_2_3") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -51719,7 +52281,7 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_LVL_1_1() {} + ~Test_TC_I_2_3() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -51727,11 +52289,11 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -51744,136 +52306,188 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { // 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(); + ChipLogProgress(chipTool, " ***** Test Step 0 : 1.Wait for the commissioned device to be retrieved\n"); + err = Test1WaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, + " ***** Test Step 1 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and " + "the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip(" !LVL.S.F00 && !LVL.S.F01 && !LVL.S.F02 ")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : DUT executes a blink effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheGlobalAttributeFeatureMap_2(); + err = TestDutExecutesABlinkEffect_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Given LVL.S.F00(OO) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("LVL.S.F00")) { + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestGivenLvlsf00ooEnsureFeaturemapHasTheCorrectBitSet_3(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Given LVL.S.F01(LT) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("LVL.S.F01")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : DUT executes a breathe effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestGivenLvlsf01ltEnsureFeaturemapHasTheCorrectBitSet_4(); + err = TestDutExecutesABreatheEffect_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Given LVL.S.F02(FQ) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("LVL.S.F02")) { + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and " + "the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestGivenLvlsf02fqEnsureFeaturemapHasTheCorrectBitSet_5(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : DUT executes an okay effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestDutExecutesAnOkayEffect_6(); break; case 7: ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute(StartUpCurrentLevel and RemainingTime) in AttributeList\n"); - if (ShouldSkip("LVL.S.F01")) { + " ***** Test Step 7 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b channel " + "change and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeStartUpCurrentLevelAndRemainingTimeInAttributeList_7(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7(); break; case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : Read the optional attribute(CurrentFrequency, MinFrequency and MinFrequency) in " - "AttributeList\n"); - if (ShouldSkip("LVL.S.F02")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : DUT executes a channel change effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeCurrentFrequencyMinFrequencyAndMinFrequencyInAttributeList_8(); + err = TestDutExecutesAChannelChangeEffect_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional attribute(MinLevel) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0002")) { + ChipLogProgress(chipTool, + " ***** Test Step 9 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeMinLevelInAttributeList_9(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the optional attribute(MaxLevel) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0003")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : DUT executes a breathe effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeMaxLevelInAttributeList_10(); + err = TestDutExecutesABreatheEffect_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read the optional attribute(OnOffTransitionTime) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0010")) { + ChipLogProgress(chipTool, + " ***** Test Step 11 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe finish " + "effect and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeOnOffTransitionTimeInAttributeList_11(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Read the optional attribute(OnTransitionTime) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0012")) { + ChipLogProgress(chipTool, " ***** Test Step 12 : DUT stops the breathe effect after the current effect sequence\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeOnTransitionTimeInAttributeList_12(); + err = TestDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read the optional attribute(OffTransitionTime) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0013")) { + ChipLogProgress(chipTool, + " ***** Test Step 13 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeOffTransitionTimeInAttributeList_13(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Read the optional attribute(DefaultMoveRate) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0014")) { + ChipLogProgress(chipTool, " ***** Test Step 14 : DUT executes a breathe effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeDefaultMoveRateInAttributeList_14(); + err = TestDutExecutesABreatheEffect_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_15(); + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + "effect and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15(); break; case 16: - ChipLogProgress( - chipTool, " ***** Test Step 16 : Read the Feature-dependent(LVL.S.F02) command in AcceptedCommandList\n"); - if (ShouldSkip("LVL.S.F02")) { + ChipLogProgress(chipTool, " ***** Test Step 16 : DUT stops the breathe effect as soon as possible.\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheFeatureDependentLVLSF02CommandInAcceptedCommandList_16(); + err = TestDutStopsTheBreatheEffectAsSoonAsPossible_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_17(); + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " + "and the effect variant field set to 0x42 unknown\n"); + if (ShouldSkip("I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Read the global attribute: EventList\n"); - err = TestReadTheGlobalAttributeEventList_18(); + ChipLogProgress(chipTool, " ***** Test Step 18 : Check DUT executes a blink effect.\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestCheckDutExecutesABlinkEffect_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + "effect and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : DUT stops any effect that may be still running as soon as possible\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20(); break; } @@ -51943,6 +52557,12 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -51956,14 +52576,14 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; + const uint16_t mTestCount = 21; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR Test1WaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -51971,119 +52591,1666 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:0U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " + @"and the effect variant field set to 0x00 default Error: %@", + err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 5U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + CHIP_ERROR TestDutExecutesABlinkEffect_2() + { + + 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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default Error: %@", + err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestGivenLvlsf00ooEnsureFeaturemapHasTheCorrectBitSet_3() + CHIP_ERROR TestDutExecutesABreatheEffect_4() + { + + 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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given LVL.S.F00(OO) ensure featuremap has the correct bit set Error: %@", err); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:2U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay " + @"and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestGivenLvlsf01ltEnsureFeaturemapHasTheCorrectBitSet_4() + CHIP_ERROR TestDutExecutesAnOkayEffect_6() + { + + 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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given LVL.S.F01(LT) ensure featuremap has the correct bit set Error: %@", err); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:11U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b " + @"channel change and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestGivenLvlsf02fqEnsureFeaturemapHasTheCorrectBitSet_5() + CHIP_ERROR TestDutExecutesAChannelChangeEffect_8() + { + + 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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given LVL.S.F02(FQ) ensure featuremap has the correct bit set Error: %@", err); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_6() + CHIP_ERROR TestDutExecutesABreatheEffect_10() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + 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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:254U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe " + @"finish effect and the effect variant field set to 0x00 default Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12() + { + + 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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestDutExecutesABreatheEffect_14() + { + + 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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:255U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + @"effect and the effect variant field set to 0x00 default Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestDutStopsTheBreatheEffectAsSoonAsPossible_16() + { + + 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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:0U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:66U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " + @"and the effect variant field set to 0x42 unknown Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckDutExecutesABlinkEffect_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 + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:255U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + @"effect and the effect variant field set to 0x00 default Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20() + { + + 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); + } +}; + +class Test_TC_ILL_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ILL_1_1() + : TestCommandBridge("Test_TC_ILL_1_1") + , 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_ILL_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the optional attribute(Tolerance) in AttributeList\n"); + if (ShouldSkip("ILL.S.A0003")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeToleranceInAttributeList_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the optional attribute(LightSensorType) in AttributeList\n"); + if (ShouldSkip("ILL.S.A0004")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeLightSensorTypeInAttributeList_5(); + break; + case 6: + ChipLogProgress(chipTool, + " ***** Test Step 6 : Read EventList attribute from the DUT.For this cluster the list is usually empty but it can " + "contain manufacturer specific event IDs.\n"); + if (ShouldSkip("PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestReadEventListAttributeFromTheDUTForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_8(); + 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; + } + + // 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 = 9; + + 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 TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 3U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeToleranceInAttributeList_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute(Tolerance) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLightSensorTypeInAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute(LightSensorType) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadEventListAttributeFromTheDUTForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_6() + { + + 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 TestReadTheGlobalAttributeAcceptedCommandList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ILL_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ILL_2_1() + : TestCommandBridge("Test_TC_ILL_2_1") + , 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_ILL_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_1\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 : TH reads MinMeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads MeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsMeasuredValueAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads Tolerance attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsToleranceAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads LightSensorType attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsLightSensorTypeAttributeFromDut_5(); + 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; + } + + // 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 = 6; + + 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 TestThReadsMinMeasuredValueAttributeFromDut_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 1U)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 65533U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], 2U)); + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value unsignedShortValue], 65534U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsMeasuredValueAttributeFromDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65534U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsToleranceAttributeFromDut_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads Tolerance attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("tolerance", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsLightSensorTypeAttributeFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLightSensorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads LightSensorType attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("lightSensorType", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("lightSensorType", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("lightSensorType", [value unsignedCharValue], 254U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ILL_2_2 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ILL_2_2() + : TestCommandBridge("Test_TC_ILL_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_ILL_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Cover the sensor or darken the room\n"); + if (ShouldSkip("PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestCoverTheSensorOrDarkenTheRoom_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 1s\n"); + err = TestWait1s_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : After a few seconds, TH reads MeasuredValue attribute from DUT.\n"); + if (ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Expose the sensor again to light\n"); + if (ShouldSkip("PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestExposeTheSensorAgainToLight_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 1s\n"); + err = TestWait1s_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : After a few seconds, TH reads MeasuredValue attribute from DUT.\n"); + if (ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_8(); + 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; + } + + // 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 = 9; + + 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 * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16u", "int16u")); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCoverTheSensorOrDarkenTheRoom_3() + { + + 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 TestWait1s_4() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"After a few seconds, TH reads MeasuredValue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestExposeTheSensorAgainToLight_6() + { + + 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 TestWait1s_7() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"After a few seconds, TH reads MeasuredValue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65534U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_LVL_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_LVL_1_1() + : TestCommandBridge("Test_TC_LVL_1_1") + , 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_LVL_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip(" !LVL.S.F00 && !LVL.S.F01 && !LVL.S.F02 ")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Given LVL.S.F00(OO) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("LVL.S.F00")) { + NextTest(); + return; + } + err = TestGivenLvlsf00ooEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given LVL.S.F01(LT) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("LVL.S.F01")) { + NextTest(); + return; + } + err = TestGivenLvlsf01ltEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Given LVL.S.F02(FQ) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("LVL.S.F02")) { + NextTest(); + return; + } + err = TestGivenLvlsf02fqEnsureFeaturemapHasTheCorrectBitSet_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute(StartUpCurrentLevel and RemainingTime) in AttributeList\n"); + if (ShouldSkip("LVL.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeStartUpCurrentLevelAndRemainingTimeInAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, + " ***** Test Step 8 : Read the optional attribute(CurrentFrequency, MinFrequency and MinFrequency) in " + "AttributeList\n"); + if (ShouldSkip("LVL.S.F02")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeCurrentFrequencyMinFrequencyAndMinFrequencyInAttributeList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional attribute(MinLevel) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeMinLevelInAttributeList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the optional attribute(MaxLevel) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0003")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeMaxLevelInAttributeList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Read the optional attribute(OnOffTransitionTime) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0010")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeOnOffTransitionTimeInAttributeList_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read the optional attribute(OnTransitionTime) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0012")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeOnTransitionTimeInAttributeList_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Read the optional attribute(OffTransitionTime) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0013")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeOffTransitionTimeInAttributeList_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the optional attribute(DefaultMoveRate) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0014")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeDefaultMoveRateInAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_15(); + break; + case 16: + ChipLogProgress( + chipTool, " ***** Test Step 16 : Read the Feature-dependent(LVL.S.F02) command in AcceptedCommandList\n"); + if (ShouldSkip("LVL.S.F02")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentLVLSF02CommandInAcceptedCommandList_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Read the global attribute: EventList\n"); + err = TestReadTheGlobalAttributeEventList_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), 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; + } + + // 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 TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 5U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenLvlsf00ooEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given LVL.S.F00(OO) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenLvlsf01ltEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given LVL.S.F01(LT) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenLvlsf02fqEnsureFeaturemapHasTheCorrectBitSet_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given LVL.S.F02(FQ) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -57216,129 +59383,758 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { err = TestPreconditionWriteDefaultValueOfOnOffTransitionTimeAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH writes 0 to the Options attribute\n"); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH writes 0 to the Options attribute\n"); + if (ShouldSkip("LVL.S.A000f")) { + NextTest(); + return; + } + err = TestThWrites0ToTheOptionsAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH sends On command to DUT\n"); + if (ShouldSkip("OO.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsOnCommandToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, + " ***** Test Step 4 : TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)\n"); + if (ShouldSkip("LVL.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsAMoveToLevelCommandToDutWithLevel50AndTransitionTime0Immediate_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads CurrentLevel attribute from DUT\n"); + if (ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThReadsCurrentLevelAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, + " ***** Test Step 6 : TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the " + "Rate field set to 0x05 (5 units/s)\n"); + if (ShouldSkip("LVL.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 5000ms\n"); + err = TestWait5000ms_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Sends stop command to DUT\n"); + if (ShouldSkip("LVL.S.C03.Rsp")) { + NextTest(); + return; + } + err = TestSendsStopCommandToDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Physically verify that the device has stopped transitioning\n"); + if (ShouldSkip("PICS_USER_PROMPT && LVL.S.C03.Rsp")) { + NextTest(); + return; + } + err = TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads CurrentLevel attribute from DUT\n"); + if (ShouldSkip("LVL.S.C01.Rsp && LVL.S.C03.Rsp && LVL.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsCurrentLevelAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the " + "Rate field set to 0x05 (5 units/s)\n"); + if (ShouldSkip("LVL.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 5000ms\n"); + err = TestWait5000ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends a StopWithOnOff command to the DUT\n"); + if (ShouldSkip("LVL.S.C07.Rsp")) { + NextTest(); + return; + } + err = TestThSendsAStopWithOnOffCommandToTheDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Physically verify that the device has stopped transitioning\n"); + if (ShouldSkip("PICS_USER_PROMPT && LVL.S.C07.Rsp")) { + NextTest(); + return; + } + err = TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads CurrentLevel attribute from DUT\n"); + if (ShouldSkip("LVL.S.C01.Rsp && LVL.S.C07.Rsp && LVL.S.A0000")) { + NextTest(); + return; + } + err = TestReadsCurrentLevelAttributeFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Precondition send Off Command\n"); + if (ShouldSkip("OO.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestPreconditionSendOffCommand_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Check on/off attribute value is false after off command\n"); + if (ShouldSkip("OO.S.A0000")) { + NextTest(); + return; + } + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_17(); + 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; + } + + // 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 = 18; + + 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 TestPreconditionWriteDefaultValueOfOnOffTransitionTimeAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id onOffTransitionTimeArgument; + onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:0U]; + [cluster + writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument + completion:^(NSError * _Nullable err) { + NSLog( + @"Precondition: write default value of OnOffTransitionTime attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWrites0ToTheOptionsAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id optionsArgument; + optionsArgument = [NSNumber numberWithUnsignedChar:0U]; + [cluster writeAttributeOptionsWithValue:optionsArgument + completion:^(NSError * _Nullable err) { + NSLog(@"TH writes 0 to the Options attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsOnCommandToDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster onWithCompletion:^(NSError * _Nullable err) { + NSLog(@"TH sends On command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsAMoveToLevelCommandToDutWithLevel50AndTransitionTime0Immediate_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:50U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster + moveToLevelWithParams:params + completion:^(NSError * _Nullable err) { + NSLog( + @"TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate) Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsCurrentLevelAttributeFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads CurrentLevel attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("CurrentLevel", actualValue)); + VerifyOrReturn(CheckValue("CurrentLevel", actualValue, 50U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0U]; + params.rate = [NSNumber numberWithUnsignedChar:5U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster moveWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate " + @"field set to 0x05 (5 units/s) Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait5000ms_7() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestSendsStopCommandToDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterStopParams alloc] init]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster stopWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Sends stop command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_9() + { + + 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 TestThReadsCurrentLevelAttributeFromDut_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads CurrentLevel attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 64U)); + VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 86U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0U]; + params.rate = [NSNumber numberWithUnsignedChar:5U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster moveWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate " + @"field set to 0x05 (5 units/s) Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait5000ms_12() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestThSendsAStopWithOnOffCommandToTheDut_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterStopWithOnOffParams alloc] init]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster stopWithOnOffWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends a StopWithOnOff command to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_14() + { + + 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 TestReadsCurrentLevelAttributeFromDut_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 85U)); + VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 115U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestPreconditionSendOffCommand_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletion:^(NSError * _Nullable err) { + NSLog(@"Precondition send Off Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_LVL_7_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_LVL_7_1() + : TestCommandBridge("Test_TC_LVL_7_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("RandomLevelValue", 0, UINT8_MAX, &mRandomLevelValue); + AddArgument("RandomFrequencyValue", 0, UINT16_MAX, &mRandomFrequencyValue); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_LVL_7_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_7_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_7_1\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: write default value of OnOffTransitionTime attribute\n"); + if (ShouldSkip("LVL.S.A0010")) { + NextTest(); + return; + } + err = TestPreconditionWriteDefaultValueOfOnOffTransitionTimeAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 0a: TH writes 0 to the Options attribute\n"); if (ShouldSkip("LVL.S.A000f")) { NextTest(); return; } - err = TestThWrites0ToTheOptionsAttribute_2(); + err = TestStep0aThWrites0ToTheOptionsAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH sends On command to DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 0b: TH sends On command to DUT\n"); if (ShouldSkip("OO.S.C01.Rsp")) { NextTest(); return; } - err = TestThSendsOnCommandToDut_3(); + err = TestStep0bThSendsOnCommandToDut_3(); break; case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)\n"); - if (ShouldSkip("LVL.S.C00.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 1a: TH reads the MinLevel attribute from the DUT\n"); + if (ShouldSkip("LVL.S.A0002")) { NextTest(); return; } - err = TestThSendsAMoveToLevelCommandToDutWithLevel50AndTransitionTime0Immediate_4(); + err = TestStep1aThReadsTheMinLevelAttributeFromTheDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads CurrentLevel attribute from DUT\n"); - if (ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 1b: TH reads the MaxLevel attribute from the DUT\n"); + if (ShouldSkip("LVL.S.A0003")) { NextTest(); return; } - err = TestThReadsCurrentLevelAttributeFromDut_5(); + err = TestStep1bThReadsTheMaxLevelAttributeFromTheDut_5(); break; case 6: ChipLogProgress(chipTool, - " ***** Test Step 6 : TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the " - "Rate field set to 0x05 (5 units/s)\n"); - if (ShouldSkip("LVL.S.C01.Rsp")) { + " ***** Test Step 6 : Step 1c: TH sends a MoveToLevel command to DUT, with the Level field set to a value between " + "the MinLevel and MaxLevel values (if present, otherwise between 0x01 and 0xFE) and the TransitionTime field set " + "to 0x0000 (move immediately).\n"); + if (ShouldSkip("LVL.S.C00.Rsp")) { NextTest(); return; } - err = TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_6(); + err = TestStep1cThSendsAMoveToLevelCommandToDutWithTheLevelFieldSetToAValueBetweenTheMinLevelAndMaxLevelValuesIfPresentOtherwiseBetween0x01And0xFEAndTheTransitionTimeFieldSetTo0x0000MoveImmediately_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 5000ms\n"); - err = TestWait5000ms_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 100ms\n"); + err = TestWait100ms_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Sends stop command to DUT\n"); - if (ShouldSkip("LVL.S.C03.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 1d: TH reads CurrentLevel attribute from DUT\n"); + if (ShouldSkip("LVL.S.C00.Rsp && LVL.S.A0000")) { NextTest(); return; } - err = TestSendsStopCommandToDut_8(); + err = TestStep1dThReadsCurrentLevelAttributeFromDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Physically verify that the device has stopped transitioning\n"); - if (ShouldSkip("PICS_USER_PROMPT && LVL.S.C03.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 2a: TH reads the CurrentFrequency attribute.\n"); + if (ShouldSkip("LVL.S.A0004")) { NextTest(); return; } - err = TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_9(); + err = TestStep2aThReadsTheCurrentFrequencyAttribute_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads CurrentLevel attribute from DUT\n"); - if (ShouldSkip("LVL.S.C01.Rsp && LVL.S.C03.Rsp && LVL.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 2b: TH reads the MinFrequency attribute.\n"); + if (ShouldSkip("LVL.S.A0005")) { NextTest(); return; } - err = TestThReadsCurrentLevelAttributeFromDut_10(); + err = TestStep2bThReadsTheMinFrequencyAttribute_10(); break; case 11: ChipLogProgress(chipTool, - " ***** Test Step 11 : TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the " - "Rate field set to 0x05 (5 units/s)\n"); - if (ShouldSkip("LVL.S.C01.Rsp")) { + " ***** Test Step 11 : Step 2c: TH reads the MaxFrequency attribute and check, if fmax < fmin, FAIL the test.\n"); + if (ShouldSkip("LVL.S.A0006")) { NextTest(); return; } - err = TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_11(); + err = TestStep2cThReadsTheMaxFrequencyAttributeAndCheckIfFmaxFminFailTheTest_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 5000ms\n"); - err = TestWait5000ms_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends a StopWithOnOff command to the DUT\n"); - if (ShouldSkip("LVL.S.C07.Rsp")) { + ChipLogProgress(chipTool, + " ***** Test Step 12 : Step 2d: sanity check on values read in steps 2a..2c, if fc < fmin, FAIL the test and fc > " + "fmax, FAIL the test\n"); + if (ShouldSkip("LVL.S.A0004")) { NextTest(); return; } - err = TestThSendsAStopWithOnOffCommandToTheDut_13(); + err = TestStep2dSanityCheckOnValuesReadInSteps2a2cIfFcFminFailTheTestAndFcFmaxFailTheTest_12(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Physically verify that the device has stopped transitioning\n"); - if (ShouldSkip("PICS_USER_PROMPT && LVL.S.C07.Rsp")) { + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Step 3a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to " + "a random value frand, chosen such that: fmin < frand < fmax\n"); + if (ShouldSkip("LVL.S.C08.Rsp")) { NextTest(); return; } - err = TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_14(); + err = TestStep3aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToARandomValueFrandChosenSuchThatFminFrandFmax_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Wait 100ms\n"); + err = TestWait100ms_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reads CurrentLevel attribute from DUT\n"); - if (ShouldSkip("LVL.S.C01.Rsp && LVL.S.C07.Rsp && LVL.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 3b: TH reads the CurrentFrequency attribute.\n"); + if (ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004")) { NextTest(); return; } - err = TestReadsCurrentLevelAttributeFromDut_15(); + err = TestStep3bThReadsTheCurrentFrequencyAttribute_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Precondition send Off Command\n"); - if (ShouldSkip("OO.S.C00.Rsp")) { + ChipLogProgress(chipTool, + " ***** Test Step 16 : Step 4a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to " + "fmax + 1\n"); + if (ShouldSkip("LVL.S.C08.Rsp && PICS_USER_PROMPT")) { NextTest(); return; } - err = TestPreconditionSendOffCommand_16(); + err = TestStep4aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToFmax1_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Check on/off attribute value is false after off command\n"); - if (ShouldSkip("OO.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 17 : Step 4b: TH reads the CurrentFrequency attribute.\n"); + if (ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT")) { NextTest(); return; } - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_17(); + err = TestStep4bThReadsTheCurrentFrequencyAttribute_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Step 5a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to " + "fmin - 1\n"); + if (ShouldSkip("LVL.S.C08.Rsp && PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestStep5aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToFmin1_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Step 5b: TH reads the CurrentFrequency attribute.\n"); + if (ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestStep5bThReadsTheCurrentFrequencyAttribute_19(); break; } @@ -57405,6 +60201,12 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { 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; } // Go on to the next test. @@ -57418,11 +60220,13 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 20; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mRandomLevelValue; + chip::Optional mRandomFrequencyValue; chip::Optional mTimeout; CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() @@ -57457,7 +60261,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThWrites0ToTheOptionsAttribute_2() + CHIP_ERROR TestStep0aThWrites0ToTheOptionsAttribute_2() { MTRBaseDevice * device = GetDevice("alpha"); @@ -57468,7 +60272,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { optionsArgument = [NSNumber numberWithUnsignedChar:0U]; [cluster writeAttributeOptionsWithValue:optionsArgument completion:^(NSError * _Nullable err) { - NSLog(@"TH writes 0 to the Options attribute Error: %@", err); + NSLog(@"Step 0a: TH writes 0 to the Options attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -57478,7 +60282,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsOnCommandToDut_3() + CHIP_ERROR TestStep0bThSendsOnCommandToDut_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -57486,7 +60290,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster onWithCompletion:^(NSError * _Nullable err) { - NSLog(@"TH sends On command to DUT Error: %@", err); + NSLog(@"Step 0b: TH sends On command to DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -57495,50 +60299,51 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull minLevelValue; - CHIP_ERROR TestThSendsAMoveToLevelCommandToDutWithLevel50AndTransitionTime0Immediate_4() + CHIP_ERROR TestStep1aThReadsTheMinLevelAttributeFromTheDut_4() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:50U]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster - moveToLevelWithParams:params - completion:^(NSError * _Nullable err) { - NSLog( - @"TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate) Error: %@", - err); + [cluster readAttributeMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1a: TH reads the MinLevel attribute from the DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("minLevel", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("minLevel", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minLevel", [value unsignedCharValue], 254U)); + { + minLevelValue = value; + } + + NextTest(); + }]; return CHIP_NO_ERROR; } + NSNumber * _Nonnull maxLevelValue; - CHIP_ERROR TestThReadsCurrentLevelAttributeFromDut_5() + CHIP_ERROR TestStep1bThReadsTheMaxLevelAttributeFromTheDut_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1b: TH reads the MaxLevel attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckConstraintType("maxLevel", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("maxLevel", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("maxLevel", [value unsignedCharValue], 254U)); { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("CurrentLevel", actualValue)); - VerifyOrReturn(CheckValue("CurrentLevel", actualValue, 50U)); + maxLevelValue = value; } NextTest(); @@ -57547,88 +60352,112 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_6() + CHIP_ERROR + TestStep1cThSendsAMoveToLevelCommandToDutWithTheLevelFieldSetToAValueBetweenTheMinLevelAndMaxLevelValuesIfPresentOtherwiseBetween0x01And0xFEAndTheTransitionTimeFieldSetTo0x0000MoveImmediately_6() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0U]; - params.rate = [NSNumber numberWithUnsignedChar:5U]; + __auto_type * params = [[MTRLevelControlClusterMoveToLevelParams alloc] init]; + params.level = mRandomLevelValue.HasValue() ? [NSNumber numberWithUnsignedChar:mRandomLevelValue.Value()] + : [NSNumber numberWithUnsignedChar:100U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster moveWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate " - @"field set to 0x05 (5 units/s) Error: %@", - err); + [cluster moveToLevelWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 1c: TH sends a MoveToLevel command to DUT, with the Level field set to a value " + @"between the MinLevel and MaxLevel values (if present, otherwise between 0x01 and 0xFE) and " + @"the TransitionTime field set to 0x0000 (move immediately). 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 TestWait5000ms_7() + CHIP_ERROR TestWait100ms_7() { chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; + value.ms = 100UL; return WaitForMs("alpha", value); } - CHIP_ERROR TestSendsStopCommandToDut_8() + CHIP_ERROR TestStep1dThReadsCurrentLevelAttributeFromDut_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterStopParams alloc] init]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster stopWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Sends stop command to DUT Error: %@", err); + [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1d: TH reads CurrentLevel attribute from DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("CurrentLevel", actualValue)); + VerifyOrReturn( + CheckValue("CurrentLevel", actualValue, mRandomLevelValue.HasValue() ? mRandomLevelValue.Value() : 100U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } + NSNumber * _Nonnull CurrentFrequencyValue; - CHIP_ERROR TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_9() + CHIP_ERROR TestStep2aThReadsTheCurrentFrequencyAttribute_9() { - 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); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2a: TH reads the CurrentFrequency attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("currentFrequency", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("currentFrequency", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentFrequency", [value unsignedShortValue], 65535U)); + { + CurrentFrequencyValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } + NSNumber * _Nonnull MinFrequencyValue; - CHIP_ERROR TestThReadsCurrentLevelAttributeFromDut_10() + CHIP_ERROR TestStep2bThReadsTheMinFrequencyAttribute_10() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeMinFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2b: TH reads the MinFrequency attribute. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 64U)); - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 86U)); + VerifyOrReturn(CheckConstraintType("minFrequency", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("minFrequency", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minFrequency", [value unsignedShortValue], 65535U)); + { + MinFrequencyValue = value; } NextTest(); @@ -57636,89 +60465,107 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull MaxFrequencyValue; - CHIP_ERROR TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_11() + CHIP_ERROR TestStep2cThReadsTheMaxFrequencyAttributeAndCheckIfFmaxFminFailTheTest_11() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0U]; - params.rate = [NSNumber numberWithUnsignedChar:5U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster moveWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate " - @"field set to 0x05 (5 units/s) Error: %@", - err); + [cluster readAttributeMaxFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2c: TH reads the MaxFrequency attribute and check, if fmax < fmin, FAIL the test. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("maxFrequency", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("maxFrequency", [value unsignedShortValue], MinFrequencyValue)); + VerifyOrReturn(CheckConstraintMaxValue("maxFrequency", [value unsignedShortValue], 65535U)); + { + MaxFrequencyValue = value; + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait5000ms_12() + CHIP_ERROR TestStep2dSanityCheckOnValuesReadInSteps2a2cIfFcFminFailTheTestAndFcFmaxFailTheTest_12() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2d: sanity check on values read in steps 2a..2c, if fc < fmin, FAIL the test and fc > fmax, FAIL the test " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("currentFrequency", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("currentFrequency", [value unsignedShortValue], MinFrequencyValue)); + VerifyOrReturn(CheckConstraintMaxValue("currentFrequency", [value unsignedShortValue], MaxFrequencyValue)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsAStopWithOnOffCommandToTheDut_13() + CHIP_ERROR + TestStep3aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToARandomValueFrandChosenSuchThatFminFrandFmax_13() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterStopWithOnOffParams alloc] init]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster stopWithOnOffWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends a StopWithOnOff command to the DUT Error: %@", err); + __auto_type * params = [[MTRLevelControlClusterMoveToClosestFrequencyParams alloc] init]; + params.frequency = mRandomFrequencyValue.HasValue() ? [NSNumber numberWithUnsignedShort:mRandomFrequencyValue.Value()] + : [NSNumber numberWithUnsignedShort:30000U]; + [cluster + moveToClosestFrequencyWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 3a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field " + @"set to a random value frand, chosen such that: fmin < frand < fmax 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 TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_14() + CHIP_ERROR TestWait100ms_14() { - 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::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 100UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_15() + CHIP_ERROR TestStep3bThReadsTheCurrentFrequencyAttribute_15() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3b: TH reads the CurrentFrequency attribute. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 85U)); - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 115U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue( + "CurrentFrequency", actualValue, mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); } NextTest(); @@ -57727,39 +60574,66 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionSendOffCommand_16() + CHIP_ERROR TestStep4aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToFmax1_16() + { + + 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 TestStep4bThReadsTheCurrentFrequencyAttribute_17() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster offWithCompletion:^(NSError * _Nullable err) { - NSLog(@"Precondition send Off Command Error: %@", err); + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 4b: TH reads the CurrentFrequency attribute. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue( + "CurrentFrequency", actualValue, mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_17() + CHIP_ERROR TestStep5aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToFmin1_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 TestStep5bThReadsTheCurrentFrequencyAttribute_19() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 5b: TH reads the CurrentFrequency attribute. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + VerifyOrReturn(CheckValue( + "CurrentFrequency", actualValue, mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); } NextTest(); @@ -151918,7 +154792,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 16 : 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")) { + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write")) { NextTest(); return; } @@ -151928,7 +154802,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 17 : 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")) { + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write")) { NextTest(); return; } @@ -151938,7 +154812,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 18 : 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")) { + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write")) { NextTest(); return; } @@ -151948,7 +154822,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 19 : 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")) { + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write")) { NextTest(); return; } @@ -152014,7 +154888,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { break; case 27: ChipLogProgress(chipTool, " ***** Test Step 27 : TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { + if (ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY")) { NextTest(); return; } @@ -152022,7 +154896,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { break; case 28: ChipLogProgress(chipTool, " ***** Test Step 28 : TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { + if (ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } @@ -152030,7 +154904,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { break; case 29: ChipLogProgress(chipTool, " ***** Test Step 29 : TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip("!DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { + if (ShouldSkip(" !DRLK.S.A0023.Write && PICS_SDK_CI_ONLY ")) { NextTest(); return; } @@ -152038,7 +154912,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { break; case 30: ChipLogProgress(chipTool, " ***** Test Step 30 : TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("!DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { + if (ShouldSkip(" !DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP ")) { NextTest(); return; } @@ -155650,20 +158524,1011 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearYearDayScheduleToDut_15() + CHIP_ERROR TestThSendsClearYearDayScheduleToDut_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(@"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_9 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_DRLK_2_9() + : TestCommandBridge("Test_TC_DRLK_2_9") + , 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_9() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_9\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_9\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 : Create new user with default parameters\n"); + err = TestCreateNewUserWithDefaultParameters_1(); + break; + case 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 : TH reads NumberOfTotalUsersSupported attribute and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { + NextTest(); + return; + } + err = TestThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH sends Set Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH sends Get Credential Status Command\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH sends Set Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH sends Set Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDut_7(); + break; + case 8: + ChipLogProgress(chipTool, + " ***** Test Step 8 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential Response " + "command with status as DUPLICATE or OCCUPIED\n"); + if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithStatusAsDuplicateOrOccupied_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential Response " + "command with response as OCCUPIED if the CredentialIndex is repeated\n"); + if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_9(); + break; + case 10: + ChipLogProgress(chipTool, + " ***** Test Step 10 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential " + "Response command with response as OCCUPIED if the CredentialIndex is repeated\n"); + if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH sends Clear Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + NextTest(); + return; + } + err = TestThSendsClearCredentialCommandToDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : TH sends Get Credential Status Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommandToDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends Set User Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { + NextTest(); + return; + } + err = TestThSendsSetUserCommandToDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : TH sends Set Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : TH sends Clear Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + NextTest(); + return; + } + err = TestThSendsClearCredentialCommandToDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : TH sends Get Credential Status Command\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommand_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : TH sends Get Credential Status Command\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommand_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : TH sends Clear Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + NextTest(); + return; + } + err = TestThSendsClearCredentialCommandToDut_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Cleanup the first created user\n"); + err = TestCleanupTheFirstCreatedUser_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Cleanup the second created user\n"); + err = TestCleanupTheSecondCreatedUser_20(); + 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), EMBER_ZCL_STATUS_INVALID_COMMAND)); + 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; + } + + // 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 = 21; + + 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 TestCreateNewUserWithDefaultParameters_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(@"Create new user with default parameters Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheUserBackAndVerifyItsFields_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(@"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 NumberOfTotalUsersSupported; + + CHIP_ERROR TestThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_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(@"TH reads NumberOfTotalUsersSupported 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)); + { + NumberOfTotalUsersSupported = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDut_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 = [[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(@"TH sends Set Credential Command to DUT 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 TestThSendsGetCredentialStatusCommand_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 = [[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(@"TH sends Get Credential Status Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + 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 TestThSendsSetCredentialCommandToDut_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 = [[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:2U]; + + params.credentialData = [[NSData alloc] initWithBytes:"4321" length:4]; + params.userIndex = nil; + params.userStatus = [NSNumber numberWithUnsignedChar:5U]; + params.userType = [NSNumber numberWithUnsignedChar:10U]; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 133U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDut_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 = [[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:2U]; + + params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; + params.userIndex = nil; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 2U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithStatusAsDuplicateOrOccupied_8() + { + + 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 + TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_9() + { + + 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 + TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_10() + { + + 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 TestThSendsClearCredentialCommandToDut_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 = [[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(@"TH sends Clear Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsGetCredentialStatusCommandToDut_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:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command to DUT 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 TestThSendsSetUserCommandToDut_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 = [[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:0U]; + params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; + [cluster setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Set User Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDut_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 = [[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:2U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT 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)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsClearCredentialCommandToDut_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 = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:65534U]; + + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsGetCredentialStatusCommand_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:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:65534U]; + + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command 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 TestThSendsGetCredentialStatusCommand_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 = [[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(@"TH sends Get Credential Status Command 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 TestThSendsClearCredentialCommandToDut_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 = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:0U]; - [cluster - clearYearDayScheduleWithParams:params + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:8U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; + + [cluster clearCredentialWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Year Day Schedule to DUT Error: %@", err); + NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code @@ -155676,29 +159541,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { 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() + CHIP_ERROR TestCleanupTheFirstCreatedUser_19() { MTRBaseDevice * device = GetDevice("alpha"); @@ -155709,7 +159552,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { params.userIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster clearUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user with UserIndex 1 Error: %@", err); + NSLog(@"Cleanup the first created user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -155719,7 +159562,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex5_18() + CHIP_ERROR TestCleanupTheSecondCreatedUser_20() { MTRBaseDevice * device = GetDevice("alpha"); @@ -155727,10 +159570,10 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:5U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; [cluster clearUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user with UserIndex 5 Error: %@", err); + NSLog(@"Cleanup the second created user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -155741,21 +159584,24 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { } }; -class Test_TC_DRLK_2_9 : 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_9() - : TestCommandBridge("Test_TC_DRLK_2_9") + 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_9() {} + ~Test_TC_DRLK_2_11() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -155763,11 +159609,11 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_9\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_11\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_9\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_11\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -155792,147 +159638,164 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { err = TestReadTheUserBackAndVerifyItsFields_2(); break; case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : TH reads NumberOfTotalUsersSupported attribute and saves for future use.\n"); + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads NumberOfTotalUsersSupported and saves for future use.\n"); if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { NextTest(); return; } - err = TestThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_3(); + err = TestThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH sends Set Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads MinPINCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDut_4(); + err = TestThReadsMinPINCodeLengthAndSavesForFutureUse_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH sends Get Credential Status Command\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads MaxPINCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommand_5(); + err = TestThReadsMaxPINCodeLengthAndSavesForFutureUse_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : TH sends Set Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads MinRFIDCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDut_6(); + err = TestThReadsMinRFIDCodeLengthAndSavesForFutureUse_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH sends Set Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads MaxRFIDCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDut_7(); + err = TestThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7(); break; case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential Response " - "command with status as DUPLICATE or OCCUPIED\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : 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 = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithStatusAsDuplicateOrOccupied_8(); + err = TestThSendsSetCredentialCommandToDutWithTypePin_8(); break; case 9: - ChipLogProgress(chipTool, - " ***** Test Step 9 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential Response " - "command with response as OCCUPIED if the CredentialIndex is repeated\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : 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 = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_9(); + err = TestThSendsSetCredentialCommandToDutWithTypeRfid_9(); break; case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential " - "Response command with response as OCCUPIED if the CredentialIndex is repeated\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : 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 = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_10(); + err = TestThSendsSetCredentialCommandToDutWithTypeFingerVein_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH sends Clear Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 11 : 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 = TestThSendsClearCredentialCommandToDut_11(); + err = TestThSendsGetCredentialStatusCommandWithTypePin_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : TH sends Get Credential Status Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 12 : 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 = TestThSendsGetCredentialStatusCommandToDut_12(); + err = TestThSendsGetCredentialStatusCommandWithTypeRfid_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends Set User Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 13 : 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 = TestThSendsSetUserCommandToDut_13(); + err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : TH sends Set Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 14 : 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 = TestThSendsSetCredentialCommandToDut_14(); + err = TestThSendsClearCredentialCommandToDutWithTypePin_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : TH sends Clear Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : 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 = TestThSendsClearCredentialCommandToDut_15(); + err = TestThSendsGetCredentialStatusCommandWithTypeRfid_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : TH sends Get Credential Status Command\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 16 : 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 = TestThSendsGetCredentialStatusCommand_16(); + err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : TH sends Get Credential Status Command\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 17 : 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 = TestThSendsGetCredentialStatusCommand_17(); + err = TestThSendsClearCredentialCommandToDutWithTypeRfid_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : TH sends Clear Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 18 : 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 = TestThSendsClearCredentialCommandToDut_18(); + err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_18(); break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Cleanup the first created user\n"); - err = TestCleanupTheFirstCreatedUser_19(); + ChipLogProgress(chipTool, " ***** Test Step 19 : 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 = TestThSendsClearCredentialCommandToDutWithTypeFingerVein_19(); break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Cleanup the second created user\n"); - err = TestCleanupTheSecondCreatedUser_20(); + ChipLogProgress(chipTool, " ***** Test Step 20 : 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 = TestThSendsGetCredentialStatusCommandToDutWithTypePin_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : 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 = TestThSendsGetCredentialStatusCommandToDutWithTypeRfid_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : 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 = TestThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22(); break; } @@ -156000,7 +159863,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 19: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -156008,6 +159871,12 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { 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. @@ -156021,11 +159890,14 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; + 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() @@ -156141,9 +160013,8 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - NSNumber * _Nonnull NumberOfTotalUsersSupported; - CHIP_ERROR TestThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_3() + CHIP_ERROR TestThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156151,15 +160022,12 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads NumberOfTotalUsersSupported attribute and saves for future use. Error: %@", err); + NSLog(@"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], 65534U)); - { - NumberOfTotalUsersSupported = value; - } + VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65535U)); NextTest(); }]; @@ -156167,7 +160035,91 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDut_4() + CHIP_ERROR TestThReadsMinPINCodeLengthAndSavesForFutureUse_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(@"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 TestThReadsMaxPINCodeLengthAndSavesForFutureUse_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(@"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 TestThReadsMinRFIDCodeLengthAndSavesForFutureUse_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(@"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 TestThReadsMaxRFIDCodeLengthAndSavesForFutureUse_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(@"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 TestThSendsSetCredentialCommandToDutWithTypePin_8() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156180,14 +160132,16 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; + 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(@"TH sends Set Credential Command to DUT Error: %@", err); + NSLog(@"TH sends Set Credential Command to DUT with type PIN Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156213,7 +160167,103 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommand_5() + CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypeRfid_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:"RFIDTESTDATA" length:12]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"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 TestThSendsSetCredentialCommandToDutWithTypeFingerVein_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:"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(@"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 TestThSendsGetCredentialStatusCommandWithTypePin_11() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156228,10 +160278,15 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { [cluster getCredentialStatusWithParams:params completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command Error: %@", err); + NSLog(@"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; @@ -156262,120 +160317,115 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDut_6() + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeRfid_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 = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - params.credentialData = [[NSData alloc] initWithBytes:"4321" length:4]; - params.userIndex = nil; - params.userStatus = [NSNumber numberWithUnsignedChar:5U]; - params.userType = [NSNumber numberWithUnsignedChar:10U]; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command with type RFID Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 133U)); - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - NextTest(); - }]; + { + 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 TestThSendsSetCredentialCommandToDut_7() + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_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 = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; - - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = nil; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 2U)); - } + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"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 - TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithStatusAsDuplicateOrOccupied_8() - { + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - 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); - } + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - CHIP_ERROR - TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_9() - { + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - 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); - } + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } - CHIP_ERROR - TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_10() - { + NextTest(); + }]; - 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); + return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDut_11() + CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypePin_14() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156389,7 +160439,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { [cluster clearCredentialWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); + NSLog(@"TH sends Clear Credential Command to DUT with type PIN Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156399,7 +160449,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandToDut_12() + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeRfid_15() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156408,34 +160458,38 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((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(@"TH sends Get Credential Status Command to DUT Error: %@", err); + NSLog(@"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, false)); + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); } + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); { id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); } { id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); } { id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); } { @@ -156449,74 +160503,139 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetUserCommandToDut_13() + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_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 = [[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:0U]; - params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; - [cluster setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Set User Command to 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(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); - NextTest(); - }]; + 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 TestThSendsSetCredentialCommandToDut_14() + CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypeRfid_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 = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Clear Credential Command to DUT with type RFID Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + NextTest(); + }]; - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + return CHIP_NO_ERROR; + } - NextTest(); - }]; + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_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(@"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 TestThSendsClearCredentialCommandToDut_15() + CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypeFingerVein_19() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156525,12 +160644,12 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:65534U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster clearCredentialWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); + NSLog(@"TH sends Clear Credential Command to DUT with type FingerVein Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156540,7 +160659,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommand_16() + CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypePin_20() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156550,12 +160669,12 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:65534U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster getCredentialStatusWithParams:params completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command Error: %@", err); + NSLog(@"TH sends Get Credential Status Command to DUT with type PIN Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156590,7 +160709,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommand_17() + CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypeRfid_21() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156599,13 +160718,13 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((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(@"TH sends Get Credential Status Command Error: %@", err); + NSLog(@"TH sends Get Credential Status Command to DUT with type RFID Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156640,94 +160759,72 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDut_18() + CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_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:8U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; - - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential 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 TestCleanupTheFirstCreatedUser_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 = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the first created user Error: %@", err); + ((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(@"TH sends Get Credential Status Command to DUT 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, false)); + } - CHIP_ERROR TestCleanupTheSecondCreatedUser_20() - { + { + 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:2U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the second 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; } }; -class Test_TC_DRLK_2_11 : public TestCommandBridge { +class Test_TC_DRLK_2_12 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_11() - : TestCommandBridge("Test_TC_DRLK_2_11") + Test_TC_DRLK_2_12() + : TestCommandBridge("Test_TC_DRLK_2_12") , 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() {} + ~Test_TC_DRLK_2_12() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -156735,11 +160832,11 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_11\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_12\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_11\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_12\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -156756,172 +160853,312 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Create new user with default parameters\n"); - err = TestCreateNewUserWithDefaultParameters_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Create new user\n"); + err = TestCreateNewUser_1(); break; case 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 : TH reads NumberOfTotalUsersSupported and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { - NextTest(); - return; - } - err = TestThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_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 : TH reads MinPINCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { - NextTest(); - return; - } - err = TestThReadsMinPINCodeLengthAndSavesForFutureUse_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Verify created PIN credential\n"); + err = TestVerifyCreatedPinCredential_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads MaxPINCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { + ChipLogProgress(chipTool, + " ***** Test Step 5 : Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write")) { NextTest(); return; } - err = TestThReadsMaxPINCodeLengthAndSavesForFutureUse_5(); + err = TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads MinRFIDCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a")) { + ChipLogProgress(chipTool, + " ***** Test Step 6 : Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write")) { NextTest(); return; } - err = TestThReadsMinRFIDCodeLengthAndSavesForFutureUse_6(); + err = TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads MaxRFIDCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019")) { + ChipLogProgress( + chipTool, " ***** Test Step 7 : Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { NextTest(); return; } - err = TestThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7(); + err = TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : 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")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3: TH sends Ubolt Door Command to the DUT without PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutWithTypePin_8(); + err = TestStep3ThSendsUboltDoorCommandToTheDutWithoutPINCode_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : 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")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 4: TH sends Ubolt Door Command to the DUT with PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutWithTypeRfid_9(); + err = TestStep4ThSendsUboltDoorCommandToTheDutWithPINCode_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 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")) { + ChipLogProgress(chipTool, + " ***** Test Step 10 : Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutWithTypeFingerVein_10(); + err = TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : 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")) { + ChipLogProgress(chipTool, + " ***** Test Step 11 : Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypePin_11(); + err = TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : 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")) { + ChipLogProgress( + chipTool, " ***** Test Step 12 : Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeRfid_12(); + err = TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : 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")) { + 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 && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_13(); + err = TestStep7ThSendsUboltDoorCommandToTheDutWithValidPINCode_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : TH sends Clear Credential Command to DUT with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { + 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 && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDutWithTypePin_14(); + err = TestStep8ThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : 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")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 9: TH sends Unbolt Door Command to the DUT without PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeRfid_15(); + err = TestStep9ThSendsUnboltDoorCommandToTheDutWithoutPINCode_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : 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")) { + ChipLogProgress( + chipTool, " ***** Test Step 16 : Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_16(); + err = TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : TH sends Clear Credential Command to DUT with type RFID\n"); - if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress( + chipTool, " ***** Test Step 17 : Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDutWithTypeRfid_17(); + err = TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : 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")) { + 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.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_18(); + err = TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_18(); break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : TH sends Clear Credential Command to DUT with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { + 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.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDutWithTypeFingerVein_19(); + err = TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_19(); break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : 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")) { + 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")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandToDutWithTypePin_20(); + err = TestStep12aThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_20(); break; case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : 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")) { + 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")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandToDutWithTypeRfid_21(); + err = TestStep12bThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_21(); + 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")) { + NextTest(); + return; + } + err = TestStep12cThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_22(); + break; + case 23: + 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.F0c && ( 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")) { + NextTest(); + return; + } + err = TestStep14ThSendsUnboltDoorCommandToTheDutWithValidPINCodeBeforeUserCodeTemporaryDisableTimeExpires_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Wait for UserCodeTemporaryDisableTime expires\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031")) { + NextTest(); + return; + } + err = TestWaitForUserCodeTemporaryDisableTimeExpires_26(); + 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")) { + NextTest(); + return; + } + err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_27(); + break; + case 28: + 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")) { + NextTest(); + return; + } + err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_28(); + 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")) { + NextTest(); + return; + } + err = TestStep15ThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_29(); + 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")) { + NextTest(); + return; + } + err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_30(); + 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")) { + NextTest(); + return; + } + err = TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_31(); + 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")) { + NextTest(); + return; + } + err = TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_32(); + break; + case 33: + 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")) { + NextTest(); + return; + } + err = TestStep17ThSendsTheUnboltDoorCommandToTheDutWithValidPINCode_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 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : 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")) { + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : Clean the created credential\n"); + if (ShouldSkip("DRLK.S.C26.Rsp")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22(); + err = TestCleanTheCreatedCredential_38(); break; } @@ -156953,7 +161190,7 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -156968,7 +161205,7 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + 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)); @@ -156977,30 +161214,78 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + 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)); + 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), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + 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; } @@ -157016,14 +161301,11 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 23; + const uint16_t mTestCount = 39; 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() @@ -157034,7 +161316,7 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestCreateNewUserWithDefaultParameters_1() + CHIP_ERROR TestCreateNewUser_1() { MTRBaseDevice * device = GetDevice("alpha"); @@ -157051,7 +161333,7 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; [cluster setUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Create new user with default parameters Error: %@", err); + NSLog(@"Create new user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -157140,83 +161422,171 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3() + CHIP_ERROR TestCreateNewPinCredentialAndLockUnlockUser_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(@"TH reads NumberOfTotalUsersSupported and saves for future use. Error: %@", err); + __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]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + 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(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65535U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + 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 TestThReadsMinPINCodeLengthAndSavesForFutureUse_4() + CHIP_ERROR TestVerifyCreatedPinCredential_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(@"TH reads MinPINCodeLength and saves for future use. 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(@"Verify created PIN credential Error: %@", err); - VerifyOrReturn(CheckConstraintMinValue("minPINCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("minPINCodeLength", [value unsignedCharValue], 255U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + 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)); + } + + { + 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 TestThReadsMaxPINCodeLengthAndSavesForFutureUse_5() + CHIP_ERROR TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_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(@"TH reads MaxPINCodeLength and saves for future use. Error: %@", err); + 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)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("maxPINCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("maxPINCodeLength", [value unsignedCharValue], 255U)); + NextTest(); + }]; - NextTest(); - }]; + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_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 1: TH writes the RequirePINforRemoteOperation attribute " + @"value as False 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(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsMinRFIDCodeLengthAndSavesForFutureUse_6() + 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 readAttributeMinRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MinRFIDCodeLength and saves for future use. Error: %@", err); + [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)); - VerifyOrReturn(CheckConstraintMinValue("minRFIDCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("minRFIDCodeLength", [value unsignedCharValue], 255U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, false)); + } NextTest(); }]; @@ -157224,713 +161594,693 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7() + CHIP_ERROR TestStep3ThSendsUboltDoorCommandToTheDutWithoutPINCode_8() { 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(@"TH reads MaxRFIDCodeLength and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __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(CheckConstraintMinValue("maxRFIDCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("maxRFIDCodeLength", [value unsignedCharValue], 255U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypePin_8() + 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); - __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]; + __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); - 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(@"TH sends Set Credential Command to DUT with type PIN Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + NextTest(); + }]; - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + CHIP_ERROR TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_10() + { - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - NextTest(); - }]; + 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)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypeRfid_9() + CHIP_ERROR TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_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 = [[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]; + 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); - params.credentialData = mRFIDCredentialData.HasValue() - ? [NSData dataWithBytes:mRFIDCredentialData.Value().data() length:mRFIDCredentialData.Value().size()] - : [[NSData alloc] initWithBytes:"RFIDTESTDATA" length:12]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT with type RFID 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)); + return CHIP_NO_ERROR; + } - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + CHIP_ERROR TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12() + { - { - 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.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, true)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypeFingerVein_10() + CHIP_ERROR TestStep7ThSendsUboltDoorCommandToTheDutWithValidPINCode_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 = [[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]; + __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); - params.credentialData = mFingerVeinCredentialData.HasValue() - ? [NSData dataWithBytes:mFingerVeinCredentialData.Value().data() length:mFingerVeinCredentialData.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(@"TH sends Set Credential 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.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + CHIP_ERROR TestStep8ThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_14() + { - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - NextTest(); - }]; + __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); + + 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 TestThSendsGetCredentialStatusCommandWithTypePin_11() + CHIP_ERROR TestStep9ThSendsUnboltDoorCommandToTheDutWithoutPINCode_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:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command with type PIN Error: %@", err); + __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); - 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(); + }]; - { - 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 TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_16() + { - { - 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)); - } + 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.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeRfid_12() + CHIP_ERROR TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_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 = [[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(@"TH sends Get Credential Status Command with type RFID Error: %@", err); + 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); - 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_UNSUPPORTED_WRITE)); + 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 + TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_18() + { - { - 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)); - } + 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.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_13() + CHIP_ERROR + TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_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 = [[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(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + 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.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + CHIP_ERROR TestStep12aThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_20() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", 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.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123457" length:6]; + [cluster + unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 12a: TH sends Unbolt Door Command to the DUT with invalid PINCode 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 TestThSendsClearCredentialCommandToDutWithTypePin_14() + CHIP_ERROR TestStep12bThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_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 = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort: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); - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT with type PIN 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; + } - NextTest(); - }]; + CHIP_ERROR TestStep12cThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_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 = [[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 TestThSendsGetCredentialStatusCommandWithTypeRfid_15() + CHIP_ERROR TestStep12dThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_23() { 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]; + __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); - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command with type RFID 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 TestStep13ThReadsUserCodedTemporaryDisableTimeAttributeFromDut_24() + { - 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)); - } + [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 13: TH reads UserCodedTemporaryDisableTime attribute from 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)); - } + { + id actualValue = value; + VerifyOrReturn(CheckValue("UserCodeTemporaryDisableTime", actualValue, 15U)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_16() + CHIP_ERROR TestStep14ThSendsUnboltDoorCommandToTheDutWithValidPINCodeBeforeUserCodeTemporaryDisableTimeExpires_25() { 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]; + __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); - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"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 TestWaitForUserCodeTemporaryDisableTimeExpires_26() + { - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 15000UL; + return WaitForMs("alpha", value); + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_27() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", 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.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + 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); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypeRfid_17() + CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_28() { 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(@"TH sends Clear Credential Command to DUT with type RFID Error: %@", err); + 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); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_18() + CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_29() { 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(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + 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); - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_30() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", 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.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + 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); - 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 TestThSendsClearCredentialCommandToDutWithTypeFingerVein_19() + CHIP_ERROR TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_31() { 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 readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 16: TH reads the AutoRelockTime attribute from the DUT Error: %@", err); - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT with type FingerVein 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)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypePin_20() + CHIP_ERROR TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_32() { 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 readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 16: TH reads the AutoRelockTime attribute from the DUT Error: %@", err); - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command to DUT with type PIN 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.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); - } + NextTest(); + }]; - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } + CHIP_ERROR TestStep17ThSendsTheUnboltDoorCommandToTheDutWithValidPINCode_33() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", 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.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + __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); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypeRfid_21() + 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() { 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 readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 18: TH reads LockState attribute Error: %@", err); - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command to DUT with type RFID 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.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); - } + NextTest(); + }]; - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } + CHIP_ERROR TestCleanupTheCreatedUser_37() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", 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.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", 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); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22() + 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 = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((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(@"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)); - } + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Clean the created credential Error: %@", err); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } @@ -163283,6 +167633,14 @@ 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(), @@ -163301,6 +167659,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -163448,6 +167807,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),